Celestis-RL / scripts /upload_huggingface.py
PureOne's picture
Release Celestis-RL v2.0.0: audited research reference
f95cbd4 verified
Raw History Blame Contribute Delete
1.71 kB
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()