Datasets:
License:
Commit
•
f4ba966
1
Parent(s):
5142129
update to public
Browse files- extract_climateset.py +10 -13
extract_climateset.py
CHANGED
@@ -4,36 +4,33 @@ from glob import glob
|
|
4 |
import os
|
5 |
|
6 |
# Path of the directory where the data will be downloaded in your local machine
|
7 |
-
local_directory = '
|
8 |
-
|
9 |
-
# TODO : Token to access the private repository, delete when the repository will be public
|
10 |
-
access_token = "ACCESS_TOKEN"
|
11 |
|
12 |
repo_id = "climateset/causalpaca"
|
13 |
repo_type = "dataset"
|
14 |
|
15 |
-
#
|
16 |
|
17 |
print("Downloading the ClimateSet HuggingFace Repository...")
|
18 |
-
|
19 |
print("Done.")
|
20 |
|
21 |
print("Extracting the compressed input data...")
|
22 |
input_files = glob(local_directory + "/inputs/*.tar.gz")
|
23 |
for input_file in input_files:
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
os.remove(input_file)
|
28 |
print("Done.")
|
29 |
|
30 |
print("Extracting the compressed output data...")
|
31 |
output_files = glob(local_directory + "/outputs/*.tar.gz")
|
32 |
for output_file in output_files:
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
os.remove(output_file)
|
37 |
print("Done.")
|
38 |
|
39 |
-
print("Done. Finished downloading and extracting the Climateset data! :)")
|
|
|
4 |
import os
|
5 |
|
6 |
# Path of the directory where the data will be downloaded in your local machine
|
7 |
+
local_directory = os.path.join(os.getcwd(), 'Climateset_DATA')
|
|
|
|
|
|
|
8 |
|
9 |
repo_id = "climateset/causalpaca"
|
10 |
repo_type = "dataset"
|
11 |
|
12 |
+
#snapshot_download(...) function will download the entire dataset from the HuggingFace Repository. This takes while.
|
13 |
|
14 |
print("Downloading the ClimateSet HuggingFace Repository...")
|
15 |
+
snapshot_download(repo_id=repo_id, repo_type=repo_type, local_dir=local_directory, local_dir_use_symlinks=False)
|
16 |
print("Done.")
|
17 |
|
18 |
print("Extracting the compressed input data...")
|
19 |
input_files = glob(local_directory + "/inputs/*.tar.gz")
|
20 |
for input_file in input_files:
|
21 |
+
tar = tarfile.open(input_file)
|
22 |
+
tar.extractall(path=local_directory + "/inputs/")
|
23 |
+
tar.close()
|
24 |
os.remove(input_file)
|
25 |
print("Done.")
|
26 |
|
27 |
print("Extracting the compressed output data...")
|
28 |
output_files = glob(local_directory + "/outputs/*.tar.gz")
|
29 |
for output_file in output_files:
|
30 |
+
tar = tarfile.open(output_file)
|
31 |
+
tar.extractall(path=local_directory + "/outputs/")
|
32 |
+
tar.close()
|
33 |
os.remove(output_file)
|
34 |
print("Done.")
|
35 |
|
36 |
+
print("Done. Finished downloading and extracting the Climateset data! :)")
|