-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add Trainer.init_module
and LightningModule.configure_model
#18004
Conversation
ceb470f
to
7ffddf2
Compare
2535351
to
f0939ea
Compare
dbf2f54
to
eb942ea
Compare
trainer.init_module
and trainer.init_tensor
trainer.init_module
6fed2f8
to
4613d7c
Compare
b7562a3
to
49629af
Compare
⚡ Required checks status: All passing 🟢Groups summary🟢 pytorch_lightning: Tests workflow
These checks are required after the changes to 🟢 pytorch_lightning: Azure GPU
These checks are required after the changes to 🟢 pytorch_lightning: Benchmarks
These checks are required after the changes to 🟢 pytorch_lightning: Docs
These checks are required after the changes to 🟢 lightning_fabric: CPU workflowThese checks are required after the changes to 🟢 lightning_fabric: Azure GPU
These checks are required after the changes to 🟢 mypy
These checks are required after the changes to 🟢 installThese checks are required after the changes to 🟢 link-check
These checks are required after the changes to Thank you for your contribution! 💜
|
trainer.init_module
Trainer.init_module
and LightningModule.configure_model
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.
Looks great. Minor questions and comments only
What does this PR do?
Port of #17462 for the Trainer
Key implementation differences:
init_context
support forDeepSpeedPrecisionPlugin
because it doesn't support true precision (unlike Fabric)Trainer
only exposesinit_module
which functionally matchesfabric.init_tensor
because otherwise it would require that processes have been launched when it is called, but that won't happen untiltrainer.fit()
.Trainer.init_module
, users are suggestedLightningModule.configure_model
with sharded strategiesLightningModule.configure_sharded_model
is deprecated in favor ofLightningModule.configure_model
Generated docs: https://pytorch-lightning--18004.org.readthedocs.build/
Enables Lightning-AI/litgpt#228
cc @Borda @awaelchli @carmocca @justusschock