Spaces:
Sleeping
Sleeping
Create push_model.py
Browse files- push_model.py +17 -0
push_model.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer
|
2 |
+
from peft import AutoPeftModelForQuestionAnswering
|
3 |
+
from huggingface_hub import login
|
4 |
+
|
5 |
+
# Login with your token
|
6 |
+
login(token="your_hf_token_here")
|
7 |
+
|
8 |
+
# Load your already-trained model
|
9 |
+
model = AutoPeftModelForQuestionAnswering.from_pretrained("./model_output")
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("./model_output")
|
11 |
+
|
12 |
+
# Push to Hub
|
13 |
+
model_name = "AvocadoMuffin/roberta-cuad-qa" # or whatever name you want
|
14 |
+
model.push_to_hub(model_name)
|
15 |
+
tokenizer.push_to_hub(model_name)
|
16 |
+
|
17 |
+
print(f"✅ Model pushed to: https://huggingface.co/{model_name}")
|