Commit 5ca18e9
committed
[NNX] NNX migration (12/N): delete Linen code paths, classes, and compatibility flags
NNX is now the only model path (PR11 flipped pure_nnx/enable_nnx/pure_nnx_decoder
to True), so these flags are no longer dispatch points. Delete the Linen code:
- Collapse all flag and isinstance(model, nn.Module) dispatch to the NNX branch
across ~22 src files (train.py, maxtext_utils, train_utils, sharding, diloco,
maxengine, layerwise_quantization, grpo_trainer, lora_utils, checkpointing,
convert_gpt3_ckpt_from_paxml, ...). Zero executable flag reads remain in src.
- Delete TransformerLinenPure; the Linen decoder stack Decoder / DecoderLayer /
SequentialBlockDecoderLayers (decoders.py 1525->47, only deepstack_process kept);
and 28 dead *_as_linen ToLinen wrappers. The wrapped NNX classes are unchanged.
- Remove the pure_nnx / enable_nnx / pure_nnx_decoder flags from configs/types.py,
base.yml, inference/vllm.yml, and pyconfig.
- Delete 21 obsolete Linen-only tests; drop redundant flag args elsewhere.
Kept for focused follow-ups: the transformer_as_linen / init_initial_state
NNX->Linen bridge (checkpoint-conversion tools), the Linen GRPO reference
grpo_loss_fn (torch-gated correctness tests), and the Linen pipeline.py (NNX
pipeline parallelism pending PR11.5; test_pipeline_subset skipped).
Verified on CPU: NNX unit suite 213 passed / 28 skipped (3 non-regression fails),
5 train_compile AOT cases, nnx_decoders_test 40 passed, lint 10/10, base.yml
config-load smoke. Net -5,346 lines across 59 files.1 parent 5923cb2 commit 5ca18e9
59 files changed
Lines changed: 713 additions & 6014 deletions
File tree
- src/maxtext
- checkpoint_conversion/standalone_scripts
- common
- configs
- inference
- experimental/rl
- inference
- maxengine
- layers
- models
- trainers
- diloco
- post_train/sft
- pre_train
- utils
- tests
- assets/logits_generation
- integration
- post_training
- integration
- unit
- unit
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
51 | | - | |
52 | 49 | | |
53 | | - | |
54 | | - | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
| |||
92 | 87 | | |
93 | 88 | | |
94 | 89 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
100 | 94 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
112 | 99 | | |
113 | 100 | | |
114 | 101 | | |
| |||
201 | 188 | | |
202 | 189 | | |
203 | 190 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
219 | 200 | | |
220 | 201 | | |
221 | 202 | | |
| |||
228 | 209 | | |
229 | 210 | | |
230 | 211 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
251 | 221 | | |
252 | 222 | | |
253 | 223 | | |
| |||
299 | 269 | | |
300 | 270 | | |
301 | 271 | | |
302 | | - | |
| 272 | + | |
303 | 273 | | |
304 | 274 | | |
305 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
949 | 949 | | |
950 | 950 | | |
951 | 951 | | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
| 952 | + | |
957 | 953 | | |
958 | 954 | | |
959 | 955 | | |
960 | 956 | | |
961 | 957 | | |
962 | | - | |
963 | | - | |
964 | | - | |
| 958 | + | |
| 959 | + | |
965 | 960 | | |
966 | 961 | | |
967 | 962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1168 | 1168 | | |
1169 | 1169 | | |
1170 | 1170 | | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
1176 | 1171 | | |
1177 | 1172 | | |
1178 | 1173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
| 196 | + | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
238 | 237 | | |
239 | 238 | | |
240 | 239 | | |
241 | | - | |
242 | | - | |
243 | | - | |
| 240 | + | |
244 | 241 | | |
245 | 242 | | |
246 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
899 | 898 | | |
900 | 899 | | |
901 | | - | |
902 | | - | |
903 | 900 | | |
904 | 901 | | |
905 | 902 | | |
| |||
2498 | 2495 | | |
2499 | 2496 | | |
2500 | 2497 | | |
2501 | | - | |
2502 | | - | |
2503 | 2498 | | |
2504 | 2499 | | |
2505 | 2500 | | |
| |||
0 commit comments