Repository navigation
[BUGFIX] Fail fast in vLLM eval when LoRA rank exceeds 512 - #18775
danielhanchen merged 7 commits into
Conversation
vLLM's PEFTHelper applies lora_alpha / r to every module and never reads rank_pattern or alpha_pattern, so an adapter whose patterns change a module's scale is scored with the wrong weights and no error. Refuse it before the engine starts, like the rank > 512 case, and point both refusals at the HF / Unsloth backends or a merged-16bit export. [skip ci]
|
@codex review |
Codex Review Summary: ❌ FailedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a385e429a9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 851bcecb8c
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59b94f6ea6
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ex patterns for .bin adapters
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce0a85f24e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… (dot wildcard) [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
…ness (#19121) ## Problem Three Studio tests are red on `main` since #19040 (they fail on `Repo tests (CPU, studio)` for every PR based on it, for example #18775 and #19110): - `tests/studio/test_chat_autoload_failure_gate.py::test_a_chat_only_mac_without_mlx_skips_its_cached_mlx_repo` - `tests/studio/test_chat_autoload_failure_gate.py::test_a_chat_only_mac_auto_loads_an_omlx_folder_with_a_plain_name[false-False]` - `tests/studio/test_model_picker_contracts.py::test_cached_non_gguf_rows_get_the_chat_only_platform_gate` Bisected: all three pass on `956e62778b^` and fail on `956e62778b` (#19040). ## Cause #19040 is correct. It routes every Chat only MLX gate in `chat-adapter.ts` through the shared `isServedByMlx(isGguf, deviceType, chatOnlyReason, mlxInference)`, which answers from `mlx_inference` when the backend reports it. The tests were behind it: - The auto-load harness kept a hand-written `isServedByMlx` that took three arguments and ignored `mlx_inference`. A Chat only Mac reporting `mlx_inference: false` therefore looked like it served MLX, and the scenarios loaded an MLX repo where the shipped code does not. - The contract test pinned the old `platform.mlxInference === true` literal, which #19040 replaced with `return platformServesMlx(platform);`. ## Fix - The harness now inlines `NO_MLX_REASONS` and `isServedByMlx` from `per-model-config.ts` as shipped, the same way it already inlines `isOtherCacheSnapshot`, `llamaServerLoadFields` and the server-model wait gate. A missing definition fails with a clear message instead of a silent stub. - The contract test pins the new shape: the cached-row gate returns `platformServesMlx(platform)`, and that helper calls `isServedByMlx(...)` with `platform.mlxInference`. ## Verification - Both files: 305 passed (were 3 failed on `main`). - Sabotage 1: drop the `typeof mlxInference === "boolean"` branch from `isServedByMlx` in `per-model-config.ts`; the two harness scenarios fail again. - Sabotage 2: pass `null` instead of `platform.mlxInference` in `chat-adapter.ts`; the contract test and both scenarios fail. Tests only; no product code changes.
Summary
_fail()inunsloth_cli/commands/eval.pywhen evaluating a LoRA adapter with--backend vllmwhose rank (includingrank_pattern) exceeds_VLLM_LORA_RANKS[-1](512), instead of silently clampingmax_lora_rankto512and letting vLLM crash downstream.max_lora_rankselection for all supported ranks (<= 16omitted,17..512rounded up to_VLLM_LORA_RANKS).unsloth_cli/tests/test_eval.pycovering valid rounding boundaries (<= 16,24,32,257,300,512) and rejection (513,1024, andrank_pattern=640).Verification
pytest unsloth_cli/tests/test_eval.py tests/test_ci_repo_cpu_shards.py(138 passed, 4 skipped; all 3 rejection cases failed pre-fix)ruff check,py_compile, andscripts/lint_duplicate_definitions.pycleanTakeover update
No rebase; one commit added on top of the original two.
max_lora_rank=512;LoRA rank 1024 is greater than max_lora_rank 512, a value the user never set;MaxLoRARanksinvllm/config/lora.pyis[1, 8, 16, 32, 64, 128, 256, 320, 512]in every release from v0.11.2 to v0.34.0 and on main, so the hard-coded cap is correct across the supported range.max_lora_rankbefore and after.lora_alpha / rscale to every LoRA module and ignoresrank_pattern/alpha_pattern. An adapter whose patterns change a module's scale was evaluated with the wrong weights and no error:unsloth export <adapter> <output_dir> --format merged-16bitand evaluating the merged model with--backend vllm.unsloth_cli/testspasses (2737 passed).