Skip to content
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

save space when converting hf model to megatron model. #25950

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

flower-with-safe
Copy link
Contributor

What does this PR do?

Fixes #25911

when save megatron models, clone the tensor to avoid saving the original tensor.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Yes

Who can review?

@ArthurZucker

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Looks good to me 😉
I think there are other places in the code that might also need this (final layer norm?)

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@flower-with-safe
Copy link
Contributor Author

flower-with-safe commented Sep 5, 2023

you are right, I add the LM head. But I think layer norm doesn't need this method, they are replicated across the tensor paralledl group.
@ArthurZucker

@ArthurZucker
Copy link
Collaborator

Thanks! Looks good to me 😉

@LysandreJik LysandreJik merged commit 172f42c into huggingface:main Sep 5, 2023
parambharat pushed a commit to parambharat/transformers that referenced this pull request Sep 26, 2023
…5950)

* fix convert megatron model too large

* fix convert megatron model too large
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use clone() method before save tensor when converting Hf model to Megatron model
4 participants