Upload processed_dataset_downloader.py with huggingface_hub
Browse files
processed_dataset_downloader.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
base_url = "https://huggingface.co/datasets/aoxo/asr_malayalam/resolve/main/processed_dataset/batch_{}/{}"
|
| 5 |
+
local_directory = "processed_dataset"
|
| 6 |
+
|
| 7 |
+
os.makedirs(local_directory, exist_ok=True)
|
| 8 |
+
|
| 9 |
+
for batch_num in range(0, 47):
|
| 10 |
+
batch_dir = os.path.join(local_directory, f"batch_{batch_num}")
|
| 11 |
+
os.makedirs(batch_dir, exist_ok=True)
|
| 12 |
+
|
| 13 |
+
file_names = [
|
| 14 |
+
"data-00000-of-00001.arrow",
|
| 15 |
+
"data-00000-of-00002.arrow",
|
| 16 |
+
"data-00001-of-00002.arrow",
|
| 17 |
+
"dataset_info.json",
|
| 18 |
+
"state.json"
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
for file_name in file_names:
|
| 22 |
+
file_url = base_url.format(batch_num, file_name)
|
| 23 |
+
file_path = os.path.join(batch_dir, file_name)
|
| 24 |
+
|
| 25 |
+
response = requests.get(file_url)
|
| 26 |
+
with open(file_path, "wb") as file:
|
| 27 |
+
file.write(response.content)
|
| 28 |
+
|
| 29 |
+
print(f"Downloaded: {file_path}")
|