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.
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 meta_init, enable it as default init process #84
Add meta_init, enable it as default init process #84
Changes from all commits
8699f1c
f211961
2b1871e
6a15267
bbc165f
8fea674
8b20a62
bef7cf9
de2e2a4
7b65935
eee05e8
4261c54
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I apologize that FSDP meta-device init is confusing, but I think this might not be fully correct.
module.reset_parameters()
only resets/initializes the parameters immediately owned bymodule
, not those of its children/submodules. Here,model: Transformer
is initializing all of its submodules' parameters. This contract is the only way forreset_parameters()
to always work compositionally, otherwise (like on our case) we must assumeTransformer
to always be the root module.model.reset_parameters()
, the parameters have already been flattened and sharded by FSDP. This means that any initialization method that depends on the tensor shape would be incorrect. That is why we would normally want users to do the correct initialization in theparam_init_fn
.For this Llama case, it looks like perhaps the
reset_parameters()
have been written to not depend on the tensor shape directly?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.
correct that the init does not depend on tensor shape directly.
I see your point though about only resetting it's own params and not children, but let's meet to discuss as I also have questions on how meta_init should work for FSDP2 and we can get an updated impl.