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

Add MegatronT5ForConditionalGeneration #22317

Closed
wants to merge 5 commits into from

Conversation

eagle705
Copy link

What does this PR do?

This PR adds the MegatronT5ForConditionalGeneration class, which among standard applications can be used for pretrained T5 model from NVIDIA NeMo MegatronT5 :)
I also add converting script from NeMo MegatronT5 to Huggingface MegatronT5ForConditionalGeneration model

Fixes #22315

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?

Who can review?

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.

cc @ArthurZucker and @younesbelkada

Sorry, something went wrong.

@HuggingFaceDocBuilderDev

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

@eagle705 eagle705 changed the title Add megatron t5 Add MegatronT5ForConditionalGeneration Mar 22, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@ArthurZucker
Copy link
Collaborator

Hey! Thanks for contributing! In the current state I cannot really see the differences between this model and T5. Adding the # Copied from statements would help a lot. However if the model is very similar (and you still want to persue the PR!) I would recommend adding the model to the hub following this tutorial! It will be simpler for you and you won't have to deal with all the red CIs!

@eagle705
Copy link
Author

@ArthurZucker

You are correct that the basic structure of the model is based on the existing T5. However, there are differences in the implementation between huggingface and MegatronLM (or NeMo) regarding the reshaping of tensors for attention computation, as well as various differences in normalization methods. Due to these differences, I decided to submit the pull request. Simply mapping the model weights wouldn't result in proper functioning, so a custom class was required. I will refer to the guide you provided and give it a try. Thank you :)

@github-actions
Copy link

github-actions bot commented Jun 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@ArthurZucker
Copy link
Collaborator

Hey! Could you refer me to the link of the updated model if you already push it to the hub? 😉 This is in order to keep track of models on the hub!

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot closed this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add MegatronT5
3 participants