Hugging Face Datasets

Lavorare con Hugging Face

Jacob H. Marquez

Lead Data Engineer

Hugging Face Datasets 1

1 https://huggingface.co/datasets
Lavorare con Hugging Face

Hugging Face Datasets 2

1 https://huggingface.co/datasets
Lavorare con Hugging Face
Lavorare con Hugging Face
Lavorare con Hugging Face
Lavorare con Hugging Face

Installare il pacchetto Datasets

 

pip install datasets

  • 🌐 Accedi a
  • 📥 Scarica
  • 🔧 Usa
  • 🤝 Condividi

Dataset di Hugging Face

1 https://huggingface.co/docs/datasets/loading
Lavorare con Hugging Face

Scaricare un dataset

from datasets import load_dataset

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

$$

Parametro split

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

Formati dataset Apache Arrow

 

Dataset Apache Arrow

1 https://arrow.apache.org/overview/
Lavorare con Hugging Face

Manipolazione dati

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


# Filtra il 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
Lavorare con Hugging Face

Manipolazione dati

# Seleziona le prime due righe
sliced = filtered.select(range(2))


stampa(sliced)
Dataset({features: ['text'], num_rows: 2})
# Estrai 'text' della prima riga
print(sliced[0]['text'])
Concentrazioni atmosferiche di PCDD/PCDF...
1 https://huggingface.co/docs/datasets/process#select-and-filter
Lavorare con Hugging Face

¡Vamos a practicar!

Lavorare con Hugging Face

Preparing Video For Download...