Great Code Cleanup

Did you ever want to contribute to :hugs:transformers but not know how? We need help from the community with two big problems:

Firstly , we want to convert our TensorFlow code to use a new decorator to handle input preprocessing. This greatly simplifies and cleans up every TF model in our entire codebase. We estimate that over 10,000 lines of code could be removed by this change, and 10,000 more made simpler and more readable, without any loss in functionality. This will make the code much more maintainable and approachable for newcomers, which will lead to fewer bugs and more new features in future.

Secondly , we want to add type hints to both PyTorch and TensorFlow models. Type hints are currently used inconsistently across our codebase, and lots of models are missing them. Adding type hints will have several major benefits: It鈥檒l make it easier to catch bugs in the code, it will make it easier to compile PyTorch models with torch.jit.script, and it will enable new features we鈥檙e developing which will make it easier to train Keras models too!

Neither of these changes are difficult, but there are a lot of models in transformers, and that means a lot of code needs to be edited to bring these changes in across the whole codebase - the core team can鈥檛 do it alone, and we need your help! Even if you鈥檝e never contributed to transformers before, this is a great place to start, and even a PR for a single model will really help us out.

If you want to contribute, what should you do?

It鈥檚 totally okay to do both at once, of course! If you want to do that, please make sure that the model you want to update hasn鈥檛 been claimed in either issue, then reply in both claiming it, and file a single PR containing both the decorator and type hint updates.

If you鈥檇 like to help, but this is all a bit overwhelming, don鈥檛 worry! You can join the community Discord if you want to talk with other contributors. Feel free to ask questions in there and help each other out, and we鈥檒l try to have people from the core team drop in to provide assistance too!

This cleanup sprint will be running for the next weeks , from now until March 20th.