Working with Hugging Face

Pixeltable provides seamless integration with Hugging Face datasets and models.

Providers · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it covers

  • Importing datasets directly into Pixeltable tables
  • Working with dataset splits (train/test/validation)
  • Streaming large datasets with IterableDataset
  • Type mappings from Hugging Face to Pixeltable
  • Using Hugging Face models for embeddings

What it uses

Install
terminal
pip install pixeltable datasets torch transformers sentence-transformers
Pixeltable calls
pxt.create_table()group_by()insert()add_embedding_index()similarity()

A look at the code

working-with-hugging-face.ipynb
from pixeltable.functions.huggingface import clip
# Add CLIP embedding index for cross-modal image search
images.add_embedding_index(
'Image', embedding=clip.using(model_id='openai/clip-vit-base-patch32')
)
# Search images using text
sim = images.Image.similarity(string='anime character with red clothes')
images.order_by(sim, asc=False).limit(3).select(
images.Image, images.Name, sim=sim
).collect()

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103