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")