Repository navigation
- Lazily promote PeftTrainer.grad_accumulator to persistent mode (allocate_grads=True) and clear the JIT cache on first fwd_bwd() invocation so split fwd_bwd() + update() calls under nnx.cached_partial (cache_nnx_graph=True) and dynamic sequence-packing microsteps (gradient_accumulation_steps == 1) have a pre-allocated, sharded gradient buffer across the JIT boundary, while preserving the zero-allocation fused train_step() fast path for train(). - #2729
Merged
Merged
Conversation
copybara-service
Bot
requested review from
abheesht17,
hgao327,
jiangyangmu,
lc5211,
s-noghabi,
sizhit2,
tianshub and
wang2yn84
as code owners
October 6, 2026 23:38
copybara-service
Bot
force-pushed
the
test_994701268
branch
from
October 6, 2026 23:40
106b0dc to
f925039
Compare
…allocate_grads=True`) and clear the JIT cache on first `fwd_bwd()` invocation so split `fwd_bwd()` + `update()` calls under `nnx.cached_partial` (`cache_nnx_graph=True`) and dynamic sequence-packing microsteps (`gradient_accumulation_steps == 1`) have a pre-allocated, sharded gradient buffer across the JIT boundary, while preserving the zero-allocation fused `train_step()` fast path for `train()`. - Plumb `MAX_SEQ_TOKEN_PER_TPU` in `frozenlake_dist/launcher.sh` to the trainer and orchestrator commands and skip the static `MINI_BATCH_SIZE * NUM_GENERATIONS % TRAIN_MICRO_BATCH_SIZE` divisibility check when sequence packing is enabled. - Add unit tests in `peft_trainer_v2_test.py` covering split `fwd_bwd()` + `update()` at depth 1 and dynamic multi-microstep accumulation under `cache_nnx_graph=True`. PiperOrigin-RevId: 994716064
copybara-service
Bot
force-pushed
the
test_994701268
branch
from
October 7, 2026 00:02
f925039 to
1ba318a
Compare
This branch was successfully deployed
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.
PeftTrainer.grad_accumulatorto persistent mode (allocate_grads=True) and clear the JIT cache on firstfwd_bwd()invocation so splitfwd_bwd()+update()calls undernnx.cached_partial(cache_nnx_graph=True) and dynamic sequence-packing microsteps (gradient_accumulation_steps == 1) have a pre-allocated, sharded gradient buffer across the JIT boundary, while preserving the zero-allocation fusedtrain_step()fast path fortrain().MAX_SEQ_TOKEN_PER_TPUinfrozenlake_dist/launcher.shto the trainer and orchestrator commands and skip the staticMINI_BATCH_SIZE * NUM_GENERATIONS % TRAIN_MICRO_BATCH_SIZEdivisibility check when sequence packing is enabled.peft_trainer_v2_test.pycovering splitfwd_bwd()+update()at depth 1 and dynamic multi-microstep accumulation undercache_nnx_graph=True.