-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Remove default values from InitVars so that they're not stored
#29859
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
Conversation
Signed-off-by: Harry Mellor <[email protected]>
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.
Code Review
This pull request refactors SchedulerConfig by removing default values from InitVar fields, moving them to a factory lambda used by VllmConfig. This change is intended to prevent the default values from being stored while allowing VllmConfig to be default-constructed. The changes are logical and well-contained. I have one suggestion to improve the code style by replacing the lambda assignment with a standard function definition, following PEP 8 guidelines for better readability and maintainability.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Does moving the defaults into |
Signed-off-by: Harry Mellor <[email protected]>
Signed-off-by: Harry Mellor <[email protected]>
If we remove the default values from the |
DarkLight1337
left a comment
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.
LGTM then, thanks
|
Here's a little script you can run to validate the expected behaviour: from pydantic import ValidationError
from vllm.config import SchedulerConfig
try:
scheduler_config = SchedulerConfig()
except ValidationError as e:
# Positional InitVars were missing
print(f"ValidationError: {e}")
try:
scheduler_config = SchedulerConfig.default_factory()
scheduler_config.max_model_len
except AttributeError as e:
# InitVar does not become an attribute
print(f"AttributeError: {e}")Both prints should execute if the |
Signed-off-by: Harry Mellor <[email protected]>
|
I turned that little script into a test |
) Signed-off-by: Harry Mellor <[email protected]> (cherry picked from commit 951445a)
The default values have been moved to a factory lambda that's used by
VllmConfigso thatVllmConfigcan still be default constructed without error.Replaces the hotfix in #29771