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 the src/models.ts
file and add the 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.
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