Repository navigation
Studio: report first-step training and gradient accumulation - #15480
Conversation
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. |
…#15493) ## Problem `Repo tests (CPU, rest)` fails on main since #15368, so every PR based on it inherits 8 failures (#15474, #15475, #15479, #15480, #15481 and others): ``` tests/test_for_training_generation_flag.py::test_for_training_deletes_a_generation_flag_delegated_by_a_peft_wrapper[llama.py-FastLlamaModel] unsloth/models/llama.py:5526: in for_training _tensor_parallel_for_training(model) E TypeError: 'NoneType' object is not callable ``` All 8 parametrizations fail the same way, for `llama.py` and `vision.py`. ## Product or test The test. It lifts `for_training` out of `llama.py` / `vision.py` with `ast` and runs it in a namespace where any name it did not lift resolves to `None`. From `_utils.py` it lifted a hardcoded list of ten helpers. #15368 made `for_training` call a new `_utils` helper, `_tensor_parallel_for_training`, which is not on that list, so the lifted code called `None`. `for_training` itself is fine: the helper only restores the sharded parameters on a tensor-parallel model and does nothing otherwise. ## Fix The hardcoded list stays as roots. On top of it, the test now lifts every `_utils.py` function that `for_training` or those helpers reach by name, transitively, with the same walk it already used for helpers in the model file (factored into `_closure`). A helper added later is lifted the same way instead of turning into `None`. ## Verification - `tests/test_for_training_generation_flag.py`: 8 passed (8 failed on main). - Sabotage: - With `del m._flag_for_generation` replaced by `pass` in `llama.py` (the behaviour this test guards), 2 fail, so the guard still bites. - With `_tensor_parallel_for_training` made to raise, 6 fail. The lifted helper is the real one and actually runs, not a stand-in. - ruff format and check are clean.
|
@codex review |
3 similar comments
|
@codex review |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08a4f32ef5
ℹ️ 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".
| {!trainingLoopStarted && ( | ||
| <> | ||
| <TypingAnimation duration={44}> |
There was a problem hiding this comment.
Keep animated intro lines as direct Terminal children
On the initial overlay mount for a new job (instant=false), this fragment stalls the terminal animation before the status and download rows appear. Terminal in components/ui/terminal.tsx enumerates only direct children and injects __onDone into each to advance activeIndex; React treats the fragment as one child, and it never invokes that callback. Consequently, the subsequent status and resource rows remain at opacity-0 throughout model/dataset preparation, until loop entry removes the fragment. Render the two conditional TypingAnimation elements as separate direct children, or explicitly make Terminal handle fragments.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 618205c: the two intro lines are now separate direct children, since Children.toArray does not traverse a Fragment and the cloned Fragment never calls __onDone. The stall lasted until the next re-render flipped instant on, so it delayed the rows rather than hiding them for the whole preparation.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
A new training run switches to Training in progress when the trainer loop begins, before it has run an optimizer step or produced a loss. The startup overlay then appends waiting for first step (0) and keeps showing repository byte counters, making an active first step look like a stalled download.
Report milestones from the real trainer callbacks:
The shared helper covers SFT/vision/audio callbacks and the decision/embedding callback. It handles resumed steps relative to this session, short final accumulation groups, pre-train evaluation/log callbacks, and zero loss. It never labels unknown work as compilation and respects stop requests.
The overlay displays the actual status without the generic
(0)suffix. Once a real trainer callback confirms loop entry, it stops polling and displaying the repository download rows; a cache scanner's different file subset can no longer imply another download while batches execute. Resource loading/preparation and its progress bars remain visible before loop entry.Validation:
git diff --checkpassed.No training was started for validation. The UI reports callback milestones, not an estimated percentage for unknown compilation time.
Before / after
Train > Current Run start overlay halfway through the first optimizer step (gradient accumulation 4, step 0, model cache scan short of the expected bytes). Each side renders its own frontend build with the status its own backend emits at that moment: base reports
Training in progress...from train begin, this PR reports the batch milestone (sequence captured from a real Unsloth SFT run on a T4).Before: the overlay keeps the preparation lines, appends
waiting for first step... (0)and keeps polling and drawing the Model weights download row. After: only the real milestone, no download row (0 download-progress polls once the loop has started).