Datasets:
Add push_to_hub.py
Browse files- push_to_hub.py +26 -0
push_to_hub.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import argparse
|
2 |
+
import datasets
|
3 |
+
|
4 |
+
|
5 |
+
def main():
|
6 |
+
parser = argparse.ArgumentParser()
|
7 |
+
parser.add_argument("--repo", type=str, required=True)
|
8 |
+
parser.add_argument("--revision", type=str, required=True)
|
9 |
+
args = parser.parse_args()
|
10 |
+
|
11 |
+
for config_name in ["all", "en", "es", "de", "fr"]:
|
12 |
+
dataset = datasets.load_dataset(
|
13 |
+
"./loader.py", config_name, trust_remote_code=True
|
14 |
+
)
|
15 |
+
dataset.push_to_hub(
|
16 |
+
args.repo,
|
17 |
+
config_name,
|
18 |
+
set_default=(config_name == "all"),
|
19 |
+
data_dir=f"parquet/{config_name}",
|
20 |
+
commit_message=f"Upload parquet/{config_name}",
|
21 |
+
revision=args.revision,
|
22 |
+
)
|
23 |
+
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
main()
|