Skip to content

Commit 1125fa6

Browse files
committed
add tpu zero1 ga test
1 parent dfa57f9 commit 1125fa6

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tests/integration_tests/train_tests.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,34 @@ def test_gpu_cudnn_flash_jax(self):
405405
def test_base_model_shardy_false(self):
406406
train_main(TrainTests.CONFIGS["base"] + ["shardy=False"])
407407

408+
@pytest.mark.integration_test
409+
@pytest.mark.tpu_only
410+
def test_tpu_zero1_gradient_accumulation(self):
411+
zero1_ga = [ # tests Zero-1 optimizer sharding with gradient accumulation
412+
None,
413+
os.path.join(MAXTEXT_PKG_DIR, "configs", "base.yml"),
414+
"base_output_directory=gs://runner-maxtext-logs",
415+
"run_name=runner_test",
416+
"dataset_path=gs://maxtext-dataset",
417+
"steps=10",
418+
"enable_checkpointing=False",
419+
"enable_goodput_recording=False",
420+
"dataset_type=synthetic",
421+
"remat_policy=minimal",
422+
"max_target_length=8192",
423+
"per_device_batch_size=2",
424+
"ici_data_parallelism=-1",
425+
"dcn_data_parallelism=1",
426+
"ici_fsdp_parallelism=1",
427+
"dcn_fsdp_parallelism=1",
428+
"gradient_accumulation_steps=8",
429+
"shard_optimizer_over_data=True",
430+
"shard_mode=explicit",
431+
"decoder_block=llama2",
432+
rf"tokenizer_path={os.path.join(MAXTEXT_ASSETS_ROOT, 'tokenizer.llama2')}",
433+
]
434+
train_main(zero1_ga)
435+
408436
@pytest.mark.integration_test
409437
@pytest.mark.gpu_only
410438
@pytest.mark.scheduled_only

0 commit comments

Comments
 (0)