Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
d74132ca
Unverified
Commit
d74132ca
authored
Jan 11, 2026
by
Ning Xie
Committed by
GitHub
Jan 11, 2026
Browse files
fix offline inference chat response prompt (#32088)
Signed-off-by:
Andy Xie
<
andy.xning@gmail.com
>
parent
a34abc49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
examples/offline_inference/context_extension.py
examples/offline_inference/context_extension.py
+9
-7
examples/offline_inference/spec_decode.py
examples/offline_inference/spec_decode.py
+5
-2
No files found.
examples/offline_inference/context_extension.py
View file @
d74132ca
...
...
@@ -9,7 +9,7 @@ Usage:
python examples/offline_inference/context_extension.py
"""
from
vllm
import
LLM
,
SamplingParams
from
vllm
import
LLM
,
RequestOutput
,
SamplingParams
def
create_llm
():
...
...
@@ -45,13 +45,15 @@ def run_llm_chat(llm):
{
"role"
:
"assistant"
,
"content"
:
"Hello! How can I assist you today?"
},
]
outputs
=
llm
.
chat
(
conversation
,
sampling_params
,
use_tqdm
=
False
)
return
outputs
return
outputs
,
[
conversation
,
]
def
print_outputs
(
outputs
):
def
print_outputs
(
outputs
:
list
[
RequestOutput
],
conversations
:
list
):
print
(
"
\n
Generated Outputs:
\n
"
+
"-"
*
80
)
for
output
in
outputs
:
prompt
=
output
.
prompt
for
i
,
output
in
enumerate
(
outputs
)
:
prompt
=
conversations
[
i
]
generated_text
=
output
.
outputs
[
0
].
text
print
(
f
"Prompt:
{
prompt
!
r
}
\n
"
)
print
(
f
"Generated text:
{
generated_text
!
r
}
"
)
...
...
@@ -60,8 +62,8 @@ def print_outputs(outputs):
def
main
():
llm
=
create_llm
()
outputs
=
run_llm_chat
(
llm
)
print_outputs
(
outputs
)
outputs
,
conversations
=
run_llm_chat
(
llm
)
print_outputs
(
outputs
,
conversations
)
if
__name__
==
"__main__"
:
...
...
examples/offline_inference/spec_decode.py
View file @
d74132ca
...
...
@@ -152,9 +152,12 @@ def main(args):
# print the generated text
if
args
.
print_output
:
for
output
in
outputs
:
for
i
,
output
in
enumerate
(
outputs
)
:
print
(
"-"
*
50
)
print
(
f
"prompt:
{
output
.
prompt
}
"
)
if
not
args
.
custom_mm_prompts
:
print
(
f
"prompt:
{
prompts
[
i
].
prompt
}
"
)
else
:
print
(
f
"prompt:
{
prompts
[
i
]
}
"
)
print
(
f
"generated text:
{
output
.
outputs
[
0
].
text
}
"
)
print
(
"-"
*
50
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment