ofthemodel's original repository. At Hugging Face, we are trying to empower the community more and more to add models
independently. Thus, for some new models that the community wants to be added to 🤗 Transformers, we create a customized
*call-for-model-addition* that explains step-by-step how to add the requested model. With this
*call-for-model-addition*, we want to teach a motivated and experienced contributor of the community how to port a
model to 🤗 Transformers.
The🤗Transformerslibraryisoftenabletooffernewmodelsthankstocommunitycontributors.Butthiscanbeachallengingprojectandrequiresanin-depthknowledgeofthe🤗Transformerslibraryandthemodeltoimplement.AtHuggingFace,we're trying to empower more of the community to actively add models and we'veputtogetherthisguidetowalkyouthroughtheprocessofaddingaPyTorchmodel(makesureyouhave[PyTorchinstalled](https://pytorch.org/get-started/locally/)).
If this sounds like something you would be interested in, feel free to check out the currently open
Ifyou're interested in implementing a TensorFlow model, take a look at the [How to convert a 🤗 Transformers model to TensorFlow](add_tensorflow_model) guide!
</Tip>
Along the way, you'll:
If selected, you will then work closely with one member of the Hugging Face team to integrate the model into 🤗
Transformers. By doing so, you will both gain a theoretical and deep practical understanding of the proposed model. But
more importantly, you will have made a major open-source contribution to 🤗 Transformers. Along the way, you will:
- understand the design principles of one of the most popular NLP libraries
- learn how to do efficiently test large NLP models
- learn how to integrate Python utilities like `black`, `isort`, `make fix-copies` into a library to always
ensure clean and readable code
AHuggingFaceteammemberwillbeavailabletohelpyoualongthewaysoyou'll never be alone. 🤗 ❤️
We are also more than happy if you want to add a model that cannot be found in the “calls-for-model-addition” folder.
The following sections explain in detail how to add a new model. It might also be very helpful to check out already
added models to see if those resemble the model you would like to add [here](https://github.com/huggingface/transformers/pulls?q=is%3Apr+label%3A%22PR+for+Model+Addition%22+is%3Aclosed).
To get started, open a [New model addition](https://github.com/huggingface/transformers/issues/new?assignees=&labels=New+model&template=new-model-addition.yml) issue for the model you want to see in 🤗 Transformers. If you'renotespeciallypickyaboutcontributingaspecificmodel,youcanfilterbythe[Newmodellabel](https://github.com/huggingface/transformers/labels/New%20model)toseeifthereareanyunclaimedmodelrequestsandworkonit.
To start, let'strytogetageneraloverviewoftheTransformerslibrary.
Onceyou've opened a new model request, the first step is to get familiar with 🤗 Transformers if you aren'talready!
##Generaloverviewof🤗Transformers
...
...
@@ -144,20 +138,20 @@ In the following, we try to give you a general recipe that we found most useful
The following list is a summary of everything that has to be done to add a model and can be used by you as a To-Do
List:
- 1. ☐ (Optional) Understood theoretical aspects
- 2. ☐ Prepared transformers dev environment
- 3. ☐ Set up debugging environment of the original repository
- 4. ☐ Created script that successfully runs forward pass using original repository and checkpoint
- 5. ☐ Successfully added the model skeleton to Transformers
- 6. ☐ Successfully converted original checkpoint to Transformers checkpoint
- 7. ☐ Successfully ran forward pass in Transformers that gives identical output to original checkpoint
- 8. ☐ Finished model tests in Transformers
- 9. ☐ Successfully added Tokenizer in Transformers
- 10. ☐ Run end-to-end integration tests
- 11. ☐ Finished docs
- 12. ☐ Uploaded model weights to the hub
- 13. ☐ Submitted the pull request
- 14. ☐ (Optional) Added a demo notebook
☐ (Optional) Understood the model'stheoreticalaspects<br>