-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add load generation config from model #11164
Merged
DarkLight1337
merged 20 commits into
vllm-project:main
from
liuyanyi:add_generation_config
Dec 19, 2024
Merged
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
242ea24
[Feature] Add load generation config from model
liuyanyi bdedf17
Fix v1 engine
liuyanyi c241417
Fix lint
liuyanyi 4ee9aac
fix
liuyanyi 7f2d07e
move
liuyanyi ed0b9b0
Unify diff sample param into model config
liuyanyi ef436b7
remove useless generation_config_fields
liuyanyi cde9a97
fix test for chat
liuyanyi c0c806e
remove tricky pydantic process
liuyanyi 41b1786
reverse
liuyanyi b24cc51
fix default value
liuyanyi ec81aab
Merge remote-tracking branch 'origin/main' into add_generation_config
liuyanyi 90ccb80
Merge remote-tracking branch 'origin/main' into add_generation_config
liuyanyi cffde04
fix wrong temp
liuyanyi 08ad1b7
Fix, add test for temp 0.0
liuyanyi 35205eb
fix beam
liuyanyi d9fdb3b
default 1.0
liuyanyi 0708124
Merge branch 'main' into add_generation_config
DarkLight1337 69819ca
[Enhancement] Add default sampling parameters for chat and completion…
liuyanyi feda31e
Merge branch 'main' into add_generation_config
DarkLight1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
examples/offline_inference_with_default_generation_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from vllm import LLM | ||
|
||
# Sample prompts. | ||
prompts = [ | ||
"Hello, my name is", | ||
"The president of the United States is", | ||
"The capital of France is", | ||
"The future of AI is", | ||
] | ||
|
||
# Create an LLM with built-in default generation config. | ||
# The generation config is set to None by default to keep | ||
# the behavior consistent with the previous version. | ||
# If you want to use the default generation config from the model, | ||
# you should set the generation_config to "auto". | ||
llm = LLM(model="Qwen/Qwen2.5-0.5B-Instruct", generation_config="auto") | ||
|
||
# Load the default sampling parameters from the model. | ||
sampling_params = llm.get_default_sampling_params() | ||
# Modify the sampling parameters if needed. | ||
sampling_params.temperature = 0.5 | ||
|
||
# Generate texts from the prompts. The output is a list of RequestOutput objects | ||
# that contain the prompt, generated text, and other information. | ||
outputs = llm.generate(prompts, sampling_params) | ||
# Print the outputs. | ||
for output in outputs: | ||
prompt = output.prompt | ||
generated_text = output.outputs[0].text | ||
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How were these params chosen? I also see token ids specified in some generation configs
https://huggingface.co/microsoft/Phi-3.5-mini-instruct/blob/main/generation_config.json
https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct/blob/main/generation_config.json
https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct/blob/main/generation_config.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vllm/vllm/engine/llm_engine.py
Line 850 in 0708124
I think token_ids has been used in llm_engine