[NNX] Remove remaining Linen module code and dead references - #5203
Draft
ecnal-cienet wants to merge 1 commit into
Draft
[NNX] Remove remaining Linen module code and dead references#5203ecnal-cienet wants to merge 1 commit into
ecnal-cienet wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request transitions several modules and functions from Flax Linen to Flax NNX, updating docstrings, type annotations, and imports accordingly, and removes deprecated decoder and pipeline implementations. The review feedback points out a few incorrect return type annotations in pipeline.py and model_creation_utils.py where Linen-wrapped modules are returned, suggesting they should remain annotated as nn.Module or nn.Module | models.Transformer instead of nnx.Module or models.Transformer.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
ecnal-cienet
force-pushed
the
feat/nnx-linen-cleanup
branch
from
September 11, 2026 15:23
880201f to
216641e
Compare
ecnal-cienet
force-pushed
the
feat/nnx-linen-cleanup
branch
5 times, most recently
from
September 11, 2026 18:50
b0728c0 to
3dd6786
Compare
Continues the Delete-Linen effort. No behavior change; validated by the unit suite on TPU (cpu platform) -- 3505 tests collect clean, affected suites pass. Module / dead-code removal: - Delete the unused pipeline_deprecated.py (a Linen Pipeline) and decoders.py (a 46-line vestige whose only symbol duplicated nnx_decoders.deepstack_process; repoint the one test). - Drop a stray @nn.compact left on MixtralDecoderLayer.__init__ (an nnx.Module). - Delete grep-confirmed zero-caller Linen functions: create_nnx_sharded_model_hybrid, get_logical_annotations, the Linen get_prefill_kv_cache_annotations / get_kv_cache_annotations, vocab_tiling_linen_loss, create_flax_pipeline_scan / create_pipeline_stage / execute_pipeline_stage_flax, remove_logically_partition, kv_cache_as_linen / mla_kv_cache_as_linen, gpt3_layer_norm, and the Linen grpo_loss_fn (train/eval step already dispatch only to the _nnx variants). Shared-primitive imports moved off flax.linen (same underlying objects): - nn_partitioning.axis_rules / nn.logical_axis_rules -> flax.core.spmd.logical_axis_rules across the trainers, inference, and utils that used it, dropping their flax.linen import. - nn.initializers.* -> jax.nn.initializers.* ; nn.one_hot -> jax.nn.one_hot ; getattr(nn, activation) -> getattr(jax.nn, activation). The remaining flax.linen usage (quantization einsum bridge, with_logical_constraint / LogicallyPartitioned sharding primitives, ToLinen transformer bridge) is tracked for follow-up PRs.
ecnal-cienet
force-pushed
the
feat/nnx-linen-cleanup
branch
from
September 11, 2026 20:01
3dd6786 to
38086a2
Compare
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.
Deletes the last first-party Flax Linen modules and their dead references, following the Delete-Linen stack:
The remaining flax.linen usage (quantization einsum bridge, logical-sharding primitives) is load-bearing and tracked for a follow-up.
Description
Start with a short description of what the PR does and how this is a change from
the past.
The rest of the description includes relevant details and context, examples:
If the change fixes a bug or a Github issue, please include a link, e.g.,:
FIXES: b/123456
FIXES: #123456
You can also provide a comma-separated list. If you don't want to close a bug but
simply to reference it, use BUGS, e.g.:
BUGS: b/123456
Notice 1: Once all tests pass, the "pull ready" label will automatically be assigned.
This label is used for administrative purposes. Please do not add it manually.
Notice 2: For external contributions, our settings currently require an approval from a MaxText maintainer to trigger CI tests.
Tests
Please describe how you tested this change, and include any instructions and/or
commands to reproduce.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.