CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
huggingface

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: huggingface/notebooks
Path: blob/main/course/en/chapter10/section3.ipynb
Views: 2555
Kernel: Unknown Kernel

Load your dataset to Argilla

!pip install argilla datasets
import argilla as rg HF_TOKEN = "..." # only for private spaces client = rg.Argilla( api_url="...", api_key="...", headers={"Authorization": f"Bearer {HF_TOKEN}"}, # only for private spaces )
from datasets import load_dataset data = load_dataset("SetFit/ag_news", split="train") data.features
{'text': Value(dtype='string', id=None), 'label': Value(dtype='int64', id=None), 'label_text': Value(dtype='string', id=None)}
settings = rg.Settings( fields=[rg.TextField(name="text")], questions=[ rg.LabelQuestion( name="label", title="Classify the text:", labels=data.unique("label_text") ), rg.SpanQuestion( name="entities", title="Highlight all the entities in the text:", labels=["PERSON", "ORG", "LOC", "EVENT"], field="text", ), ], )
dataset = rg.Dataset(name="ag_news", settings=settings) dataset.create()
dataset.records.log(data, mapping={"label_text": "label"})