kiji-proxy
kiji-proxy copied to clipboard
train_tpu.py: TRAINING_SEED overrides --seed, plus multi-process gaps
Found while reviewing #688. Code: model/flows/experiments/train_tpu.py, model/src/config.py and model/src/trainer.py on that branch.
1. TRAINING_SEED overrides --seed (train_tpu.py:51-53, 64-66; config.py:204)
With TRAINING_SEED=7 still exported, --seed 13 trains seed 7, and run_summary.json records 7. A seed sweep becomes silently wrong. The help text implies the flag wins.
2. Multi-process gaps (data parallelism)
- Every torchrun rank writes
output_dir/label_mappings.jsonat the same time (train_tpu.py:87). Only rank 0 should. - Unverified:
prediction_stepreturns predictions and labels on CPU (trainer.py~320-336). In multi-process runs,evaluation_looppasses them topad_across_processes/gather_for_metrics. Run one eval step undertorchrun --nproc_per_node>1before calling data parallelism supported.
3. Smaller items
[data] subsample_countin the TOML is ignored; only--num-samplescounts.run_german_mix.sh:16-18and thetrain_tpu.pydocstring are hardcoded to v4 and say "on the GPU machine".lr_scheduler_kwargs={"num_cycles": …}is passed to every scheduler type (trainer.py:626), socosineruns 3 waves andlinearraisesTypeError. This predates #688 and is fixed onfeat/lr-schedule-cosine, which isn't in a PR yet.
4. Test gaps
- The static-padding collator's alignment of
input_ids,attention_maskandpii_labels=-100is untested; onlybucketed_lengthis. test_trainer_accumulation.pyonly checks theforwardsignature.test_tpu_data_parallel.pyleaksACCELERATE_BYPASS_DEVICE_MAP=trueinto the rest of the session.monkeypatch.delenv(raising=False)on an unset variable records no undo.