-
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
Conversation
@@ -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) |
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.
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 comment
The 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 comment
The 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 comment
The 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 comment
The 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 do_sample=True
, that could cause confusion when users switch between backends. I wonder if it's possible (or woth it) to try to unify the behavior when do_sample=True across all backends (meaning same temperature/other params set to same value)
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.
Agreed, Will write an internal quip doc for it.
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 implements greedy sampling differently internally, but it just uses temperature of 0 as the API instead of adding a separate parameter for it.
0b3ae63
to
5ae924f
Compare
Description
This PR
n
> 1.n
in equivalent tonum_return_sequences
in huggingface]