Conversation
…mesh handling - Default TRAIN_MICRO_BATCH_SIZE to 1 in frozenlake_dist/launcher.sh to support lean batch and generation configurations without failing division validation. - Export ALLOW_MULTIPLE_LIBTPU_LOAD=1 in frozenlake_dist/launcher.sh to prevent concurrent libtpu initialization crashes when trainer and rollout run on the same host. - Dynamically derive TPU_CHIPS_PER_HOST_BOUNDS based on TRAINER_TPU_CHIPS count when unset (e.g. 1,2,1 for 2 chips). - Auto-adjust mesh_tp in run_trainer_node and run_rollout_node when mesh_fsdp=1 and jax.device_count() is a multiple of mesh_tp (supporting dual-core TPU chips such as TPU 7x when TP is specified in physical chips). - Use uv pip install for grpcio-tools in install_raiden.sh when uv is available to prevent setuptools downgrade/upgrade conflicts. - Update .gitignore for .venv, logs, artifacts, checkpoints, and generated protobuf files.
andytwigg
requested review from
abheesht17,
hgao327,
jiangyangmu,
lc5211,
s-noghabi,
sizhit2,
tianshub and
wang2yn84
as code owners
September 18, 2026 00:09
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.
Summary of Changes
This PR resolves several issues when running distributed FrozenLake (
frozenlake_dist) on TPUs, specifically supporting multi-core-per-chip hardware architectures (such as TPU 7x) as well as small batch/smoke test configurations:Micro-batch size default in
frozenlake_dist/launcher.sh:TRAIN_MICRO_BATCH_SIZEto1(aligning withmath_gsm8k_dist/launcher.shand CI smoke recipes). This prevents validation failure (MINI_BATCH_SIZE * NUM_GENERATIONS must be divisible by TRAIN_MICRO_BATCH_SIZE) for lean test runs likeBATCH_SIZE=1 MINI_BATCH_SIZE=1 NUM_GENERATIONS=2.Libtpu co-location support:
ALLOW_MULTIPLE_LIBTPU_LOAD=1inlauncher.shso co-located trainer and rollout processes on the same host can initialize libtpu without collision.Dynamic
TPU_CHIPS_PER_HOST_BOUNDSderivation:TRAINER_TPU_CHIPScount when unset (e.g.1,2,1for 2 chips instead of hardcoding1,4,1).Multi-core TPU chip mesh compatibility:
run_trainer_node.pyandrun_rollout_node.py, auto-adjustmesh_tpandtensor_parallel_sizewhenmesh_fsdp == 1andjax.device_count()is a multiple ofargs.mesh_tp(e.g. on TPU architectures with 2 cores per chip where TP is specified in physical chips).Tooling & Dependency isolation in
scripts/install_raiden.sh:uv pip install grpcio-toolsifuvis available during protobuf compilation to avoid unintended dependency resolution and setuptools version conflicts withvllm.Repository hygiene (
.gitignore):.venv/,myenv/, logs (*.log), artifacts, checkpoints, and generated protobuf stubs (*_pb2.py,*_pb2_grpc.py).Verification
Qwen3-1.7Bon TPU:pytest tests/experimental/examples/frozenlake_dist/ tests/experimental/examples/common/run_trainer_node_test.py(58 passed).