Deploy Hugging Face Packages

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

You can deploy Hugging Face models and datasets to Artifactory repositories. Artifactory supports datasets as of version 7.90.x.

Deployed Hugging Face packages must follow Hugging Face naming restrictions. For more information, see Hugging Face Limitations in Artifactory.

To deploy a Hugging Face model or dataset:

Run the following command:

from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
    folder_path="<FOLDER_NAME>", 
    repo_id="<PACKAGE_NAME>", 
    revision="<REVISION_ID>", 
    repo_type="<REPO_TYPE>"
)

Where:

  • <FOLDER_NAME>: The name of the folder on your local machine where the model or dataset resides

  • <PACKAGE_NAME>: The name of the model or dataset, formatted according to Hugging Face repository naming structure organization/name

  • <REVISION_ID>: The revision ID of the package, corresponding to a Git commit hash

  • <REPO_TYPE>: The type of Hugging Face repository, either model or dataset

For example:

from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
    folder_path="vit-base-patch16-224", 
    repo_id="nsi319/legal-pegasus",    
    revision="54ef2872d33bbff28eb09544bdecbf6699f5b0b8",
    repo_type="model"
)

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.