Repository navigation
[BUGFIX] Gate GGML LoRA exports to the main process like the GGUF paths - #19284
Open
DimitriChrysafis wants to merge 1 commit into
Open
DimitriChrysafis wants to merge 1 commit into
DimitriChrysafis wants to merge 1 commit into
Conversation
danielhanchen
added a commit
that referenced
this pull request
Nov 24, 2026
#19296) ## Problem `studio/backend/tests/test_managed_engine_readiness_poll.py` fails on main (6 of 9 tests) and on every PR based on it, for example #19284 and #19285, which do not touch Studio: ``` > child_env["WSL_UTF8"] = "1" E TypeError: 'NoneType' object does not support item assignment ``` ## Cause Two PRs merged within an hour of each other, each green on its own base: - #19167 added `vllm` to `MANAGED_ENGINE_LOG_FAMILIES`, so a vLLM start now captures logs and, on the WSL path, sets `child_env["WSL_UTF8"] = "1"` on the environment `_wsl_command` returns (the SGLang half of this came in #19166). - #19242 added this test file. Its `_wsl_command` stub returned `(command, None)`, and its base predated #19167, so vLLM did not capture logs there and the `None` was never touched. The code is right: the real `_wsl_command` always returns `wsl_host.guest_command(...)`, whose second element is the `wsl.exe` environment dict, and `test_managed_engine_logs.py` already stubs it with `dict(os.environ)`. The stub was the part that did not match the contract. ## Fix - The stub returns `dict(os.environ)`, the same shape the real launcher hands back. - The fixture sets `UNSLOTH_STUDIO_HOME` to `tmp_path`, since the vLLM start now opens a per-attempt log under the Studio home and the tests should not write into the real one. No product code changes. ## Verification - `tests/test_managed_engine_readiness_poll.py`: 9 passed (6 failed on main before the change). - Reverting only the stub's return value back to `None` brings back the same 6 failures. - `test_managed_engine_logs.py`, `test_engine_ports.py` and this file together: 50 passed; this file under `-n 4`, 3 repeats: 27 passed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[BUGFIX] Gate GGML LoRA exports to the main process like the GGUF paths
model.push_to_hub_ggml(...)andmodel.save_pretrained_ggml(...)are the LoRA GGML twins ofpush_to_hub_gguf/save_pretrained_gguf, but #18686 added the plain-DDP gating only to the GGUF pair. Under plain data parallel every rank runs_unsloth_save_lora_gguf: every rank converts the adapter and uploads the same repo (push_to_hub_ggml), or writes the samesave_directoryand races Nconvert_lora_to_gguf.pysubprocesses on one output file (save_pretrained_ggml). Neither signature acceptsis_main_process, so a caller cannot opt a non-main rank out at all.The fix mirrors #18686:
@_ddp_push_on_rank0("push_to_hub")onpush_to_hub_ggmlso rank 0 alone converts and uploads, and anis_main_process = Trueparameter +_defer_to_main_process(is_main_process, self)on both, matchingsave_pretrained_gguf. FSDP2 gather writers and FSDP1 replicas are unaffected.New tests in
tests/test_peft_export_main_process.pyfake a 2-rank group: on base the rank-1 push converts/uploads andis_main_processis rejected as an unexpected kwarg; with the fix rank 0 exports and rank 1 returnsNone.