This repo contains the content that's used to create the Hugging Face course. The course teaches you about applying Transformers to various tasks in natural language processing and beyond. Along the way, you'll learn how to use the Hugging Face ecosystem — 🤗 Transformers, 🤗 Datasets, 🤗 Tokenizers, and 🤗 Accelerate — as well as the Hugging Face Hub. It's completely free and open-source!
Language | Source | Authors |
---|---|---|
English | chapters/en |
@sgugger, @lewtun, @LysandreJik, @Rocketknight1, @sashavor, @osanseviero, @SaulLu, @lvwerra |
Russian (WIP) | chapters/ru |
@pdumin |
Spanish (WIP) | chapters/es |
@camartinezbu |
Thai (WIP) | chapters/th |
@peeraponw, @a-krirk, @jomariya23156 |
As part of our mission to democratise machine learning, we'd love to have the course available in many more languages! Please follow the steps below if you'd like to help translate the course into your language 🙏.
🗞️ Open an issue
To get started, navigate to the Issues page of this repo and check if anyone else has opened an issue for your language. If not, open a new issue by selecting the Translation template from the New issue button.
Once an issue is created, post a comment to indicate which chapters you'd like to work on and we'll add your name to the list.
🍴 Fork the repository
Next, you'll need to fork this repo. You can do this by clicking on the Fork button on the top-right corner of this repo's page.
Once you've forked the repo, you'll want to get the files on your local machine for editing. You can do that by cloning the fork with Git as follows:
git clone https://github.com/YOUR-USERNAME/course
📋 Copy-paste the English files with a new language code
The course files are organised under a main directory:
chapters
: all the text and code snippets associated with the course.
You'll only need to copy the files in the chapters/en
directory, so first navigate to your fork of the repo and run the following:
cd ~/path/to/course
cp -r chapters/en/CHAPTER-NUMBER chapters/LANG-ID/CHAPTER-NUMBER
Here, CHAPTER-NUMBER
refers to the chapter you'd like to work on and LANG-ID
should be one of the ISO 639-1 or ISO 639-2 language codes -- see here for a handy table.
✍️ Start translating
Now comes the fun part - translating the text! The first thing we recommend is translating the part of the _toctree.yml
file that corresponds to your chapter. This file is used to render the table of contents on the website and provide the links to the Colab notebooks. The only fields you should change are the title
, ones -- for example, here are the parts of _toctree.yml
that we'd translate for Chapter 0:
- title: 0. Setup # Translate this!
sections:
- local: chapter0/1 # Do not change this!
title: Introduction # Translate this!
Once you have translated the _toctree.yml
file, you can start translating the MDX files associated with your chapter.
🙋 If the
_toctree.yml
file doesn't yet exist for your language, you can simply create one by copy-pasting from the English version and deleting the sections that aren't related to your chapter. Just make sure it exists in thechapters/LANG-ID/
directory!
The Jupyter notebooks containing all the code from the course are hosted on the huggingface/notebooks
repo. If you wish to generate them locally, first install the required dependencies:
python -m pip install -r requirements.txt
Then run the following script:
python utils/generate_notebooks.py --output_dir nbs
This script extracts all the code snippets from the English chapters and stores them as notebooks in the nbs
folder (which is ignored by Git by default).
Note: we are not currently accepting community contributions for new chapters. These instructions are for the Hugging Face authors.
Adding a new chapter to the course is quite simple:
- Create a new directory under
chapters/en/chapterX
, wherechapterX
is the chapter you'd like to add. - Add numbered MDX files
sectionX.mdx
for each section. If you need to include images, place them in the huggingface-course/documentation-images repository and use the HTML Images Syntax with the pathhttps://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/{langY}/{chapterX}/{your-image.png}
. - Update the
_toctree.yml
file to include your chapter sections -- this information will render the table of contents on the website. If your section involves both the PyTorch and TensorFlow APIs oftransformers
, make sure you include links to both Colabs in thecolab
field.
If you get stuck, check out one of the existing chapters -- this will often show you the expected syntax.
Once you are happy with the content, open a pull request and tag @lewtun for a review. We recommend adding the first chapter draft as a single pull request -- the team will then provide feedback internally to iterate on the content 🤗!
The structure of this repo and README are inspired by the wonderful Advanced NLP with spaCy course.