File size: 510 Bytes
bdad90c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from huggingface_hub import HfApi, HfFolder, Repository

model_dir = "flaubert_finetuned_full"
username = "your-username"  # Replace with your Hugging Face username
model_name = "your-model-name"  # Replace with your desired model name

# Create the repository
api = HfApi()
repo_url = api.create_repo(name=model_name, token=HfFolder.get_token())

# Clone the repository
repo = Repository(local_dir=model_dir, clone_from=repo_url)

# Push the model to the Hub
repo.push_to_hub(commit_message="Initial commit")