Download split-audio-data.sh from znhoughton/TeleSpoof: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/znhoughton/TeleSpoof/resolve/main/split-audio-data.sh
- Command line
-
hf download hf://datasets/znhoughton/TeleSpoof/split-audio-data.sh
-
curl -L -o split-audio-data.sh https://huggingface.co/datasets/znhoughton/TeleSpoof/resolve/main/split-audio-data.sh
1.01 kB
| # Base dataset folder | |
| BASE_DIR="audio_data" | |
| CHUNK_SIZE=2000 # number of files per tar shard | |
| # Function to shard a split | |
| shard_split () { | |
| SPLIT=$1 | |
| echo "Sharding $SPLIT..." | |
| cd "$BASE_DIR/$SPLIT" || exit 1 | |
| # Create chunks with relative paths | |
| ls -1 | split -l $CHUNK_SIZE - "${SPLIT}_chunk_" | |
| # Loop over chunks and create tar.gz archives | |
| for chunk in ${SPLIT}_chunk_*; do | |
| shard_name="${SPLIT}_${chunk##*_}.tar.gz" | |
| # Only include files that exist (avoid empty tar) | |
| files=$(cat "$chunk") | |
| if [ -z "$files" ]; then | |
| echo "Skipping empty chunk $chunk" | |
| continue | |
| fi | |
| tar -czf "$shard_name" --no-recursion $files | |
| echo "Created $shard_name with $(wc -l < $chunk) files" | |
| # Remove the chunk file | |
| rm "$chunk" | |
| done | |
| cd - > /dev/null | |
| } | |
| # Shard all splits | |
| for split in train validation test; do | |
| shard_split "$split" | |
| done | |
| echo "All splits have been tarred successfully!" | |