Repository navigation
Keep import unsloth working when vLLM needs transformers 5 - #12268
Conversation
vLLM >= 0.24 raises ImportError at import under transformers < 5. The startup GuidedDecodingParams fix imports vllm.sampling_params, so with transformers 4.57.x and a recent vLLM installed, import unsloth itself failed, even for SFT or GRPO without fast_inference. disable_broken_vllm now also recognises that refusal and disables vLLM with a warning, as it does for an ABI-broken build. fast_inference = True then reports why vLLM is unavailable instead of asking to install it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The two "Core zoo" failures ( |
Problem
vLLM 0.24 and later raise at import when transformers is older than 5.0 (
vllm/transformers_utils/config.py):At import, Unsloth's GuidedDecodingParams fix imports
vllm.sampling_params.disable_broken_vllmonly recognised ABI-broken builds, so this error escaped. With transformers 4.57.x (inside the supported range) and any recent vLLM installed,import unslothfailed outright, even for SFT, DPO or GRPO withoutfast_inference.Fix
disable_broken_vllmnow also recognises this refusal, including through a chained exception. It disables vLLM the same way it does for a broken build and logs one warning: vLLM needs transformers >= 5,fast_inferenceis unavailable, and everything else still works.import_fixes.VLLM_DISABLED_REASON. Withfast_inference = True, both loader call sites now report that reason instead of "Please install vLLM", which was wrong when vLLM is installed but disabled. The broken-build case gets the same improvement.Evidence
B200, vLLM 0.30.0. A tiny Qwen3 GRPO run, 2 steps:
import unslothraises ImportErrorimport unslothraises ImportErrorfast_inference=Trueimport unslothraises ImportErrorfast_inference=Truefast_inference=TrueUnsloth main plus transformers 5.17 and vLLM 0.30 were also checked across TRL 0.22.2, 0.24.0, 0.25.1, 0.29.1, 1.13.0 and 1.14.0, each with HF and with vLLM generation. All 12 runs train.
Tests:
tests/test_vllm_broken_detection.pygains a direct and a chained case, plus a negative case for an unrelated ImportError. The two new positive cases fail with the detection reverted. The file passes 9/9.