Update README.md
Browse files
README.md
CHANGED
|
@@ -199,4 +199,27 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
|
|
| 199 |
[More Information Needed]
|
| 200 |
### Framework versions
|
| 201 |
|
| 202 |
-
- PEFT 0.14.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
[More Information Needed]
|
| 200 |
### Framework versions
|
| 201 |
|
| 202 |
+
- PEFT 0.14.0
|
| 203 |
+
|
| 204 |
+
- ## Usage
|
| 205 |
+
|
| 206 |
+
This adapter is fine-tuned on top of `mistralai/Mistral-7B-Instruct-v0.3`. To use it:
|
| 207 |
+
|
| 208 |
+
```python
|
| 209 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 210 |
+
|
| 211 |
+
base_model_name = "mistralai/Mistral-7B-Instruct-v0.3"
|
| 212 |
+
adapter_model_name = "Danna8/MistralF"
|
| 213 |
+
|
| 214 |
+
# Load the tokenizer
|
| 215 |
+
tokenizer = AutoTokenizer.from_pretrained(adapter_model_name)
|
| 216 |
+
|
| 217 |
+
# Load the base model and apply the adapter
|
| 218 |
+
model = AutoModelForCausalLM.from_pretrained(base_model_name)
|
| 219 |
+
model.load_adapter(adapter_model_name)
|
| 220 |
+
model.set_active_adapters("default") # Adjust the adapter name if needed
|
| 221 |
+
|
| 222 |
+
# Example inference
|
| 223 |
+
inputs = tokenizer("Hello, how are you?", return_tensors="pt")
|
| 224 |
+
outputs = model.generate(**inputs)
|
| 225 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|