File size: 774 Bytes
6e08d8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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.")