Move src/MaxText/sft to src/maxtext/trainers/post_train/sft#2988
Merged
copybara-service[bot] merged 1 commit intomainfrom Jan 23, 2026
Merged
Move src/MaxText/sft to src/maxtext/trainers/post_train/sft#2988copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5105562 to
04d4e71
Compare
04d4e71 to
9be4a6a
Compare
|
🤖 Hi @SurbhiJainUSC, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
📋 Review Summary
This pull request effectively refactors the Supervised Fine-Tuning (SFT) codebase by moving it to a more organized directory structure under src/maxtext/trainers/post_train/sft. The changes are comprehensive, updating documentation, examples, tests, and configuration files to reflect the new structure. The inclusion of a shim for backward compatibility is a thoughtful touch.
🔍 General Feedback
- Good Refactoring: The file relocation and path updates have been executed cleanly across the repository.
- Backward Compatibility: The shim in
src/MaxText/sft/sft_trainer.pyis a great way to avoid breaking existing user workflows. - Documentation: The documentation has been updated to reflect the new commands, which is crucial for users. I've left a few minor stylistic suggestions to reduce extra whitespace in the markdown files for source code consistency.
Overall, this is a solid refactoring effort that improves the project's structure.
aireenmei
approved these changes
Jan 22, 2026
khatwanimohit
approved these changes
Jan 23, 2026
A9isha
pushed a commit
to A9isha/maxtext
that referenced
this pull request
Feb 18, 2026
Migrate RL training code to the new package structure following the same pattern as the SFT (PR AI-Hypercomputer#2988) and distillation moves. Old location files are replaced with backward-compatibility shims that delegate to the new modules with deprecation warnings. https://claude.ai/code/session_012v9Rb4P6iQgWiaNSxyv5EU
4 tasks
A9isha
added a commit
that referenced
this pull request
Feb 19, 2026
…ost_train/rl/ Imported from GitHub PR #3180 # Description Migrate RL training code to the new package structure following the same pattern as the SFT (PR #2988) and distillation moves. Old location files are replaced with backward-compatibility shims that delegate to the new modules with deprecation warnings. Also, fixing the Jupyter notebook run test but disabling `sft_qwen3_demo.ipynb` for further investigation # Tests Locally ran RL using the following commands: ``` ## new python3 -m src.maxtext.trainers.post_train.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ## old python3 -m src.MaxText.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ``` # Checklist Before submitting this PR, please make sure (put X in square brackets): - [X] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [X] I have necessary comments in my code, particularly in hard-to-understand areas. - [X] I have run end-to-end tests tests and provided workload links above if applicable. - [X] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files). Copybara import of the project: -- e99b7ec by A9isha <mazumdera@google.com>: Move RL code from src/MaxText/rl/ to src/maxtext/trainers/post_train/rl/ Merging this change closes #3180 FUTURE_COPYBARA_INTEGRATE_REVIEW=#3180 from AI-Hypercomputer:anisha-rl-refactor e99b7ec PiperOrigin-RevId: 872533178
A9isha
added a commit
that referenced
this pull request
Feb 19, 2026
…ost_train/rl/ Imported from GitHub PR #3180 # Description Migrate RL training code to the new package structure following the same pattern as the SFT (PR #2988) and distillation moves. Old location files are replaced with backward-compatibility shims that delegate to the new modules with deprecation warnings. Also, fixing the Jupyter notebook run test but disabling `sft_qwen3_demo.ipynb` for further investigation # Tests Locally ran RL using the following commands: ``` ## new python3 -m src.maxtext.trainers.post_train.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ## old python3 -m src.MaxText.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ``` # Checklist Before submitting this PR, please make sure (put X in square brackets): - [X] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [X] I have necessary comments in my code, particularly in hard-to-understand areas. - [X] I have run end-to-end tests tests and provided workload links above if applicable. - [X] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files). Copybara import of the project: -- e99b7ec by A9isha <mazumdera@google.com>: Move RL code from src/MaxText/rl/ to src/maxtext/trainers/post_train/rl/ Merging this change closes #3180 FUTURE_COPYBARA_INTEGRATE_REVIEW=#3180 from AI-Hypercomputer:anisha-rl-refactor e99b7ec PiperOrigin-RevId: 872533178
A9isha
added a commit
that referenced
this pull request
Feb 19, 2026
…ost_train/rl/ Imported from GitHub PR #3180 # Description Migrate RL training code to the new package structure following the same pattern as the SFT (PR #2988) and distillation moves. Old location files are replaced with backward-compatibility shims that delegate to the new modules with deprecation warnings. Also, fixing the Jupyter notebook run test but disabling `sft_qwen3_demo.ipynb` for further investigation # Tests Locally ran RL using the following commands: ``` ## new python3 -m src.maxtext.trainers.post_train.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ## old python3 -m src.MaxText.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ``` # Checklist Before submitting this PR, please make sure (put X in square brackets): - [X] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [X] I have necessary comments in my code, particularly in hard-to-understand areas. - [X] I have run end-to-end tests tests and provided workload links above if applicable. - [X] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files). Copybara import of the project: -- e99b7ec by A9isha <mazumdera@google.com>: Move RL code from src/MaxText/rl/ to src/maxtext/trainers/post_train/rl/ Merging this change closes #3180 FUTURE_COPYBARA_INTEGRATE_REVIEW=#3180 from AI-Hypercomputer:anisha-rl-refactor e99b7ec PiperOrigin-RevId: 872533178
A9isha
added a commit
that referenced
this pull request
Feb 19, 2026
…ost_train/rl/ Imported from GitHub PR #3180 # Description Migrate RL training code to the new package structure following the same pattern as the SFT (PR #2988) and distillation moves. Old location files are replaced with backward-compatibility shims that delegate to the new modules with deprecation warnings. Also, fixing the Jupyter notebook run test but disabling `sft_qwen3_demo.ipynb` for further investigation # Tests Locally ran RL using the following commands: ``` ## new python3 -m src.maxtext.trainers.post_train.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ## old python3 -m src.MaxText.rl.train_rl src/maxtext/configs/post_train/rl.yml model_name=llama3.1-8b t okenizer_path=meta-llama/Llama-3.1-8B-Instruct load_parameters_path=/path/to/checkpoint run_name=maz-8b-$RANDOM bas e_output_directory=/path/to/storage hf_access_token=<HF_TOKEN> dataset_name=gsm8k steps=4 ``` # Checklist Before submitting this PR, please make sure (put X in square brackets): - [X] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [X] I have necessary comments in my code, particularly in hard-to-understand areas. - [X] I have run end-to-end tests tests and provided workload links above if applicable. - [X] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files). Copybara import of the project: -- e99b7ec by A9isha <mazumdera@google.com>: Move RL code from src/MaxText/rl/ to src/maxtext/trainers/post_train/rl/ Merging this change closes #3180 FUTURE_COPYBARA_INTEGRATE_REVIEW=#3180 from AI-Hypercomputer:anisha-rl-refactor e99b7ec PiperOrigin-RevId: 872533178
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.
Description
src/MaxText/sfttosrc/maxtext/trainers/post_train/sftsrc/MaxText/sft/sft_trainer.py, so that users running the old command can be redirected to the new command without breakingTests
SFT with old command:
SFT with new command:
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.