Skip to content

fix: name unsloth_vllm_standby parameter in vLLM standby error - #7089

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
anxkhn:patch-5
Jul 15, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
anxkhn:patch-5

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

What

FastBaseModel.from_pretrained's vLLM-standby guard raises a self-contradictory
error message. The guard is:

if unsloth_vllm_standby and os.environ.get("UNSLOTH_VLLM_STANDBY", "0") != "1":
    raise RuntimeError(
        "Unsloth: UNSLOTH_VLLM_STANDBY is True, but UNSLOTH_VLLM_STANDBY is not set to 1!"
    )

The value that is True here is the unsloth_vllm_standby parameter, while
UNSLOTH_VLLM_STANDBY is the environment variable that is not set to 1. The
message names the env var in both clauses, so it literally reads
"UNSLOTH_VLLM_STANDBY is True, but UNSLOTH_VLLM_STANDBY is not set to 1", which
points the user at the wrong thing.

The sibling guard in FastLlamaModel.from_pretrained
(unsloth/models/llama.py) already words the same check correctly (parameter in
the first clause, env var in the second). This aligns vision.py with it.

Change

unsloth/models/vision.py - one line, message text only:

-                "Unsloth: UNSLOTH_VLLM_STANDBY is True, but UNSLOTH_VLLM_STANDBY is not set to 1!"
+                "Unsloth: `unsloth_vllm_standby` is True, but environment variable `UNSLOTH_VLLM_STANDBY` is not set to 1!"

No behavior change: the guard condition is untouched, only the message string
changes.

Test

Adds tests/test_vllm_standby_error_message.py. It parses the guard's raised
string out of the source with ast (following the source-parsing precedent in
tests/test_loader_glob_skip.py) so it needs no GPU or model download, and
asserts:

  • the vision.py message names the unsloth_vllm_standby parameter and no
    longer claims the env var is the True value, and
  • both vision.py and llama.py guards name both the parameter and the env var,
    keeping the two in sync.

FastBaseModel.from_pretrained's vLLM-standby guard raised
"UNSLOTH_VLLM_STANDBY is True, but UNSLOTH_VLLM_STANDBY is not set to 1",
naming the environment variable in both clauses. The value that is True is
the unsloth_vllm_standby parameter, not the env var, so the message was
self-contradictory. Name the parameter in the first clause, matching the
sibling guard in FastLlamaModel.from_pretrained.

Signed-off-by: Anas Khan <[email protected]>
@anxkhn
anxkhn requested a review from danielhanchen as a code owner July 12, 2026 13:27

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

Copy link
Copy Markdown
Contributor

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 corrects a self-contradictory error message in unsloth/models/vision.py where the unsloth_vllm_standby parameter guard incorrectly referred to the environment variable twice. It also introduces a new unit test to verify this behavior. The feedback suggests removing spaces around the = sign in a keyword argument within the new test file to adhere to PEP 8 style guidelines.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

path = os.path.join(os.path.dirname(__file__), os.pardir, "unsloth", "models", module_relpath)
with open(path, encoding = "utf-8") as f:
tree = ast.parse(f.read())
for node in ast.walk(tree):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to PEP 8, spaces should not be used around the = sign when used to indicate a keyword argument. Please remove the spaces around the = operator.

Suggested change
for node in ast.walk(tree):
with open(path, encoding="utf-8") as f:
References
  1. PEP 8: Don't use spaces around the = sign when used to indicate a keyword argument or a default parameter value. (link)

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@oobabooga

Copy link
Copy Markdown
Member

Triggered the guard live rather than trust the string: called FastVisionModel.from_pretrained with unsloth_vllm_standby=True and UNSLOTH_VLLM_STANDBY unset. It now raises "unsloth_vllm_standby is True, but environment variable UNSLOTH_VLLM_STANDBY is not set to 1" instead of the old line that named the env var in both clauses and read as a self-contradiction.

Confirmed the new wording matches the already-correct sibling guard in FastLlamaModel.from_pretrained, so the two finally agree. The guard condition is untouched, so no behavior change.

The ast-based test was dropped in a later commit, which also moots gemini's PEP8 nit on it.

@shimmyshimmer fine to merge from my side, LGTM.

@danielhanchen
danielhanchen merged commit f9aa818 into unslothai:main Jul 15, 2026
47 checks passed
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.

4 participants