Repository navigation
Tests: follow TRL's renamed tiny Phi-3 and Qwen3.5 repos - #15355
Merged
Merged
Conversation
Member
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. Nice work! 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". |
This was referenced Oct 26, 2026
Merged
danielhanchen
added a commit
to unslothai/unsloth-zoo
that referenced
this pull request
Oct 26, 2026
…2108) ## Problem `trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration` is gone from the Hub. The model API returns 404, even with a token. TRL now publishes versioned names: `-3.8`, `-NoThink` and `-Think`. `tests/test_speculative_capture.py` loads it as `QWEN35_VLM`, and its loader turns any load error into `pytest.skip("... unavailable offline")`. So in CI the Qwen3.5 VLM cases have been skipping silently instead of running. ## Fix Use `tiny-Qwen3_5ForConditionalGeneration-NoThink`. Its config differs from the old repo's only in `text_config.full_attention_interval` (4 to 2), and its `chat_template.jinja` is byte-identical. I compared it against the old repo's config, which was still in a local Hub cache. The same rename is in unslothai/unsloth#15355. No other `trl-internal-testing/*` id referenced in this repo is missing from the org's current model list. ## Verification `tests/test_speculative_capture.py`: 6 passed and 1 skipped. The VLM cases now load the model and run. The one skip is the locally built Qwen3.5 text fixture, which is unrelated to this change.
danielhanchen
added a commit
that referenced
this pull request
Oct 26, 2026
…ative Trainer runs back on the default (#15397) ## Problem #15381 set `adam_epsilon = 1e-4` in the shared `_trainer_args` of `tests/test_tp_native_gloo.py`. That fixed the three UNSLOTH_TP_SIZE Trainer tests in `test_tp_env_gloo.py`, but on the CI runners it broke the two native Trainer tests that use the same helper. Comparing the `gloo` shard before and after (both on current-main bases): | CI run | native `test_trainer_trains_a_tensor_parallel_model_like_one_process[1-2]` / `[2-2]` | `test_env_tp2_*` (3 tests) | |---|---|---| | #15284, base 975e864 (before #15381) | pass | fail | | #15386, base 0be4c5d (after #15381) | fail on `lora_A` state (`rtol = 1e-4, atol = 1e-6`) | pass | On this host both groups pass at both settings. The runners' CPUs round differently from this machine, and I could not emulate theirs here: `ATEN_CPU_CAPABILITY=avx2` aborts the spawned ranks with `buffer overflow detected`. So the CI table above is the evidence for which eps each group needs. The two groups differ in their adapters. The env tests use `init_lora_weights = False`, where every factor gets a real gradient from step 1; that is where the default eps amplifies reduction-order noise, as measured in #15381. The native tests use the default `B = 0` start, where `lora_A`'s gradients are tiny for the first steps. There, eps 1e-4 sits inside their range and moves `lora_A` differently on the two arms. ## Fix - `_trainer_args` goes back to AdamW's default eps, so the native Trainer tests run as they did when they passed on CI. - `test_tp_env_gloo.py` passes `adam_epsilon = 1e-4` only at its own training call, with the measurement and the reason in a comment. Tolerances are unchanged. ## Verification - `tests/test_tp_env_gloo.py` and `tests/test_tp_native_gloo.py`: 52 passed on this host. - This PR's own `Repo tests (CPU, gloo)` shard is the check on runner hardware. Both groups should pass there. ## Not covered here `test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None]` also fails in both CI runs above, by 6.9e-5 to 7.7e-5 relative on grad norms (tolerance 1e-5), and passes on this host. It only became visible after #15355: before that, the `phi3` cases errored on the removed tiny model. It uses its own hand-written loop (eps 1e-6), not `_trainer_args`, so this change does not touch it.
danielhanchen
added a commit
that referenced
this pull request
Oct 26, 2026
… shards (#15400) ## Problem `tests/test_tp_native_gloo.py::test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None]` fails in `Repo tests (CPU, gloo)` on every recent run, on the per-step grad norms (tolerance 1e-5): | CI run | step 1 | step 2 | step 3 | |---|---|---|---| | #15284 (job 121590971980) | 1.5e-6 | 3.6e-5 | 7.7e-5 | | #15386 (job 121637289351) | 1.5e-6 | 3.6e-5 | 6.9e-5 | It only became visible after #15355. Before that, every `phi3` case errored on the removed `trl-internal-testing/tiny-Phi3ForCausalLM`. On this host the same test passes inside 1e-5. ## Product or test The test. In the same run, the loss check (rel 1e-5) and the step-1 per-gradient check (`rtol = 1e-4, atol = 1e-6` on every LoRA gradient) both pass. Only the multi-step norms drift, and the gap grows each step from a 1.5e-6 start. That is reduction-order noise compounded by AdamW, which phi3's fused qkv and gate_up shards make larger than llama's. The runners' CPUs round differently from this host. A real tensor-parallel error does not hide behind the norms. With the backward all-reduce of the column-parallel input removed in `tp_native.py` (`return grad, None`), the phi3 case fails on the step-1 per-gradient check, before the norms are compared. ## Fix `_TP_FSDP2_NORM_REL = {"phi3": 2e-4}` sets the norm tolerance for phi3 only, with the CI measurements in a comment. Every other arch keeps 1e-5. The loss, per-gradient, mismatch and placement checks are unchanged for all arches. ## Verification - `test_tp2_x_fsdp2_dp2_matches_one_process`: all 5 parametrizations pass. - Sabotage: with the all-reduce removed, the phi3 case still fails. - ruff format and check are clean.
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
trl-internal-testing/tiny-Phi3ForCausalLMandtrl-internal-testing/tiny-Qwen3_5ForConditionalGenerationno longer exist on the Hub. The model API returns 404 for both, even with a token. TRL now publishes versioned names instead:tiny-Phi3ForCausalLM-3and-3.5tiny-Qwen3_5ForConditionalGeneration-3.8,-NoThinkand-ThinkEvery test that loads one of the old ids fails with
OSError: ... is not a valid model identifier. This is red on every PR based on current main, in bothRepo tests (CPU, rest)andRepo tests (CPU, gloo)(#15337, #15342):phi3cases oftest_tp_native_oracle.pyandtest_tp_native_gloo.pytest_decision_model.pyandtest_decision_from_lm.pyNothing in the repo changed; the upstream repos were renamed.
Fix
Point the seven references at the closest renamed repo. I picked each one by diffing its config against the old repo's config, which was still in a local Hub cache:
tiny-Phi3ForCausalLMtiny-Phi3ForCausalLM-3vocab_size32011 to 32064,sliding_windowNone to 2047,attention_biasNone to Falsetiny-Qwen3_5ForConditionalGenerationtiny-Qwen3_5ForConditionalGeneration-NoThinktext_config.full_attention_interval4 to 2; byte-identicalchat_template.jinjaI rejected the other candidates:
tiny-Phi3ForCausalLM-3.5addslongropescaling and a 131k context.tiny-Qwen3_5ForConditionalGeneration-3.8changes the MLP size, the value heads and the embedding tying, and ships a different chat template.tiny-Qwen3_5ForConditionalGeneration-NoThinkwas already used by one test.No other
trl-internal-testing/*id referenced undertests/,studio/,unsloth/,scripts/or.github/is missing from the org's current model list.Verification
Every test id that failed in CI on #15337 and #15342 for this reason now passes against the downloaded new repos:
test_tp_native_oracle.py:phi3plan, simulated TP, fused-qkv GQA layout and per-module local headstest_tp_native_gloo.py:test_tp2_matches_one_process[phi3],test_sharded_loading_matches_full_load[phi3-2-None],test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None]andtest_tp2_phi3_fused_qkv_under_a_packed_plan_matches_one_processtest_decision_model.py: the clef encoding, collator and temperature-folding casestest_decision_from_lm.py: the train, save and reload case, andtest_the_decision_notebook_runs_unchanged_on_a_plain_qwen3_5That is 45 + 1 passed. The wider selection over the seven touched files passes as well: 187 passed, 12 skipped.