PyCharm 2024.2 Help

Hugging Face

Hugging Face is a machine learning and data science platform. It provides open-source tools and libraries for training, fine-tuning, and deploying machine learning models. The platform also hosts a repository of pre-trained models and datasets contributed by the community.

Use Hugging Face models

PyCharm allows you to browse and download Hugging Face models right in the IDE:

  1. Right-click in the editor to open the context menu and select Insert HF Model.

    Explore Models from Hugging Face dialog opens.

    Explore Hugging Face models
  2. Find a model that meets your criteria:

    • Use the search field to find the model by name

    • Select the task you need the model to perform in the left pane of the dialog

    • Sort the models by likes, downloads, creation date, or latest modification date

    • Filter the models by license or tags

  3. Select the model and click Use Model to insert a code snippet into the editor.

    Use Hugging Face model

If the Hugging Face platform currently does not provide a code snippet for the selected model, the Use Model button will become inactive, and you will see the following message when you hover over the button:

Model usage template is currently not available. To explore other integration options, please visit the model's page on the Hugging Face website.

View model and dataset cards

You can view detailed information about the models and datasets without leaving PyCharm:

  • To view the model or dataset card in a popup, hover over the model or dataset name.

    View model or dataset cards in a popup
  • To open the card in the Documentation tool window, click in the popup and choose Open in Documentation Tool Window or press Ctrl+Q twice.

    The Documentation tool window will open on the right side of the IDE.

    View model or dataset cards in tool window

Hugging Face tool window

When you download a Hugging Face entity, the processing scripts and data are stored locally on your computer. Use the Hugging Face tool window to manage the local cache:

  • Check which models, datasets and spaces have been downloaded.

  • Remove selected items from the cache.

  • Open any item within the cache in a file browser.

  • Copy paths to items.

Hugging Face tool window opened

Left toolbar

Item

Tooltip

Description

Refresh Cache List

Click this button to check and reload caches.

Delete from Cache

Click this button to remove a selected item from the local cache.

Reveal in Finder

Click this button to open the file manager and view the file.

Context menu

Item

Description

Delete from Cache

Choose this command to remove a selected item from the local cache.

Copy the Path to Clipboard

Choose this command to copy the file path of a selected item to the system clipboard.

Last modified: 26 October 2024