File size: 1,712 Bytes
f95cbd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
import argparse
import getpass
import json
import os
from pathlib import Path
from celestis_rl.release import publish_release


def main():
    p = argparse.ArgumentParser(description="Default is offline dry run. Publication creates a NEW HF dataset repository.")
    p.add_argument("--repo-id", required=True, help="Your HF namespace/Celestis-RL")
    p.add_argument("--root", default=str(Path(__file__).resolve().parents[1]))
    p.add_argument("--publish", action="store_true", help="Perform authenticated remote publication")
    p.add_argument("--public", action="store_true", help="Explicitly create a public repository")
    p.add_argument("--prompt-token", action="store_true", help="Read a write token invisibly; do not save it")
    p.add_argument("--paste-token", action="store_true", help="Read a write token visibly from stdin so clipboard paste works; do not save it")
    args = p.parse_args()
    if args.prompt_token and args.paste_token:
        p.error("choose either --prompt-token or --paste-token, not both")

    token = os.environ.get("HF_TOKEN") if args.publish else None
    if args.publish and not token:
        if args.paste_token:
            print("Paste your Hugging Face WRITE token below and press Enter.")
            print("The token is visible so clipboard paste works reliably; it is not saved by this script.")
            token = input("HF write token: ").strip()
        elif args.prompt_token:
            token = getpass.getpass("Hugging Face write token (hidden, not saved): ")

    result = publish_release(args.root, args.repo_id, publish=args.publish, public=args.public, token=token)
    print(json.dumps(result, indent=2))


if __name__ == "__main__":
    main()