-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Provide intra-fit() ckpt_path access to enable additional finetuning modalities #10198
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
Provide intra-fit() ckpt_path access to enable additional finetuning modalities #10198
Conversation
a2803c0
to
4c4c747
Compare
d7da388
to
ef67620
Compare
ef67620
to
349f73f
Compare
349f73f
to
f302153
Compare
f302153
to
1c77531
Compare
1c77531
to
65fb438
Compare
65fb438
to
e26b11f
Compare
@staticmethod | ||
def __apply_mapping_to_param_groups(param_groups: List[Dict[str, Any]], mapping: dict) -> List[Dict[str, Any]]: | ||
def _apply_mapping_to_param_groups(param_groups: List[Dict[str, Any]], mapping: dict) -> List[Dict[str, Any]]: |
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.
Requesting this method be changed to protected instead of private since it has proved useful for FinetuningScheduler and I can conceive of it being useful in other contexts.
self.fit_ckpt_path = self.__set_ckpt_path( | ||
ckpt_path, model_provided=model, model_connected=self.lightning_module is not None | ||
) |
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.
This attribute is needed for FinetuningScheduler and I think it could make sense for other potential extensions as well.
# add trivial test parameter to convblock to validate parent (non-leaf) module parameter handling | ||
self.parent_param = nn.Parameter(torch.zeros((1), dtype=torch.float)) | ||
self.bn = nn.BatchNorm2d(out_channels) | ||
class ConvBlockParam(nn.Module): |
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.
FinetuningScheduler uses both ConvBlockParam and ConvBlock for testing and I think it's sufficiently useful elsewhere to have the two classes defined outside the complex_model test.
f3a478e
to
ee9c4c8
Compare
ee9c4c8
to
5064ddb
Compare
… and added new *.yaml files to manifest
…_theme via PR Lightning-Universe/lightning_sphinx_theme#41 , (pip install -r requirements/doc.txt to test)
…ver installing packages unrequired outside of submodule usage)
…ria, user-specified epoch transitions or a composition of the two (the default mode). Also enables parameters to be fully specified or selected via regex.
…st_finetuningscheduling_epoch_trans_only
…tribute and EarlyStopping modification. FTSEarlyStopping extension of EarlyStopping added. FTS dependencies managed by a callbackresolvermixin
…n to move it to the hub. leaving the PR open for a few minor changes required to support user registered callbacks like the finetuning_scheduler
5064ddb
to
30a985a
Compare
since the scope of this PR has changed so much, to maximize clarity I've opened a replacement PR |
What does this PR do?
This PR includes a few minor changes that enable callbacks to restore checkpoints iteratively within the context of
Trainer.fit()
.An example use case that depends on access to ckpt_path (
fit_ckpt_path
) within fit() is available in a notebook-based tutorial (lightning-tutorials PR).Does your PR introduce any breaking changes? If yes, please list them.
None
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Yes :)
Make sure you had fun coding 🙃