Yidhar Claude Sonnet 4.6 commited on
Commit
8a9175a
·
1 Parent(s): 9524695

Hard-pin transformers==4.57.1 (was >=5.6,<5.8)

Browse files

The earlier 5.6/5.7/5.8 fixes were chasing the wrong target. The real
break happens **across the 4.x → 5.x boundary**: transformers 5.x
moved `config.rope_theta` into a `rope_parameters` dict and never
populates the top-level attribute, even when supplied via kwargs. The
upstream `modeling_qwen3.py` we vendor (commit df86ca9) reads
`config.rope_theta` directly, so on any 5.x the rotary frequencies
silently default — base attention still runs, but with wrong positions,
the gen tower output collapses, and 50-step sampling produces a flat
mid-grey image with patch-grid texture (everything else — model load,
LoRA wrap, ckpt inject, even `think_mode` text generation — succeeds
without warning).

This was masked because the venv was originally on 4.57.1 (May 1 - May 6)
where v16c sampling worked. The publish-cleanup commit relaxed
`transformers>=5.6` and a subsequent `pip install -e .` (May 7) silently
upgraded the local venv to 5.8.0, which is when sampling broke.

Hard-pin all three requirements specs to the exact 4.57.1 we know works.
The earlier 5.x compatibility shims (rope_theta auto-promotion,
all_tied_weights_keys, compute_default_rope_parameters method) stay in
the snapshot files as no-ops on 4.57.1; they only kick in if a future
user is on 5.x. Same for the loader.py self-heal for transformers'
indirect-import dynamic-cache miss.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (3) hide show
  1. pyproject.toml +7 -4
  2. requirements.txt +4 -5
  3. train_u1/requirements.txt +1 -1
pyproject.toml CHANGED
@@ -32,10 +32,13 @@ classifiers = [
32
  ]
33
  dependencies = [
34
  "torch>=2.9",
35
- # Upper bound: transformers 5.8 broke the upstream `modeling_qwen3.py`
36
- # we pin (rope_theta moved into rope_parameters dict, all_tied_weights_keys
37
- # appeared, RotaryEmbedding now needs `compute_default_rope_parameters`).
38
- "transformers>=5.6,<5.8",
 
 
 
39
  "safetensors>=0.7",
40
  "huggingface_hub>=0.26",
41
  "sentencepiece",
 
32
  ]
33
  dependencies = [
34
  "torch>=2.9",
35
+ # Hard-pin: the upstream `modeling_qwen3.py` we vendor (commit df86ca9)
36
+ # was written against transformers 4.57.1 and reads `config.rope_theta`
37
+ # directly. transformers 5.x moved that into a `rope_parameters` dict,
38
+ # which silently breaks attention frequencies and produces noise images
39
+ # at sample time even when the LoRA + base load cleanly. Stay on 4.57.1
40
+ # until we either re-train or rewrite the modeling files.
41
+ "transformers==4.57.1",
42
  "safetensors>=0.7",
43
  "huggingface_hub>=0.26",
44
  "sentencepiece",
requirements.txt CHANGED
@@ -3,11 +3,10 @@
3
 
4
  # core
5
  torch>=2.9
6
- # Upper bound: transformers 5.8 reshuffled rope params API + tied_weights
7
- # ABI in incompatible ways with the upstream `modeling_qwen3.py` we pin.
8
- # See loader.py for the indirect-import self-heal that survives upstream
9
- # transformers churn beyond what version-pinning catches.
10
- transformers>=5.6,<5.8
11
  safetensors>=0.7
12
 
13
  # HF model load (NEOChatModel uses trust_remote_code)
 
3
 
4
  # core
5
  torch>=2.9
6
+ # Hard-pin: the upstream modeling_qwen3.py (commit df86ca9) reads
7
+ # `config.rope_theta` directly; transformers 5.x moved that into a
8
+ # `rope_parameters` dict, silently breaking attention freqs at sample time.
9
+ transformers==4.57.1
 
10
  safetensors>=0.7
11
 
12
  # HF model load (NEOChatModel uses trust_remote_code)
train_u1/requirements.txt CHANGED
@@ -4,7 +4,7 @@
4
 
5
  # core
6
  torch>=2.9
7
- transformers>=5.6,<5.8 # 5.8 broke the pinned upstream modeling_qwen3.py
8
  safetensors>=0.7
9
 
10
  # HF model load (NEOChatModel uses trust_remote_code)
 
4
 
5
  # core
6
  torch>=2.9
7
+ transformers==4.57.1 # upstream modeling_qwen3.py reads config.rope_theta directly; 5.x dict-form silently breaks attention
8
  safetensors>=0.7
9
 
10
  # HF model load (NEOChatModel uses trust_remote_code)