Skip to content
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

fix: consistent env var parsing for all boolean args in vLLM #98

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

tjohnson31415
Copy link
Contributor

@tjohnson31415 tjohnson31415 commented Aug 19, 2024

Support consistent parsing of boolean arguments defined in vLLM.

Description

In vLLM, some args use action='store_true':
https://github.com/vllm-project/vllm/blob/df845b2b46c3e30f5bd3e3be286285ed148323fc/vllm/engine/arg_utils.py#L202-L204
and --enable-chunked-prefill has a custom arg parsing action called StoreBoolean:
https://github.com/vllm-project/vllm/blob/df845b2b46c3e30f5bd3e3be286285ed148323fc/vllm/engine/arg_utils.py#L561-L568

We want EnvVarArgumentParser to treat all of these boolean args consistently. The fix in this PR is to inspect the type of the action in addition to action.type to detect when we need to parse a boolean from the env var value.

In my testing, I also learned that argparse will parse default string values into the correct type for the argument, so there's no need to have special handling for int args (which would also imply special handling of float, _bool_from_string, nullable_str, and other typed args).

How Has This Been Tested?

Tested by hand for the actual vLLM args and also added unit tests of EnvVarArgumentParser for the 'store_true', 'store_false', and StoreBoolean action types for boolean args.

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

refactor: simplify _swich_action_default

Signed-off-by: Travis Johnson <[email protected]>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.87%. Comparing base (50b020b) to head (54469cf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #98      +/-   ##
==========================================
+ Coverage   54.77%   55.87%   +1.09%     
==========================================
  Files          24       24              
  Lines        1446     1482      +36     
  Branches      259      266       +7     
==========================================
+ Hits          792      828      +36     
  Misses        579      579              
  Partials       75       75              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@njhill njhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tjohnson31415!

@tjohnson31415 tjohnson31415 added this pull request to the merge queue Aug 19, 2024
Merged via the queue into main with commit 537a42b Aug 19, 2024
3 checks passed
@tjohnson31415 tjohnson31415 deleted the boolean-args branch August 19, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants