File size: 864 Bytes
2ee7252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import requests

base_url = "https://huggingface.co/datasets/aoxo/asr_malayalam/resolve/main/processed_dataset/batch_{}/{}"
local_directory = "processed_dataset"

os.makedirs(local_directory, exist_ok=True)

for batch_num in range(0, 47):
    batch_dir = os.path.join(local_directory, f"batch_{batch_num}")
    os.makedirs(batch_dir, exist_ok=True)

    file_names = [
        "data-00000-of-00001.arrow",
        "data-00000-of-00002.arrow", 
        "data-00001-of-00002.arrow",
        "dataset_info.json",
        "state.json"
    ]

    for file_name in file_names:
        file_url = base_url.format(batch_num, file_name)
        file_path = os.path.join(batch_dir, file_name)

        response = requests.get(file_url)
        with open(file_path, "wb") as file:
            file.write(response.content)

        print(f"Downloaded: {file_path}")