-
Notifications
You must be signed in to change notification settings - Fork 68
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
[UX] sampling with vllm #1624
[UX] sampling with vllm #1624
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,15 +86,19 @@ def translate_vllm_params(self, parameters: dict) -> dict: | |
|
||
:return: The same parameters dict, but with VLLM style parameter names. | ||
""" | ||
parameters.pop('do_sample', None) | ||
parameters["max_tokens"] = parameters.pop("max_new_tokens", 30) | ||
if "seed" in parameters.keys(): | ||
parameters["seed"] = int(parameters["seed"]) | ||
if "max_new_tokens" in parameters.keys(): | ||
parameters["max_tokens"] = parameters.pop("max_new_tokens") | ||
if not parameters.pop('do_sample', False): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is do_sample also an alias for sampling with some default temperature in other backends? if so, are the default values for temperature when do_sample is set in parity across backends? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, we probably want to define the do sample behavior There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, do_sample means sampling here. But the default for temperature for greedy in other backends is 1.0. And vllm seems to do sampling only when temperature is less than 1.0. I guess, they go for the logic that settign temp=0, means disabling the randomness, so they choose greedy when temp is set to 0. vLLM chooses Sampling as their default method for choosing next token. But all other frameworks has Greedy as their default. So to unify our handlers behavior, here we are trying to make the sampling method in parity. But yes, default temp value would not be the same as other backends. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. It can be in another PR, or it might not be feasible at all, but if the default sampling behavior is different across backends when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, Will write an internal quip doc for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. vllm implements greedy sampling differently internally, but it just uses temperature of 0 as the API instead of adding a separate parameter for it. |
||
# if temperature is zero, vLLM does greedy sampling | ||
parameters['temperature'] = 0 | ||
if "stop_sequences" in parameters.keys(): | ||
parameters["stop"] = parameters.pop("stop_sequences") | ||
if "ignore_eos_token" in parameters.keys(): | ||
parameters["ignore_eos"] = parameters.pop("ignore_eos") | ||
if "num_beams" in parameters.keys(): | ||
parameters["best_of"] = parameters.pop("num_beams") | ||
parameters["use_beam_search"] = True | ||
return parameters | ||
|
||
@stop_on_any_exception | ||
|
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.
why 30? is this the same default for other backends as well?
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.
Yes, this is the same default for other backends in our handlers.