[src/MaxText/utils/ckpt_conversion] Split into one file per ckpt_conversion following strategy pattern #2967
+1,785
−1,595
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
1632 may just be too big a file! - See src/MaxText/utils/ckpt_conversion/utils/param_mapping.py
There are two obvious ways of doing this refactor:
Qwen3/get_image_offsets.py, Qwen3/apply_embedding.py, &etc.
If you take the latter approach to its extreme, the models themselves can be removed from this repository. New models can be added privately (e.g., on NVIDIA's or AMD's fork), and the loose coupling enables them to take full advantage of new/improved functionality throughout MaxText.
Various mechanisms can be made to make the second approach type safe, like:
e.g., JSON schema + LibCST + Pydantic)
And the original 0,1 can be done in phases. With 0 done first and 1 done once the final refactor can be done trivially performed in any IDE or langserv.
Even keeping all the models in this repository has advantage, particularly when refactoring / adding new features / upgrading dependencies and ensuring consistency throughout (for quality and benchmarking purposes).
Tests
CI
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.