-
Notifications
You must be signed in to change notification settings - Fork 447
Checkpoint utility: add gpt-oss to_maxtext & refactor code #2818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
dae0b48 to
dd51cf4
Compare
|
🤖 Hi @shuningjin, 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📋 Review Summary
This pull request introduces a significant and valuable set of enhancements to the checkpoint conversion utilities. The refactoring improves code modularity by moving shared functions to a central utils.py, and the new functionality, such as support for local Hugging Face models and unscanned GPT-OSS models, greatly increases the flexibility of these tools.
🔍 General Feedback
- Positive: The addition of more granular timing logs is a great improvement for performance analysis and debugging. The updated documentation in the README provides a much clearer overview of supported models and conversion paths.
- Good Refactoring: Moving
check_param_map_keystoutils.pyand introducingget_maxtext_model_infointo_maxtext.pyare excellent changes that improve code organization and reusability.
I have left a couple of minor comments, one regarding a bug in the timing calculation and another for a small docstring clarification. Overall, this is a solid contribution.
hengtaoguo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work!
ff78257 to
c5f0176
Compare
RissyRan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! If you could wrap your added codes into helper functions among that 8 cases, which will be really appreciated :) Also, let's create a bug to track the rest refactor.
Test llama3.1-8b & llama3.1-70bWhy: (1) Not in readme, unclear if it is tested. (2) I refactored chained hook function, need validate. Test llama3.1-8b1 scan to_maxtext https://paste.googleplex.com/4998663032143872 gs://runner-maxtext-logs/2026-01-05-07-48/0/items https://paste.googleplex.com/5362702983757824 2 scan to_huggingface https://paste.googleplex.com/6262739150438400 /home/shuningjin/tmp/llama3.1-8b-hf-2026-01-05-08-07-40 https://paste.googleplex.com/4895288806473728 3 unscan to_maxtext https://paste.googleplex.com/5925712177528832 gs://runner-maxtext-logs/2026-01-05-08-44/0/items https://paste.googleplex.com/5328587924307968 4 unscan to_huggingface https://paste.googleplex.com/4849285143330816 /home/shuningjin/tmp/llama3.1-8b-hf-2026-01-05-08-50-33 https://paste.googleplex.com/4851388989440000 Test llama3.1-70b1 scan to_maxtext https://paste.googleplex.com/5830490068221952 gs://runner-maxtext-logs/2026-01-05-19-22/0/items 2 scan to_huggingface https://paste.googleplex.com/4999300700569600 https://paste.googleplex.com/4753248986726400 /home/shuningjin/tmp/llama3.1-70b-hf-2026-01-05-22-42-55 |
Test qwen3-30bWhy: (1) validate for readme (2) validate as refactored hf param stacking 1 Scan to_maxtext gs://runner-maxtext-logs/2026-01-05-16-40/0/items https://paste.googleplex.com/5478434014887936 https://paste.googleplex.com/6224942968471552 2 Scan to_huggingface https://paste.googleplex.com/6328627622969344 /home/shuningjin/tmp/qwen3-30b-a3b-hf-2026-01-05-17-16-41 https://paste.googleplex.com/6311964089384960 3 Unscan to_maxtext https://paste.googleplex.com/6271451139276800 gs://runner-maxtext-logs/2026-01-05-17-34/0/items https://paste.googleplex.com/6272882302910464 4 Unscan to_huggingface https://paste.googleplex.com/6161672899264512 |
bd2c830 to
f8ce9a5
Compare
I did an initial round of refactor, and improved the comment/docstring. This should help clarify maxtext key forms and hf value forms. I tested llama3.1-8b, llama3.1-70b, and qwen3-30b. This is to ensure the refactor does not break other models. I tested gpt-oss-120b: to_huggingface works well, test added to description; to_maxtext is very slow, will defer its testing after optimization -- follow up. Readme is updated to track models supported and distinguish sizes tested/untested. |
RissyRan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change!
95feb36 to
171a3c6
Compare
I additionally tested gpt-oss-120b to_maxtext, added to description. It takes 120min. Will follow up with optimization. |
Description
Previously we have gpt-oss, orbax(scan) -> hf: #2647, which is tested for both 20b and 120b.
Fix: b/459541579
Fix: b/452392132
Fix: b/452391921
What this does
GPT-OSS / weight splitting
to_maxtext.pyparam_mapping.py, gpt-ossRefactor
readmeto_maxtext.pyutils.py_check_param_map_keysfrom to_huggingface.py to here , so it can be reused by to_maxtext.pyparam_mapping.pyTests
All tests are on CPU.
1 HF -> orbax (gpt-oss-20b)
since we made non-trivial changes to lazy tensor implementation, also test lazy mode
HF -> orbax (scan)
https://paste.googleplex.com/4888544332087296
3.56 min
https://paste.googleplex.com/5272274628378624
HF -> orbax (scan), lazy load
https://paste.googleplex.com/6192468888518656
4.96 min
https://paste.googleplex.com/5022180226236416
HF -> orbax (unscan)
https://paste.googleplex.com/6000687559344128
https://paste.googleplex.com/6128993298415616
2 orbax -> HF (gpt-oss-20b), unscan
https://paste.googleplex.com/5483624130543616
https://paste.googleplex.com/4854884102963200
3 orbax -> HF (gpt-oss-120b), unscan
https://paste.googleplex.com/5823699976585216
/home/shuningjin/gpt-oss-120b/gpt-oss-120b-hf-2026-01-05-23-19-02
https://paste.googleplex.com/6546254270169088
4 HF -> orbax (gpt-oss-120b), scan
https://paste.googleplex.com/6019766257057792
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.