Create model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi, HfFolder, Repository
|
| 2 |
+
|
| 3 |
+
model_dir = "flaubert_finetuned_full"
|
| 4 |
+
username = "your-username" # Replace with your Hugging Face username
|
| 5 |
+
model_name = "your-model-name" # Replace with your desired model name
|
| 6 |
+
|
| 7 |
+
# Create the repository
|
| 8 |
+
api = HfApi()
|
| 9 |
+
repo_url = api.create_repo(name=model_name, token=HfFolder.get_token())
|
| 10 |
+
|
| 11 |
+
# Clone the repository
|
| 12 |
+
repo = Repository(local_dir=model_dir, clone_from=repo_url)
|
| 13 |
+
|
| 14 |
+
# Push the model to the Hub
|
| 15 |
+
repo.push_to_hub(commit_message="Initial commit")
|