Hugging Face Datasets

Working with Hugging Face

Jacob H. Marquez

Lead Data Engineer

hf_datasets1.jpg

1 https://huggingface.co/datasets
Working with Hugging Face

hf_datasets2.jpg

1 https://huggingface.co/datasets
Working with Hugging Face
Working with Hugging Face
Working with Hugging Face
Working with Hugging Face

Instalace balíčku Datasets

 

pip install datasets

  • 🌐 Přístup k
  • 📥 Stahování
  • 🔧 Použití
  • 🤝 Sdílení

hf_datasets.jpg

1 https://huggingface.co/docs/datasets/loading
Working with Hugging Face

Stažení datové sady

from datasets import load_dataset

data = load_dataset("IVN-RIN/BioBERT_Italian")

$$

Parametr split

data = load_dataset("IVN-RIN/BioBERT_Italian", split="train")
1 https://huggingface.co/docs/datasets/v2.15.0/loading
Working with Hugging Face

Formáty datových sad Apache Arrow

 

Datová sada Apache Arrow

1 https://arrow.apache.org/overview/
Working with Hugging Face

Manipulace s daty

data = load_dataset("IVN-RIN/BioBERT_Italian", split="train")


# Filter for pattern " bella " filtered = data.filter(lambda row: " bella " in row['text']) print(filtered)
Dataset({
    features: ['text'],
    num_rows: 1122
})
1 https://huggingface.co/docs/datasets/process#select-and-filter
Working with Hugging Face

Manipulace s daty

# Select the first two rows
sliced = filtered.select(range(2))


print(sliced)
Dataset({features: ['text'], num_rows: 2})
# Extract the 'text' for the first row
print(sliced[0]['text'])
Concentrazioni atmosferiche di PCDD/PCDF...
1 https://huggingface.co/docs/datasets/process#select-and-filter
Working with Hugging Face

Pojďme si procvičit!

Working with Hugging Face

Preparing Video For Download...