Repository navigation
feat(goodput): add goodput_job_name config and instrument RL & Distillation trainers - #5563
KevinYenky wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates goodput measurement and recording into both distillation and reinforcement learning (RL) post-training pipelines, adding configuration options, lifecycle hooks, and corresponding unit tests. The review feedback suggests improving robustness and code cleanliness by using the defensive 'record_goodput' helper to avoid potential AttributeError exceptions, and passing 'goodput_recorder' as an explicit keyword argument to 'BaseTrainingHooks' rather than relying on fragile positional argument shifting and type-checking in the constructor.
43f2cb8 to
6e086bd
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
1ffc8a9 to
ca84956
Compare
ca84956 to
bfeeba0
Compare
cc97b0c to
132a000
Compare
| # uploaded to tensorboard. | ||
| enable_tunix_perf_metrics: false | ||
| enable_goodput_recording: false | ||
| goodput_job_name: "" |
There was a problem hiding this comment.
This is not blocking but I just realized that checkpoint logs are turned off in the pre-train DAGs.
We can enable them in follow up PR, by doing two things:
- setup_checkpoint_logger() in checkpointing.py should construct
job_name = get_goodput_job_name(config)andlogger_name = f"goodput_{job_name}", so that this works for prod as well as these DAGs. - M_ENABLE_CHECKPOINT_CLOUD_LOGGER=true in maxtext_e2e_tpu_pre_training.py
Don't block this PR, it is completely safe to have Checkpoint badput = 0 until we enable it in a follow up.
There was a problem hiding this comment.
BTW, small nit but feel free to add a comment here saying "optional/test only" so users know they do not need to set it for production runs.
dipannita08
left a comment
There was a problem hiding this comment.
Left a small change required as a follow up PR, otherwise LGTM. Thank you!
523cc67 to
bc5e83a
Compare
…lation trainers Signed-off-by: KevinYenky <kevin.yen@cienet.com>
bc5e83a to
8bafc6b
Compare
Description
This PR extends MaxText's Goodput measurement and monitoring integration on post-training workflows so that end-to-end Airflow/Cloud Composer DAGs can uniquely track and validate Goodput per workload:
goodput_job_name:goodput_job_name(default"") topost_train/rl.yml.enable_goodput_recording,goodput_job_name,monitor_goodput, andenable_pathways_goodputdefaults tosrc/maxtext/configs/post_train/rl.yml(which does not inheritbase.yml) soM_*environment variable overrides inpyconfigare applied to RL workloads.train_rl.py,rl/hooks.py,rl/utils_rl.py):rl_traininsrc/maxtext/trainers/post_train/rl/train_rl.pywithcreate_goodput_recorder,maybe_monitor_goodput,RECORD_JOB_START_TIME,GoodputEvent.TPU_INIT,GoodputEvent.TRAINING_PREPARATION, andRECORD_JOB_END_TIME(recorded in afinallyblock).RLTrainingHooks(src/maxtext/trainers/post_train/rl/hooks.py) andinstall_training_hooks(src/maxtext/trainers/post_train/rl/utils_rl.py) to acceptgoodput_recorder, recordrecord_step_start_time(train_ctx.train_steps)onon_train_step_start, and safely guardon_train_step_endwheneval_interval <= 0ornum_test_batches <= 0so hooks can be installed for Goodput-only runs without intermediate evaluation.BaseTrainingHooksInstrumentation (train_distill.py,post_train/hooks.py):train_distillinsrc/maxtext/trainers/post_train/distillation/train_distill.pywithcreate_goodput_recorder,maybe_monitor_goodput,RECORD_JOB_START_TIME,GoodputEvent.TPU_INIT,GoodputEvent.TRAINING_PREPARATION,BaseTrainingHooks(student_config, goodput_recorder), andRECORD_JOB_END_TIME(recorded in afinallyblock).BaseTrainingHooksinsrc/maxtext/trainers/post_train/hooks.pysomeshandlearning_rate_scheduleare optional, enabling Goodput-only hook instantiation (BaseTrainingHooks(config, goodput_recorder)) while remaining backward-compatible withSFTTrainingHooksandDPOTrainingHooks.tpu-post-train-requirements.txt):ml-goodput-measurement>=0.2.2tosrc/dependencies/requirements/base_requirements/tpu-post-train-requirements.txtso post-training Docker images include the Goodput measurement library.Tests
goodput_job_namefallback and override behavior intests/unit/goodput_utils_test.py.RLGoodputTestintests/post_training/unit/train_rl_test.pycoveringrl_trainlifecycle/step recording (enable_goodput_recording=TrueandFalse) andRLTrainingHookswitheval_interval=0.test_train_distill_goodput_enabledandtest_train_distill_goodput_disabledintests/post_training/unit/train_distill_test.py.test_base_training_hooks_goodput_only_modeintests/post_training/unit/hooks_test.py.• Verified and post-training (SFT, LoRA, Multimodal SFT, RL) Goodput recording in Cloud Logging via maxtext_e2e_tpu_post_training.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.