Repository navigation
fix(studio): load the MLX training dataset before the model - #16618
Merged
Merged
Conversation
A dataset error on Apple Silicon (missing S3 manifest, ambiguous audio reference, missing local files) only surfaced after the full model download and load. Fetch the train and local eval datasets right after the model security check, matching the CUDA path's dataset-then-model order. Row bounding and formatting stay after the load since they need is_vlm and the tokenizer.
Collaborator
Author
|
@codex review |
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: Didn't find any major issues. 🚀 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". |
Collaborator
Author
|
Review and CI summary for
|
danielhanchen
added a commit
that referenced
this pull request
Nov 4, 2026
…shards (#16634) ## Summary `Repo tests (CPU, gloo-tp-pp)` is at its 2100 s cap. On #16618, which only touches the Studio MLX worker, it was interrupted with the suite almost done: ``` !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 174 passed, 7 skipped, 79 warnings, 320 subtests passed in 2088.59s (0:34:48) ##[error]Process completed with exit code 124. ``` The other recent runs of that job, across the last 20 PRs, took 30.5 to 36.2 minutes end to end, setup included, so a slightly slower runner is enough to tip it over. When this shard was created (#15951 split, #16447 comment) tensor plus pipeline parallel were about 1397 s. Pipeline parallel has grown a lot since then: every `torch.distributed.pipelining` schedule (#15655), per-stage sharded loading (#15656), no graph break on a non-last stage (#16167), and explicit-unscale overflow agreement (#16417). Nothing is wrong with those tests. The shard just outgrew its slot, the same way `gloo` did in #15951 and #16447. ## Change - `.github/workflows/studio-backend-ci.yml`: `gloo-tp-pp` becomes two shards with the same settings (`-n 4`, the 2100 s cap, the marker filter): - `gloo-tp`: `tests/test_tp_n*gloo*.py` (2 files); - `gloo-pp`: `tests/test_pp*gloo*.py` (8 files). - `tests/studio/test_backend_ci_parallel_isolation.py`: `test_the_command_scan_sees_the_parallel_run_and_the_serial_steps` pins the number of parallel pytest runs. It asks to be told when a shard is added, so its counts go from 12 to 13 parallel runs and from 9 to 10 repo-root shards. The selections are the old one split in two, so every file still runs exactly once. ## Testing - `tests/test_ci_repo_cpu_shards.py`: 15 passed. With `test_pp*gloo*` narrowed to `test_pp_[!n]*gloo*` as a sabotage, `test_no_file_is_dropped_or_run_twice` fails, so a dropped file is still caught. - `tests/studio/test_backend_ci_parallel_isolation.py`, `tests/test_ci_repo_cpu_shards.py` and the workflow and cache-budget guards under `tests/studio`: 164 passed. - The two new shards' run times on this PR's own CI are the real check. Both should finish well under the cap.
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.
Problem
On Apple Silicon,
_run_mlx_trainingdownloads and loads the model withFastMLXModel.from_pretrainedbefore it touches the dataset. Any dataset error therefore only shows up after the full model download and load: a missing S3 manifest, an ambiguous audio reference, missing local files, or no dataset configured. With a large model that can take minutes, only to fail on something the dataset step could have reported immediately. The CUDA path (run_training_process) already loads the dataset before the model.Change
_load_hf_train_and_eval_datasets, local files, the S3 download, andlocal_eval_datasets) now runs right after the model security check, beforefrom_pretrained. None of it reads the model or tokenizer._slice) and formatting stay after the model load: themax_stepsrow bound depends on whether the loaded model is a vision model, and formatting needs the tokenizer._sliceis now applied once after the fetch instead of in each loader branch.from_pretrained.Errors raised while formatting rows still appear after the model load, since formatting needs the tokenizer. The CUDA path behaves the same way.
Validation
Two new tests in
tests/test_mlx_dataset_format_failure.pycall the real_run_mlx_trainingwith MLX andunsloth_zoo.mlxreplaced by stand-ins, so they also run off Apple Silicon:test_mlx_dataset_error_surfaces_before_the_model_loads: an S3 download error is raised andfrom_pretrainedis never called.test_mlx_stop_during_dataset_load_skips_the_model_load: a stop set during the HF dataset load ends the run with "Training cancelled" and skips the model load.Each test fails when the change it covers is reverted.