Import data from Hugging Face datasets

Load datasets from Hugging Face Hub into Pixeltable tables for processing with AI models.

Data Import/Export · 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.

How it works

You use pxt.create_table() with a Hugging Face dataset as the source parameter. Pixeltable automatically maps HF types to Pixeltable column types.

What it covers

  • Import Hugging Face datasets directly into tables
  • Handle datasets with multiple splits (train/test/validation)
  • Work with image datasets

What it uses

Install
terminal
pip install pixeltable datasets
Pixeltable calls
pxt.create_table()add_computed_column()

A look at the code

data-import-huggingface.ipynb
# Import each split separately for clarity
train_data = pxt.create_table(
'hf_demo/reviews_train', source=hf_dataset_dict['train']
)
test_data = pxt.create_table(
'hf_demo/reviews_test', source=hf_dataset_dict['test']
)

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

Browse all 103