"""Upload the sharded checkpoint folder to zhifeixie/Mini-Omni3.""" import argparse from pathlib import Path from huggingface_hub import HfApi, login def main(): ap = argparse.ArgumentParser() ap.add_argument("--folder", default="/Users/yansc-xzf/Desktop/工作/Mini-Omni3/github/omni3/Mini-Omni3/checkpoints") ap.add_argument("--repo-id", default="zhifeixie/Mini-Omni3") ap.add_argument("--path-in-repo", default=".", help="Subdirectory inside the repo. Use '.' to upload at repo root.") ap.add_argument("--private", action="store_false") ap.add_argument("--token", default=None, help="HF token. If omitted, uses cached login (`huggingface-cli login`).") args = ap.parse_args() if args.token: login(token=args.token) api = HfApi() api.create_repo(repo_id=args.repo_id, repo_type="model", private=args.private, exist_ok=True) folder = Path(args.folder) if not folder.is_dir(): raise SystemExit(f"Not a directory: {folder}") print(f"Uploading {folder} → {args.repo_id}:{args.path_in_repo}") # upload_large_folder is designed for multi-GB folders: parallel chunked # uploads with automatic resume on interruption. api.upload_large_folder( repo_id=args.repo_id, repo_type="model", folder_path=str(folder), # path_in_repo is not directly supported by upload_large_folder; # we emulate it via allow_patterns if needed. The simplest path is # to upload the folder as-is at the repo root, OR to rename your # local folder to match the desired in-repo name. ) print("Done. Check: https://huggingface.co/" + args.repo_id) if __name__ == "__main__": main()