# upload_ethan_to_hub.py (The Final, Correct Version) | |
from huggingface_hub import HfApi | |
# --- IMPORTANT: Give your new model a name on the Hub --- | |
# This MUST match your actual Hugging Face username. | |
# For example: "santi/Ethan-1.0-PEFT-Adapter" | |
repo_id = "SVP21/Ethan-1.0-Adapter" # <-- CHANGE THIS | |
# --- The folder that contains your trained adapter --- | |
folder_path = "./" # The script will upload the folder it is currently in | |
# --- This is the new, simpler, and correct way to upload --- | |
print(f"--- Preparing to upload your adapter to '{repo_id}' ---") | |
api = HfApi() | |
# Create the repository on the Hub | |
api.create_repo( | |
repo_id=repo_id, | |
repo_type="model", | |
exist_ok=True, # Don't error if the repo already exists | |
) | |
# Upload the entire folder | |
print(f"Uploading all files from '{folder_path}'...") | |
api.upload_folder( | |
folder_path=folder_path, | |
repo_id=repo_id, | |
repo_type="model", | |
) | |
print("\n--- VICTORY! Your Master Spy's 'Notebook' is now on the Hub! ---") |