Skip to content

Conversation

@frank-wei
Copy link
Contributor

@frank-wei frank-wei commented Dec 1, 2025

Purpose

There is a risk when people unintentionally try to access scheduler_config.max_model_len and it is returned as 8192. SInce it is removed in #28733, we should give people AttributeError as alert.

Test Plan

Test Result

Before the fix:

from vllm.config import VllmConfig
vllm_config = VllmConfig()
INFO 11-30 22:40:59 [scheduler.py:207] Chunked prefill is enabled with max_num_batched_tokens=2048.
vllm_config.scheduler_config.max_model_len
8192

After the fix:

from vllm.config import VllmConfig
vllm_config = VllmConfig()
INFO 11-30 22:40:08 [scheduler.py:207] Chunked prefill is enabled with max_num_batched_tokens=2048.
vllm_config.scheduler_config.max_model_len
Traceback (most recent call last):
File "", line 1, in
File "/data/users/wwei6/gitrepos/vllm-main-frank-branch/vllm/config/scheduler.py", line 280, in getattribute
raise AttributeError(
AttributeError: max_model_len is an init-only parameter.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: Wei Wei <wwei6@meta.com>
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request correctly addresses the issue of unintended access to InitVar attributes in SchedulerConfig by implementing a __getattribute__ method. This prevents incorrect values from being returned and guides users to the correct ModelConfig for these parameters. This is a good defensive programming practice.

@frank-wei frank-wei changed the title [Misc] Fix unintended access to scheduler_config.max_model_len [Misc] Throw error on unintended access to scheduler_config.max_model_len Dec 1, 2025
Signed-off-by: Wei Wei <wwei6@meta.com>
@DarkLight1337
Copy link
Member

@hmellor I thought InitVar would do that already...

@frank-wei
Copy link
Contributor Author

@hmellor I thought InitVar would do that already...

@DarkLight1337 , I thought too but seems that @config decoration will leverage Pydantic model and it stores it as attribute indeed.

Signed-off-by: Wei Wei <wwei6@meta.com>
@zhuohan123 zhuohan123 added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 1, 2025
@DarkLight1337 DarkLight1337 merged commit fc95521 into vllm-project:main Dec 2, 2025
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants