Time-Series-Library / upload_to_hf.py
lwaekfjlk's picture
Upload Time-Series-Library
f9d3aeb verified
#!/usr/bin/env python3
"""
Upload Time-Series-Library to HuggingFace Hub.
"""
from huggingface_hub import HfApi, create_repo
import os
# Configuration
REPO_NAME = "Time-Series-Library" # Change to your desired repo name
USERNAME = "lwaekfjlk" # Change to your HuggingFace username
REPO_TYPE = "model" # or "dataset" or "space"
PRIVATE = False # Set to True for private repo
# Files/folders to exclude from upload
IGNORE_PATTERNS = [
"*.pyc",
"__pycache__",
".git",
".gitignore",
"checkpoints/*", # Large checkpoint files
"*.pt",
"*.pth",
"*.ckpt",
".DS_Store",
]
def main():
api = HfApi()
repo_id = f"{USERNAME}/{REPO_NAME}"
# Create the repo (if it doesn't exist)
print(f"Creating repo: {repo_id}")
try:
create_repo(
repo_id=repo_id,
repo_type=REPO_TYPE,
private=PRIVATE,
exist_ok=True,
)
print(f"✅ Repo created/exists: https://huggingface.co/{repo_id}")
except Exception as e:
print(f"⚠️ Repo creation: {e}")
# Upload the entire folder
print(f"\nUploading folder to {repo_id}...")
# Get the directory of this script
folder_path = os.path.dirname(os.path.abspath(__file__))
api.upload_folder(
folder_path=folder_path,
repo_id=repo_id,
repo_type=REPO_TYPE,
ignore_patterns=IGNORE_PATTERNS,
commit_message="Upload Time-Series-Library",
)
print(f"\n✅ Upload complete!")
print(f"🔗 View at: https://huggingface.co/{repo_id}")
if __name__ == "__main__":
main()