Create model.yaml
Browse files- model.yaml +20 -0
model.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
After pushing, this README will be displayed as your model card on the Hugging Face Hub.
|
| 3 |
+
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
### **Step 3: Use the Model**
|
| 7 |
+
Once the model is pushed to Hugging Face, you can load and use it in any Python environment:
|
| 8 |
+
|
| 9 |
+
```python
|
| 10 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 11 |
+
|
| 12 |
+
# Load the model from Hugging Face Hub
|
| 13 |
+
model_name = "modeltrainer1/Saba-Ethiopia"
|
| 14 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto")
|
| 15 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 16 |
+
|
| 17 |
+
# Generate text
|
| 18 |
+
inputs = tokenizer("Hello, how are you?", return_tensors="pt")
|
| 19 |
+
outputs = model.generate(**inputs)
|
| 20 |
+
print(tokenizer.decode(outputs[0]))
|