EDEN / scripts /push_to_hub.py
Rybib's picture
Upload EDEN model and code
0865fcf verified
Raw
History Blame Contribute Delete
1.4 kB
#!/usr/bin/env python3
"""Upload the EDEN repository to the Hugging Face Hub.
Prerequisites:
pip install huggingface_hub
huggingface-cli login
Usage:
python scripts/push_to_hub.py --repo-id Rybib/EDEN
This uploads the model files and code while skipping the local training
workspace, caches, and git metadata.
"""
from __future__ import annotations
import argparse
from pathlib import Path
from huggingface_hub import HfApi, create_repo
REPO_ROOT = Path(__file__).resolve().parent.parent
IGNORE = [
"eden_system/*",
"_hf_export_tmp/*",
"**/__pycache__/*",
"*.pyc",
".git/*",
"*.tmp",
".DS_Store",
]
def main() -> None:
parser = argparse.ArgumentParser(description="Push EDEN to the Hugging Face Hub.")
parser.add_argument("--repo-id", required=True, help="Target repo, e.g. Rybib/EDEN")
parser.add_argument("--private", action="store_true", help="Create the repo as private.")
args = parser.parse_args()
create_repo(args.repo_id, repo_type="model", private=args.private, exist_ok=True)
api = HfApi()
api.upload_folder(
folder_path=str(REPO_ROOT),
repo_id=args.repo_id,
repo_type="model",
ignore_patterns=IGNORE,
commit_message="Upload EDEN model and code",
)
print(f"Done. View your model at https://huggingface.co/{args.repo_id}")
if __name__ == "__main__":
main()