What is Hugging Face – A Beginner’s Guide

What is Hugging Face A Beginners Guide
Hugging Face is a community and a platform for artificial intelligence and data science that aims to democratize AI knowledge and assets used in AI models.

As the world now is starting to use AI technologies, advancements on AI must take place, yet no body can do that alone, so the open-source community is starting to expand to the realm of AI.

Hugging Face enables AI and data science professionals to communicate with each other with a tool that is specially curated for them, that is not only a mere social media platform but also a hub that makes publishing datasets and AI models, both un trained and pretrained, easier.

Basics of Hugging Face – Signing up, Models, Spaces, and Your Repo

Hugging Face’s homepage is pretty easy to navigate, hitting the upper-right button – the sign-up button – will redirect you to the sign-up page; it is pretty similar to most of sign-up pages on many websites.

You should provide an email address and a password, however there is no Google signing up option.

word image 13458 1

Now there will be a follow-up page that asks you to fill additional information, like your user’s name and your full name along with an Avatar (profile photo). Optionally you can add links to your GitHub, Twitter and website. Also, you can add your research interests.

Now you should read the ToS and Code of Conduct of Hugging Face and tick the checkbox, then hit create an account.

word image 13458 2

After hitting Create an account button, you’ll be asked to confirm your email address, which is pretty much the same as the standard authentication procedure.

Now you’ll be able to create models or datasets, from both the website or from Hugging Face CLI – which is a Python library that makes you able to login to your account from the command line. To download any repository you should have git and git-lfs commands in your machine.

In your home page you’ll be able to see many useful things, like:

  1. Your activity: your models, datasets, spaces, community, …
  2. Trending models, datasets, and spaces.
  3. Your settings, and resources.
  4. A search form, some categories, and your avatar – under which you can access many things – at the top of your screen.

word image 13458 3

Creating a Model

To create a new model from the website, you’ll find that after clicking on your avatar – on the upper-right corner of the site, you should name your model and provide a license for your model.

word image 13458 4

Then you can create a card for your model, if you ever used GitHub, the card is like the readme of your model. You can also you can add files to your model.

In the files and versions (yes, Hugging Face supports versioning) tab, you can add files of your model.

For example, this is the page of a popular model, the model page is divided into segments:

  1. Model title and tags.
  2. This area has many tabs, the default is the model card, the second one for files and versioning.
  3. Here the number of downloads show-up in a nice graph.
  4. An API to test the model on the fly.
  5. Datasets used to train the model.
  6. Communities using the model.

word image 13458 5

Datasets

The process of creating a dataset is somewhat similar to creating a model.

You’ll find the dataset page looks like the model’s page.

The only difference is that in datasets there is more metadata, like the image bellow, also in the dataset card you can add a section showing examples of the dataset, and its features.

word image 13458 6

Spaces

Spaces are machine learning applications or demos to showcase your work. You can create your space thorough a process similar to creating models and datasets.

There is special libraries and frameworks that help you create and host your space on Hugging face like streamlit and gradio. You can also you can code your application from scratch using the static option.

Hugging Face Spaces are pretty useful, some of them are very fun to play with, just go to spaces from the upper bar and explore the trending spaces.

Preview of Hugging Face Spaces
Preview of Hugging Face Spaces

Besides your own activity – models, datasets, and spaces; you can navigate Hugging Face’s community models, datasets and spaces, also, you can search for a specific thing from the search form in the upper part of the website.

Most of Hugging Face assets are about either NLP or Computer Vision written in PyTorch, yet you can find almost all common AI models in Hugging Face.

You can find trending Models/Datasets/Spaces in the left area of the main page, or by clicking for example models from the top bar.

word image 13458 7

Tasks

Suppose you want to start a new ML model, instead of starting from scratch; you may find a model that is similar, but searching thousands of models and datasets is frustrating.

Tasks makes the process of finding a suitable model for your application easier, either looking for a base for it, or just looking for inspiration.

For example, if I chose Image segmentation, I’ll find a description and a demo showing an output for your input in this case it is an image.

 

Using CLI of Hugging Face

Downloading

If you want to download an entire repository from GitHub you can achieve that by downloading the repo as a zip file, or through git command, you can use git with Hugging Face also! For example to download this model; use the command:

git clone https://huggingface.co/Jean-Baptiste/camembert-ner

Accessing Your Account 

You can access your account using huggingface_hub Python library. From there you can essentially do what we’ve been doing all along the post, like adding or editing you models. This is done through a notebook. To log into your account using huggingface_hub you can run the following lines of code in your Python notebook:

from huggingface_hub import notebook_login

notebook_login()

Go to your settings under your profile photo, then go to the Access Tokens, and create a new token with write access, copy the token and paste it here.

word image 13458 9

Once you login you can create models, and push them directly to your profile.

Conclusion

In this article we’ve discussed the basics of Hugging Face, and we walked through the website main sections, as well as how to download using git, and how to login using huggingface_hub library. If you encountered any issues or have any questions, please feel free to leave a comment and we’ll get back to you as soon as possible.

 

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

0 Comments
Inline Feedbacks
View all comments
You May Also Like