Hugging Face

Deploy a model built with the Hugging Face transformers framework.
Hugging Face created Transformers, a library of pre-trained machine learning models. Baseten supports deploying transformers models created usingpipeline out of the box.
All you need to do first is install the Baseten client and create an API key.
Baseten officially supports transformers version 4.21.0 or higher. Especially if you're using an online notebook environment like Google Colab or a bundle of packages like Anaconda, ensure that the version you are using is supported. If it's not, use the --upgrade flag and pip will install the most recent version.

Deploying a Hugging Face model

Deploying a Hugging Face model is as simple as:
import baseten
baseten_model = baseten.deploy(
model_name='My Hugging Face model',
If you have already saved your model, just load it back into memory, test it to ensure it works, and deploy as in the above.

Example deployment

This code sample deploys a bert base uncased model built with a pipeline.
import baseten
from transformers import pipeline
model = pipeline('fill-mask', model='bert-base-uncased')
baseten.login("*** INSERT API KEY ***") #
baseten_model = baseten.deploy(
model_name='bert base uncased',