Import Models from Hugging Face

The Hugging Face model definition allows you to import models from a Hugging Face repository.

#Feature

Currently, Instill Model supports importing models tagged with the following tasks

#Release Stage

Alpha

#Configuration

FieldTypeNote
repo_id*stringA model repo name hosted on the Hugging Face model hub. Valid repo ids can be located at the root-level, or namespaced under a user or organization name, like google/vit-base-patch16-224

#Getting Started

#Requirements

  • A public Hugging Face model repository that is labelled with Image Classification task

#No-code Setup

To import a model from Hugging Face in the Console, do the following:

  1. Go to the Model page and click Add new model
  2. In the Set Up New Model page, fill an ID for your model, this will be the unique identifier of this model
  3. [Optional] Give a short description of your model in the Description field
  4. Click the Model source ▾ drop-down and choose Hugging Face
  5. Fill the Hugging Face model ID that stores the model files and click Set up
  6. Now go to the Model page, the corresponding model should be here. Note that it may take some time for the model to be deployed online.

#Low-code Setup

  1. Send a HTTP request to the Instill Model model-backend to import a model from Hugging Face.
cURL
Copy

curl -X POST http://localhost:8080/v1alpha/models -d '{
"id": "vit-base-patch16-224",
"model_definition": "model-definitions/huggingface",
"configuration": {
"repo_id": "google/vit-base-patch16-224"
}
}'

  1. Deploy the imported model vit-base-patch16-224.
cURL
Copy

curl -X POST http://localhost:8080/v1alpha/models/vit-base-patch16-224/deploy

  1. Perform an inference to test the model
cURL(url)
cURL(base64)
cURL(multipart)
Copy

curl -X POST http://localhost:8080/v1alpha/models/vit-base-patch16-224/test -d '{
"inputs": [
{
"image_url": "https://artifacts.instill.tech/imgs/dog.jpg"
}
]
}'

Last updated: 1/8/2024, 8:56:57 AM