Deploy Hugging Face Models and Datasets

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

Warning

For Artifactory versions earlier than 7.75.3, It is only possible to deploy lighter models to Hugging Face local repositories due to limitations in the implementation of the Hugging Face client.

This topic describes how to deploy Hugging Face models and datasets to an Artifactory repository. Artifactory supports resolving datasets starting from version 7.90.x.

To deploy models or datasets to Artifactory using the huggingface_hub library insert your folder name, name, and revision number into the following command and run it:

Note

Make sure to replace the placeholders in angle brackets (<>) with your own model/dataset source folder name, name, and unique identifier.

Warning

Deploying a model or dataset using the same UUID as a cached model/dataset will cause the new one to override and replace the previous one.

from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
    folder_path="<MODEL/DATASET_SOURCE_FOLDER_NAME>",         # Enter the name of the folder on your local machine where your model resides.
    repo_id="<MODEL/DATASET_NAME>",     # Enter the name of the model, following the Hugging Face repository naming structure 'organization/name'. (models--$<MODEL_NAME>)
    revision="<MODEL/DATASET_UUID>",                 # Enter a unique identifier for your model. We recommend using a git commit revision ID. (snapshots/$<REVISION_NAME>/...files)    
    repo_type="model"/"dataset"
)

For example:

from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
    folder_path="vit-base-patch16-224",         # Enter the name of the folder on your local machine where your model resides.folder to upload location on the FS
    repo_id="nsi319/legalpegasus",     # Enter the name of the model, following the Hugging Face repository naming structure 'organization/name'. (models--$<MODEL_NAME>)
    revision="54ef2872d33bbff28eb09544bdecbf6699f5b0b8",                 # Enter a unique identifier for your model. We recommend using a Git commit revision ID. (snapshots/$<REVISION_NAME>/...files)    
    repo_type="model"
)