Update README.md
Browse files
README.md
CHANGED
@@ -55,28 +55,3 @@ TBD.
|
|
55 |
You can find the experiment on W&B at [this address](https://wandb.ai/mlabonne/DPO/runs/vxnmq24z/workspace?nw=nwusermlabonne).
|
56 |
|
57 |

|
58 |
-
|
59 |
-
## 💻 Usage
|
60 |
-
|
61 |
-
```python
|
62 |
-
!pip install -qU transformers accelerate
|
63 |
-
|
64 |
-
from transformers import AutoTokenizer
|
65 |
-
import transformers
|
66 |
-
import torch
|
67 |
-
|
68 |
-
model = "mlabonne/OrpoLlama-3-8B"
|
69 |
-
messages = [{"role": "user", "content": "What is a large language model?"}]
|
70 |
-
|
71 |
-
tokenizer = AutoTokenizer.from_pretrained(model)
|
72 |
-
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
73 |
-
pipeline = transformers.pipeline(
|
74 |
-
"text-generation",
|
75 |
-
model=model,
|
76 |
-
torch_dtype=torch.float16,
|
77 |
-
device_map="auto",
|
78 |
-
)
|
79 |
-
|
80 |
-
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
81 |
-
print(outputs[0]["generated_text"])
|
82 |
-
```
|
|
|
55 |
You can find the experiment on W&B at [this address](https://wandb.ai/mlabonne/DPO/runs/vxnmq24z/workspace?nw=nwusermlabonne).
|
56 |
|
57 |

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|