zhurong2333 commited on
Commit
88d1bb3
·
verified ·
1 Parent(s): 78f2329

Upload wilds_downloader.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. wilds_downloader.py +40 -0
wilds_downloader.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ssl
2
+ import certifi
3
+ import urllib.request
4
+ from wilds import get_dataset
5
+
6
+ # Fix SSL certificate issues
7
+ ssl._create_default_https_context = ssl._create_unverified_context
8
+
9
+ # List of datasets to download
10
+ datasets_to_download = [
11
+ # "camelyon17",
12
+ "iwildcam",
13
+ # "fmow",
14
+ # "globalwheat",
15
+ # "rxrx1",
16
+ # "poverty" # Note: it's "poverty" not "povertymap" in the API
17
+ ]
18
+
19
+ root_dir = "/hdd/datasets/wilds"
20
+
21
+ print("Starting WILDS dataset downloads...")
22
+ print(f"Root directory: {root_dir}")
23
+ print(f"Datasets to download: {datasets_to_download}\n")
24
+
25
+ for dataset_name in datasets_to_download:
26
+ try:
27
+ print(f"\n{'='*60}")
28
+ print(f"Downloading {dataset_name}...")
29
+ print(f"{'='*60}")
30
+ dataset = get_dataset(dataset=dataset_name, root_dir=root_dir, download=True)
31
+ print(f"✓ Successfully downloaded {dataset_name}")
32
+ print(f" Dataset size: {len(dataset)} samples")
33
+ except Exception as e:
34
+ print(f"✗ Error downloading {dataset_name}: {str(e)}")
35
+ print(f" You may need to download this dataset manually from https://wilds.stanford.edu/downloads")
36
+ continue
37
+
38
+ print(f"\n{'='*60}")
39
+ print("Download process completed!")
40
+ print(f"{'='*60}")