| # upload_model.py | |
| from huggingface_hub import HfApi, HfFolder | |
| # Define your model path and the desired repository ID on the Hub | |
| MODEL_PATH = r"C:\Users\alber\OneDrive\Desktop\PROJECTS\TYNCAD\distilbert" # Path to your local model folder | |
| REPO_ID = "albertosei/distilbert_classdoc" # | |
| print(f"Uploading model from '{MODEL_PATH}' to '{REPO_ID}'...") | |
| # The library will automatically find and use the token you just saved. | |
| api = HfApi() | |
| # Create the repository on the Hub if it doesn't exist | |
| api.create_repo(repo_id=REPO_ID, repo_type="model", exist_ok=True) | |
| # Upload the entire folder | |
| api.upload_folder( | |
| folder_path=MODEL_PATH, | |
| repo_id=REPO_ID, | |
| repo_type="model", | |
| ) | |
| print("✅ Upload complete! Check your model on the Hugging Face Hub.") |