ihanif commited on
Commit
b734054
·
verified ·
1 Parent(s): 683e223

Upload load_dataset_example.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. load_dataset_example.py +27 -0
load_dataset_example.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Example script showing how to load the Pashto Synthetic Speech dataset
3
+ """
4
+ from datasets import load_dataset
5
+
6
+ # Loading from local files
7
+ # Replace with your own path if testing locally
8
+ dataset = load_dataset("parquet", data_files={"train": "data/shard-00000-of-00001.parquet"})
9
+
10
+ # Loading from Hugging Face
11
+ # dataset = load_dataset("ihanif/pashto-synthetic-speech-3k")
12
+
13
+ # Access a few examples
14
+ for i in range(3):
15
+ example = dataset["train"][i]
16
+ print(f"Example {i}:")
17
+ print(f" Text: {example['text']}")
18
+ print(f" Speaker: {example['speaker']}")
19
+ print(f" Duration: {example['duration']:.2f}s")
20
+ print(f" Sampling rate: {example['sampling_rate']}")
21
+ print(f" Audio type: {type(example['audio'])}")
22
+ print(f" Audio keys: {example['audio'].keys() if isinstance(example['audio'], dict) else 'N/A'}")
23
+ print()
24
+
25
+ # Basic stats
26
+ print(f"Dataset size: {len(dataset['train'])} examples")
27
+ print(f"Features: {dataset['train'].features}")