File size: 1,725 Bytes
ed17412 |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#!/usr/bin/env python3
"""
Upload CardVault+ model to HuggingFace Hub
"""
import os
import sys
from huggingface_hub import HfApi, login
def upload_model():
# Check for token
token = os.getenv("HF_TOKEN")
if not token:
print("Please set HF_TOKEN environment variable")
print("Get your token from: https://huggingface.co/settings/tokens")
return False
try:
# Login
login(token=token)
print("β
Successfully logged in to HuggingFace")
# Initialize API
api = HfApi(token=token)
# Check if repo exists, create if not
try:
api.repo_info(repo_id="sugiv/cardvaultplus", repo_type="model")
print("β
Repository exists")
except:
print("π Creating new repository...")
api.create_repo(repo_id="sugiv/cardvaultplus", repo_type="model", private=False)
print("β
Repository created")
# Upload folder
print("π Uploading model files (4.2GB)...")
print("This may take 10-15 minutes...")
api.upload_folder(
folder_path=".",
repo_id="sugiv/cardvaultplus",
repo_type="model",
commit_message="Upload production CardVault+ SmolVLM model - 4 epochs trained, 0.000133 validation loss"
)
print("π Successfully uploaded CardVault+ model!")
print("π Available at: https://huggingface.co/sugiv/cardvaultplus")
return True
except Exception as e:
print(f"β Upload failed: {e}")
return False
if __name__ == "__main__":
success = upload_model()
sys.exit(0 if success else 1)
|