-
Notifications
You must be signed in to change notification settings - Fork 18
[Cleanup] [Policy] Use vLLM SamplingParams
instead of custom class
#377
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
[Cleanup] [Policy] Use vLLM SamplingParams
instead of custom class
#377
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #377 +/- ##
=======================================
Coverage ? 64.36%
=======================================
Files ? 79
Lines ? 7728
Branches ? 0
=======================================
Hits ? 4974
Misses ? 2754
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aedcc27
to
39d041d
Compare
Oh this is a fun one, taking a look
The field is being renamed, but the underlying impl is mostly the same (i think they called it out ~2 weeks ago) |
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.
This passes the gut test
if (prompt := cfg.get("prompt")) is None: | ||
gd = cfg.policy.get("sampling_config", {}).get("guided_decoding", False) | ||
prompt = "What is 3+5?" if gd else "Tell me a joke" | ||
prompt = "Tell me a joke" |
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.
if (prompt := cfg.get("prompt")) is None: | |
gd = cfg.policy.get("sampling_config", {}).get("guided_decoding", False) | |
prompt = "What is 3+5?" if gd else "Tell me a joke" | |
prompt = "Tell me a joke" | |
prompt := cfg.get("prompt", "Tell me a joke") |
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.
Ugh can't apply suggestion on deleted lines :/
Maslow's hierarchy of tests goes unit tests, integration tests, gut tests |
if isinstance(sampling_config, Mapping): | ||
sampling_config = SamplingConfig(**sampling_config) | ||
if isinstance(sampling_params, Mapping): | ||
sampling_params = SamplingParams.from_optional(**sampling_params) |
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.
Note for whoever in the future needs to use rich fields of vllm/v1 in yaml:
from_optional doesn't play well with rich fields (nesting)
Context
We previously had a custom class called
SamplingConfig
that would selectively map variables to vLLM'sSamplingParams
. While this was nice for conversion to/fro dictionary structs, it was an additional redirect for the user to understand what knobs were actually available for sampling.Changes
SamplingConfig
, instead relying directly onSamplingParams
.SamplingParams
Testing