Hugging Face Tutorial for Beginners [Quick Start]

If you want a simple way to create your own AI model or to obtain one that you can easily edit to your liking, you can’t go wrong with Hugging Face. This tutorial will walk you through how to get started.
AI Basics
Article Main Image

If you want a simple way to create your own AI model, or to obtain one that you can easily edit to your liking, you can’t go wrong with Hugging Face. With over 400,000 models, 75,000 datasets, and 150,000 demo applications on the website, you can get a hands-on experience of the future of AI for free.

But how easy is it to get started with Hugging Face if you’re looking to create an AI model for your business? We at Voiceflow have a concise guide for those that want to get started ASAP.

Introduction to Hugging Face 

Hugging Face Logo

Hugging Face is a service that offers a transformers library designed for natural language processing (NLP) AI agents. Hugging Face also has an active online community known as the “Hugging Face Hub” that shares machine learning models, assets, and progress of their personal or professional work using Hugging Face.

The platform allows users to create AI widgets such as chatbots, text-to-speech (TTS) systems, virtual writing assistants, and other tools. Hugging Face is free for all users, with premium subscriptions starting at $9 per month for additional features and early access to new updates.

Getting Started with Hugging Face 

Hugging Face also has a Quickstart page available to users that are eager to start exploring Hugging Face’s fundamentals.

Here’s what you need to do to get a Hugging Face account:

  1. Visit this link: https://huggingface.co/
  2. Click on the “≡”, then click on “Sign Up”.
  3. Enter your email and proposed password, then click on “Next”.
  4. Enter your details on the next page, then click “Create Account”.

Once your account is online, you’re free to create models, spaces, and datasets as well as access community assets.

Setting Up Your Environment for Hugging Face

It’s necessary to download additional tools for Hugging Face so you have the means to properly create and edit AI models. At the minimum, you’ll need Python, Pip, and Hugging Face libraries. Here’s the tutorial for how to start setting up your environment:

  1. Visit this link: https://www.python.org/downloads/
  2. Click on the “Download Python [version number]” button.
  3. Open the newly downloaded file.
  4. Open a terminal or command prompt program on your computer. Windows users can do this by typing Ctrl+Shift+P. Mac users can press the cloverleaf key and Space together, then type “terminal” in the search bar.
  5. Copy and paste “pip install transformers” into the text box and press Enter or Return.
  6. Copy and paste “pip install tokenizers, datasets” into the text box and press Enter or Return.

From this point, you’ll also need a code editor or integrated development environment (IDE). Visual Studio Code, Brackets, and Espresso are a few free programs you can download.

Using Google Colab for Hugging Face 

The Google Colab notebook is one of the quickest alternatives to set up Hugging Face on the web. The service is free so long as you’re using a small workload. Click here to read an introduction to Google Colab.

Here’s how to use your Google Collab notebook with Hugging Face:

  1. Visit this link: http://colab.research.google.com/#create=true
  2. Rename the “Untitled0.ipynb” file name.
  3. Copy and paste “!pip install transformers” into the text box.
  4. Press the play button.
  5. Copy and paste “import transformers” into the text box.
  6. Press the play button.
  7. Copy and paste “!pip install transformers[sentencepiece]” into the text box.
  8. Press the play button.

What these steps do is install the Python language and Transformers (Hugging Face libraries), with features you need to train your AI model.

Fine-Tuning Models with Hugging Face

There are nearly 500,000 models available to Hugging Face users for free. Each model can be downloaded and modified to better suit the particular user’s needs without needing to start from scratch.

On the Hugging Face website, you can search for models on any page you can use, or you can click on this link as a shortcut. When you go to a model’s page, there should be a black “Use this model” button that will reveal code you can copy and paste into your code editor, and this is how the model can be installed and available for you to use. If no black button is present, look around the model’s description for links or instructions on how to download it.

Deploying Models with Hugging Face

For some models, there’s an easy way to deploy right on the model’s page on the Hugging Face website. Machine learning (ML) services where you can deploy the model to include:

Hugging Face has tutorials for how to deploy to most ML services, such as Sagemaker. Inference API and Inference Endpoints are also created and maintained by Hugging Face itself.

Integrating Hugging Face with Other Tools

Hugging Face’s models and libraries can be integrated easily with other NLP libraries and frameworks, adding depth and usefulness to your applications. Some of these third-party resources include spaCy, The Natural Language Toolkit (NLTK), Gensim, TensorFlow, and PyTorch.

Hugging Face has a walkthrough for how to integrate any framework with the Hugging Face Hub.

Check out this 20-minute tutorial for how you can use Hugging Face to create a text-to-image chatbot with Voiceflow — it's free!

This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.

Start building AI Agents

Want to explore how Voiceflow can be a valuable resource for you? Let's talk.

ghraphic