[Reland] Add Dynamic Model Import and ModelSpec Definition (#837) #854
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.
Stack from ghstack (oldest at bottom):
ghstackdidn't land #814correctly. Open this PR to do so. The detail discussion please refer to
#814
What does this PR do?
ModelSpecto describe a model and how toparallelize a model.
register_model_spec().--experimental.custom_model_pathto dynamicallyimport a model that is not implemented by TorchTitan. The module should
also call
register_model_spec().OptimizersContainerandLRSchedulersContainersrequires_grad is False.
OptimizersContainernow inherits fromtorch.optim.Optimizer.parallelize_llamaandpipelining_llamato thellamafolder.Why do we need this PR?
This allows users to use TorchTitan with a new model without intrusively
change TorchTitan code.
Next steps