Datasets:
Upload load_script.py with huggingface_hub
Browse files- load_script.py +35 -0
load_script.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import load_dataset
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
# Path to your new parquet directory
|
| 5 |
+
parquet_dir = "/opt/gpfs/home/leying/data/data/DeepASMR_dataset/parquet"
|
| 6 |
+
|
| 7 |
+
print("Loading dataset from sharded Parquet files...")
|
| 8 |
+
# We use a wildcard to load all shards at once
|
| 9 |
+
dataset = load_dataset("parquet", data_files=f"{parquet_dir}/*.parquet", split="train")
|
| 10 |
+
|
| 11 |
+
print(f"Dataset loaded successfully!")
|
| 12 |
+
print(f"Total number of utterances: {len(dataset)}")
|
| 13 |
+
|
| 14 |
+
# --- Test a random sample ---
|
| 15 |
+
sample_idx = 0
|
| 16 |
+
sample = dataset[sample_idx]
|
| 17 |
+
|
| 18 |
+
print("\n--- Sample Check ---")
|
| 19 |
+
print(f"Transcript: {sample['transcript']}")
|
| 20 |
+
print(f"Speaker ID: {sample['speaker_id']}")
|
| 21 |
+
print(f"Language: {sample['language']}")
|
| 22 |
+
|
| 23 |
+
# This part tests if the audio bytes actually decode into a waveform
|
| 24 |
+
audio_array = sample['audio']['array']
|
| 25 |
+
sampling_rate = sample['audio']['sampling_rate']
|
| 26 |
+
|
| 27 |
+
print(f"Audio Shape: {audio_array.shape}")
|
| 28 |
+
print(f"Sampling Rate: {sampling_rate} Hz")
|
| 29 |
+
print(f"Duration: {len(audio_array) / sampling_rate:.2f} seconds")
|
| 30 |
+
|
| 31 |
+
# Optional: Check if the data is non-zero (proves it's not just silence/empty)
|
| 32 |
+
if np.abs(audio_array).max() > 0:
|
| 33 |
+
print("Status: Audio data is valid and non-silent.")
|
| 34 |
+
else:
|
| 35 |
+
print("Status: Warning - Audio data appears to be empty/silent.")oooo rclone size deepasmr:deepasmr-transfer-2026/DeepASMR-DB
|