skyzhou06 commited on
Commit
c5afa27
·
verified ·
1 Parent(s): 2061595

Delete scripts/upload_to_hf.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/upload_to_hf.py +0 -74
scripts/upload_to_hf.py DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env python3
2
- from __future__ import annotations
3
-
4
- import argparse
5
- import json
6
- import sys
7
- from pathlib import Path
8
-
9
- from huggingface_hub import HfApi
10
-
11
-
12
- CANONICAL_REPO_ID = "skyzhou06/LifeTextSingleTurnStreamingCoT"
13
-
14
-
15
- def main() -> None:
16
- parser = argparse.ArgumentParser()
17
- parser.add_argument("--repo-id", default=CANONICAL_REPO_ID)
18
- parser.add_argument("--folder", "--input-dir", dest="folder", default="life_streaming_cot_dataset")
19
- parser.add_argument("--version", default="v0.4.1")
20
- parser.add_argument("--private", action="store_true")
21
- args = parser.parse_args()
22
-
23
- folder = Path(args.folder)
24
- if not folder.exists():
25
- print(f"Dataset folder does not exist: {folder}", file=sys.stderr)
26
- sys.exit(1)
27
-
28
- info_path = folder / "dataset_info.json"
29
- if not info_path.exists():
30
- print(f"Missing dataset_info.json in {folder}", file=sys.stderr)
31
- sys.exit(1)
32
- info = json.loads(info_path.read_text(encoding="utf-8"))
33
- if info.get("version") != "v0.4.1":
34
- print("Refusing upload: dataset_info.json is not version v0.4.1.", file=sys.stderr)
35
- sys.exit(1)
36
- if info.get("repo_id") != CANONICAL_REPO_ID:
37
- print(f"Refusing upload: dataset_info.json repo_id is not {CANONICAL_REPO_ID}.", file=sys.stderr)
38
- sys.exit(1)
39
- if "v0.4.1" not in str(info.get("generation_method", "")):
40
- print("Refusing upload: generation_method does not contain v0.4.1.", file=sys.stderr)
41
- sys.exit(1)
42
- if args.repo_id != CANONICAL_REPO_ID:
43
- print(f"Refusing upload: target repo must be {CANONICAL_REPO_ID}.", file=sys.stderr)
44
- sys.exit(1)
45
-
46
- api = HfApi()
47
- try:
48
- api.whoami()
49
- except Exception: # noqa: BLE001 - do not print auth internals or tokens
50
- print("Hugging Face authentication is missing or invalid.")
51
- print("Run this command, then rerun the upload:")
52
- print("huggingface-cli login")
53
- sys.exit(2)
54
-
55
- api.create_repo(repo_id=args.repo_id, repo_type="dataset", private=args.private, exist_ok=True)
56
- api.upload_folder(
57
- repo_id=args.repo_id,
58
- repo_type="dataset",
59
- folder_path=str(folder),
60
- path_in_repo=".",
61
- commit_message="Update LifeTextSingleTurnStreamingCoT to v0.4.1 loading config and HQ subset patch",
62
- ignore_patterns=[
63
- ".DS_Store",
64
- "*/.DS_Store",
65
- "__pycache__",
66
- "*/__pycache__/*",
67
- "*.pyc",
68
- ],
69
- )
70
- print(f"https://huggingface.co/datasets/{args.repo_id}")
71
-
72
-
73
- if __name__ == "__main__":
74
- main()