Update README.md
Browse files
README.md
CHANGED
|
@@ -11,14 +11,17 @@ This Mistral-based model is fine-tuned using the "Representation Bending" (REPBE
|
|
| 11 |
```python
|
| 12 |
import torch
|
| 13 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 14 |
|
| 15 |
-
model_id = "
|
| 16 |
-
|
|
|
|
| 17 |
model = AutoModelForCausalLM.from_pretrained(
|
| 18 |
model_id,
|
| 19 |
torch_dtype=torch.bfloat16,
|
| 20 |
device_map="auto",
|
| 21 |
)
|
|
|
|
| 22 |
|
| 23 |
input_text = "Who are you?"
|
| 24 |
template = "[INST] {instruction} [/INST] "
|
|
|
|
| 11 |
```python
|
| 12 |
import torch
|
| 13 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 14 |
+
from peft import PeftModel
|
| 15 |
|
| 16 |
+
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 17 |
+
adapter_id = "thkim0305/RepBend_Mistral_7B_LoRA"
|
| 18 |
+
tokenizer = AutoTokenizer.from_pretrained(adapter_id, use_fast=True)
|
| 19 |
model = AutoModelForCausalLM.from_pretrained(
|
| 20 |
model_id,
|
| 21 |
torch_dtype=torch.bfloat16,
|
| 22 |
device_map="auto",
|
| 23 |
)
|
| 24 |
+
model = PeftModel.from_pretrained(model, adapter_id, adapter_name="default")
|
| 25 |
|
| 26 |
input_text = "Who are you?"
|
| 27 |
template = "[INST] {instruction} [/INST] "
|