Skip to content

[PyTorch] TE checkpoint pass-through logic fix - #782

Merged
denera merged 2 commits into
NVIDIA:mainfrom
denera:te-torch-checkpoint-passthrough-fix
Apr 16, 2024
Merged

[PyTorch] TE checkpoint pass-through logic fix #782
denera merged 2 commits into
NVIDIA:mainfrom
denera:te-torch-checkpoint-passthrough-fix

Conversation

@denera

Copy link
Copy Markdown
Collaborator

This PR makes the TE checkpoint recursively search for TE submodules in the checkpointed module and only passes pure-PyTorch modules through to the native PyTorch checkpoint function.

Fix for #776.

@deneradenera added the bug Something isn't working label Apr 16, 2024
@denera
denera requested a review from ptrendxApril 16, 2024 00:22
@deneradenera self-assigned this Apr 16, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denera I think by using root_module.modules() instead, we can do away with recursion as well as requiring 2 functions (has/is module) since it also returns self

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize torch.nn.Module.modules() recursed into all submodules in the network. Definitely makes things easier. Fixed in the latest commit.

…TE submodules
Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
deneraforce-pushed the te-torch-checkpoint-passthrough-fix branch from 2b1c4f3 to 8209eb2CompareApril 16, 2024 16:53
Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
denera requested a review from ksivamanApril 16, 2024 17:39

@ksivamanksivaman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@denera
denera merged commit f96f340 into NVIDIA:mainApr 16, 2024
pggPL pushed a commit to pggPL/TransformerEngine that referenced this pull request May 23, 2024
* changed TE checkpoint passthrough logic to also recursively look for TE submodules
Signed-off-by: Alp Dener <adener@nvidia.com>
* simplified search for TE modules in the checkpointed network
Signed-off-by: Alp Dener <adener@nvidia.com>
---------
Signed-off-by: Alp Dener <adener@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@denera@ksivaman