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

[Frontend] Warn if user max_model_len is greater than derived max_model_len #7080

Merged
merged 7 commits into from
Aug 3, 2024

Conversation

fialhocoelho
Copy link
Contributor

Explanation of Changes

Summary

This update addresses the handling of user-specified MAX_SEQUENCE_LENGTH values that exceed the model's maximum sequence length. The behavior is controlled by the environment variable VLLM_ALLOW_LONG_MAX_MODEL_LEN, which defaults to 0.

@njhill @Yard1 @robertgshaw2-neuralmagic @maxdebayser I mistakenly closed the other PR while syncing with the main. Here is the link to the previous one: #5911 (to maintain comment traceability).

Motivation

Previously, an error was triggered when user max_model_len exceeded the derived value, potentially leading to unintended behavior or CUDA errors. By changing this to a warning, users are alerted without halting execution, allowing flexibility depending on their needs.

Notes

  • Adjusted from f-string interpolation to % formatting for logging, in line with best practices (referencing W1203).
  • The change ensures compatibility with environments where logging-format-interpolation may be disabled, maintaining robustness across different configurations.
  • Default Behavior (VLLM_ALLOW_LONG_MAX_MODEL_LEN=0):
    • If the user-specified MAX_SEQUENCE_LENGTH is greater than the model's maximum sequence length, an error will be raised. This prevents potential incorrect model outputs or CUDA errors that could arise from exceeding the model's capabilities.
  • Optional Behavior (VLLM_ALLOW_LONG_MAX_MODEL_LEN=1):
    • If VLLM_ALLOW_LONG_MAX_MODEL_LEN is set to 1, the system will allow the user-specified MAX_SEQUENCE_LENGTH to exceed the model's maximum. Instead of raising an error, a warning message will be logged, advising users to ensure the value is correct and within the model's context size. This provides flexibility for advanced users who understand the risks and need to override the default limit.

Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Copy link

github-actions bot commented Aug 2, 2024

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which consists a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of default ones by unblocking the steps in your fast-check build on Buildkite UI.

Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge).

To run full CI, you can do one of these:

  • Comment /ready on the PR
  • Add ready label to the PR
  • Enable auto-merge.

🚀

Copy link
Member

@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 @fialhocoelho! Just have some minor rewording suggestions.

vllm/config.py Outdated Show resolved Hide resolved
vllm/envs.py Outdated Show resolved Hide resolved
fialhocoelho and others added 4 commits August 2, 2024 12:02
Some text nits

Co-authored-by: Nick Hill <nickhill@us.ibm.com>
Some text nits

Co-authored-by: Nick Hill <nickhill@us.ibm.com>
Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Copy link
Member

@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 @fialhocoelho

@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 3, 2024
@njhill
Copy link
Member

njhill commented Aug 3, 2024

@fialhocoelho could you merge in the main branch again, it should help with the CI test failures.

@fialhocoelho
Copy link
Contributor Author

fialhocoelho commented Aug 3, 2024

@njhill sure

@njhill njhill merged commit 825b044 into vllm-project:main Aug 3, 2024
66 checks passed
sfc-gh-mkeralapura pushed a commit to sfc-gh-mkeralapura/vllm that referenced this pull request Aug 12, 2024
…model_len` (vllm-project#7080)

Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Co-authored-by: Nick Hill <nickhill@us.ibm.com>
kylesayrs pushed a commit to neuralmagic/vllm that referenced this pull request Aug 17, 2024
…model_len` (vllm-project#7080)

Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Co-authored-by: Nick Hill <nickhill@us.ibm.com>
Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
…model_len` (vllm-project#7080)

Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Co-authored-by: Nick Hill <nickhill@us.ibm.com>
Signed-off-by: Alvant <alvasian@yandex.ru>
KuntaiDu pushed a commit to KuntaiDu/vllm that referenced this pull request Nov 20, 2024
…model_len` (vllm-project#7080)

Signed-off-by: Jefferson Fialho <jfialho@ibm.com>
Co-authored-by: Nick Hill <nickhill@us.ibm.com>
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