How to start contributing to Hugging Face 🤗 2021

Daniel Hug
3 min readMar 29, 2021

In this blog post I will share some tips on how to begin contributing to the Hugging Face transformers library.

Important Links:

Getting Started

The first place to start learning how to contribute to Hugging Face is in the Contributing.md file, found in the transformers GitHub repository. The contributing file will give you a run down on everything you need to know. From setting up your environment to the actual logistics of how to preform a pull request. You will also find the link to the code of conduct file there as well, I recommend that you review that too.

There are several ways you can contribute all of which are equally valued and appreciated.

  • Fixing outstanding issues with the existing code;
  • Implementing new models;
  • Contributing to the examples or to the documentation;
  • Submitting issues related to bugs or desired features;
  • Writing blog posts 👋;

I won’t repeat what’s in the contributing file because it’s already well written, and it’s subject to change. So, I’ll share a couple other tips that I would have found useful when I started.

Set up a virtual environment before installing the requirements.

A good way to keep your computer clean and simplify the process of creating your environment is to use a virtual environment. This env will contain all of the dependencies required for the transformers repository. There are two ways of accomplishing this in python:

  1. venv — Creation of virtual environments
  2. conda environments

Or don’t use any, it’s your life.

Make sure your bash profile contains a python alias for python3

This is a problem I ran into during my first pull request. The reason for this is due to the makefile. When running the test, style or fixup commands the make file uses the ‘python’ command instead of ‘python3’. This can lead to your computer thinking you want to use python 2.7 instead of python 3. While this may not effect everyone, it certainly caused me headaches when I first started, so it’s something to look out for.

Finding beginner level issues

Finding beginner level issues is very simple if you know the right place to look. First, go to the issues tab in the GitHub repository. Next, click on the Label filter and select “Good First Issue” or “Good Second Issue”. After you apply the filter you will find several beginner friendly issues to work on. If you’re confused about the specifics, you can post on the issues page and ask for clarification. If you’re nervous to ask a question, look in the closed issues and closed pull requests to see how past contributors have succeeded. Remember to be respectful and patient, the maintainers may be busy.

Another way to find how to contribute is to either read the code and look for bugs to report or read the documentation and find grammar errors or explanations that need further clarification. If you find a bug in the code or documentation make sure to first post in issues to bring awareness to the issue and notify the maintainers.

The Maintainers

The more time you spend on the repository the more you will start to recognize the same people. There are several maintainers for the repository to look out for, as they will be the ones that will review and merge your code. You can find the top contributors on the contributors page. However, the top five are tomwolf, LysandreJik, sgugger, patrickvonplaten and julien-c. Treat them with respect and they will return the favor.

Helpful videos and articles for learning how to contribute to open source

Conclusion

I hope this helps simplify the process for any would be open source contributors. Contributing to open source is great way to get involved with the community, get noticed by companies and get experience working on a production ready environments. Hugging Face is one of the best communities around in the artificial intelligence field, and by contributing you’re strengthening the community. Good luck!

Originally published at http://github.com/danielpatrickhug.

--

--

Daniel Hug

Software Developer from New York. Interested in Robotics, Healthcare, Math, Artificial Intelligence and Space. Comp Sci degree from SUNY.