Great Code Cleanup
Did you ever want to contribute totransformers 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’ll 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’re 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’t do it alone, and we need your help! Even if you’ve 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?Firstly, read our contributing guidelines here:transformers/CONTRIBUTING.md at master · huggingface/transformers · GitHubIf you’re interested in adding the new TensorFlow decorator, please see the instructions here:TF: clearer model variable naming · Issue #16051 · huggingface/transformers · GitHubIf you’re interested in adding type hints to either TensorFlow or PyTorch models, please see the instructions here:Add missing type hints · Issue #16059 · huggingface/transformers · GitHubIt’s 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’t 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’d like to help, but this is all a bit overwhelming, don’t worry!You can join thecommunity Discordif you want to talk with other contributors. Feel free to ask questions in there and help each other out, and we’ll try to have people from the core team drop in to provide assistance too!This cleanup sprint will be running for the nextweeks, from now until March 20th.