For the complete documentation index, see llms.txt. This page is also available as Markdown.

Hugging Face

spinner

Prerequisites

  • Install the Hugging Face CLI (pip install -U huggingface_hub gives you the hf command).

ADDITIONAL INFORMATION

Depending on your environment, you may need to run addition command, go to Hugging Face installation for more information.

  • Access to a Harness account with permissions to create registries and generate identity tokens.


Create a Hugging Face artifact registry

Start by creating a new Hugging Face registry in your Harness project.

  1. Under Registries, click New Artifact Registry.

  2. Select Hugging Face as the registry type.

  3. Provide a Registry Name.

REGISTRY NAME CRITERIA

Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.

  1. (Optional) Add a Description and Labels.

  2. Choose visibility between Public and Private.

  3. Click Create Registry.

PRIVATE REGISTRY

This registry will serve as your private Hugging Face registry within Harness.


Configure client

Configure environment variables

  1. Set up environment variables to connect to Harness Artifact Registry.

CLIENT VERSION

For Hugging Face client version 0.19.0 and above, this timeout setting enables model resolution via pipelines and tokenizer libraries.

Configure authentication

  1. Click Generate token to generate an identity token.

  2. Copy the token.

  3. Set the token as an environment variable with the following command:

Deploy models and datasets

Upload a model to Artifact Registry using the huggingface_hub library:

Upload a dataset to Artifact Registry using the huggingface_hub library:

Resolve models and datasets

Download a model from Artifact Registry:

MODEL RESOLUTION

With Hugging Face client version 0.19.0+ and HF_HUB_ETAG_TIMEOUT set, you can resolve models with transformers, diffusers, and other libraries.

Artifact Registry supports resolving models using Hugging Face dataset libraries:

Or download an entire dataset repository using the snapshot_download API:

Troubleshooting

  • Slow downloads or timeouts. Increase HF_HUB_ETAG_TIMEOUT and HF_HUB_DOWNLOAD_TIMEOUT. Verify network egress to the Harness endpoint.

  • File too large. Ensure Git LFS is used automatically by the CLI; confirm the LFS filter in your repo and re-try the upload.

Last updated

Was this helpful?