In January 2025, Hugging Face announced Inference Providers, a new feature that allows you to run models on Replicate (and other providers) right from the Hugging Face website.
This repo contains a mapping of Replicate models to Hugging Face models, so we can tell Hugging Face when to display a Replicate inference widget on its model pages.
This repo also includes tooling to keep those mappings up to date using Hugging Face's Model Mappings API.
To add a new model mapping, edit src/models.ts
Add your new model to the inferenceModels
array, like so:
{
hfModel: "black-forest-labs/FLUX.1-schnell", // Hugging Face model name
providerModel: "black-forest-labs/flux-schnell", // Replicate model name
task: "text-to-image", // Task name
}
To see allowable values for task
, refer to huggingface.co/tasks.
To add a new tag mapping, edit src/tags.ts
Add your new tag to the inferenceTags
array, like so:
{
type: 'tag-filter',
task: 'text-to-image',
tags: ['flux', 'lora'],
providerModel: 'black-forest-labs/flux-dev-lora',
adapterType: 'lora',
status: 'live',
}
Tag mappings allow you to map multiple Hugging Face models to a single Replicate model based on their tags. This is useful when you have a single Replicate model that can handle multiple variations of a model (like different LoRA adapters).
This repo uses a GitHub Actions workflow to keep the model mappings up to date, as well as model warm/cold states.
The workflow runs on a schedule and is triggered on every push to the main branch, so you probably don't need to do anything!.
But if you need to run the sync manually, here's how:
- Make sure your user is a member of the replicate organization on Hugging Face.
- Create a Hugging Face token. It doesn't need to have any specific permissions.
- Set the
HF_TOKEN
environment variable.export HF_TOKEN=<your-huggingface-token>
- Run this command:
npm install npm start
This repo includes scripts to list available providers and their model mappings.
To see all available inference providers:
npm run list-providers
This will output a JSON array of provider IDs, like:
[
"cerebras",
"cohere",
"fal-ai",
"fireworks",
"hyperbolic",
"hf-inference",
"nebius",
"novita",
"replicate",
"sambanova",
"together"
]
To see the model mappings for a specific provider:
npm run list-provider-mappings -- <provider-id>
For example, to see Replicate's mappings:
npm run list-provider-mappings -- replicate
This will output a JSON object containing all model mappings for the specified provider, organized by task type.
Note: You'll need to set the HF_TOKEN
environment variable to use these scripts:
export HF_TOKEN=<your-huggingface-token>