Add `MegatronT5ForConditionalGeneration`
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).
- [x] 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.
- [x] 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
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.
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.
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!
@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 :)
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.
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!
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.