Skip to main content

Import a Dataset from Hugging Face

Import datasets directly from Hugging Face and convert them into conversation format using custom templates. This is perfect for leveraging popular datasets like GSM8K and other community datasets.
1

Create a Dataset and Select Import from Hugging Face

Click the + Create Dataset button in the top-right corner of the page, then in the dataset creation modal, select Import from Hugging Face to import a dataset using custom templates.Select Import from Hugging Face option in dataset creation modal
2

Step 1: Configure Dataset and Hugging Face Source

  • Dataset Name: Enter a descriptive name for your imported dataset (e.g., “gsm8k”).
  • Dataset URL or ID: Enter the Hugging Face dataset identifier in the format username/dataset-name (e.g., openai/gsm8k).
  • API Key (Optional): Only required if the dataset is private. Get your API key from Hugging Face settings.
Configure dataset name and Hugging Face dataset URL or ID
You can find datasets on Hugging Face Datasets. The dataset ID is shown in the URL or at the top of the dataset page.
3

Step 2: Select Subset and Split

After the system finds your dataset, you’ll see:
  • Available Columns: All columns present in the dataset
  • Rows Count: Total number of rows in each split
Configure the import:
  • Subset (Config): Select which subset or configuration to import (e.g., “main”).
  • Split: Choose which split to import (e.g., “train”, “test”, “validation”) and see the row count for each.
Select subset and split with available columns and row counts
For datasets like GSM8K, the “main” config with the “train” split typically contains the most data. Review the available splits to choose the one that fits your needs.
4

Step 3: Define Conversation Templates

Map your dataset columns to conversation format using template placeholders:
  • User Prompt Template: Define how user messages are generated using {{column_name}} placeholders.
    • Type {{ to see column suggestions, or click column badges to insert them.
    • Example: {{question}} for a question-answer dataset.
  • Assistant Response Template: Define how assistant responses are generated using {{column_name}} placeholders.
    • Example: {{answer}} for a question-answer dataset.
  • Preview: See a live preview of how your datapoints will look with the current templates.
Define user prompt and assistant response templates with preview
The preview shows exactly how your imported data will be formatted. Make sure the templates correctly map to your dataset structure before proceeding.
5

Complete Import

Review your configuration and click Import to create your dataset. The import process will convert the Hugging Face dataset into Prem’s conversation format using your templates.

Example: Importing GSM8K

The GSM8K dataset is a popular dataset for mathematical reasoning. To import it:
  1. Dataset ID: openai/gsm8k
  2. Subset: main
  3. Split: train (contains 7,473 examples)
  4. User Template: {{question}}
  5. Assistant Template: {{answer}}
This will create a dataset where each mathematical question becomes a user message and the corresponding solution becomes the assistant response.

Next Steps

Create a Snapshot

Create a snapshot of your dataset to save your current state.

Enrich a Dataset

Start a data augmentation job to add synthetic data to your dataset.

Autosplit a Dataset

Automatically split your dataset into training, validation, and test sets.

Fine-Tune a Model

Fine-tune a model on your dataset.