Update README.md
Browse files
README.md
CHANGED
|
@@ -42,7 +42,30 @@ Fine-tuning was done using ORPO. The dataset was generated using GPT-4o (selecte
|
|
| 42 |
|
| 43 |
### Direct Use
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
[More Information Needed]
|
| 48 |
|
|
|
|
| 42 |
|
| 43 |
### Direct Use
|
| 44 |
|
| 45 |
+
```python
|
| 46 |
+
import transformers
|
| 47 |
+
import torch
|
| 48 |
+
|
| 49 |
+
model_id = "Kkaastr/Devple-8B"
|
| 50 |
+
|
| 51 |
+
pipeline = transformers.pipeline(
|
| 52 |
+
"text-generation",
|
| 53 |
+
model=model_id,
|
| 54 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 55 |
+
device_map="auto",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
messages = [
|
| 59 |
+
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
| 60 |
+
{"role": "user", "content": "Who are you?"},
|
| 61 |
+
]
|
| 62 |
+
|
| 63 |
+
outputs = pipeline(
|
| 64 |
+
messages,
|
| 65 |
+
max_new_tokens=256,
|
| 66 |
+
)
|
| 67 |
+
print(outputs[0]["generated_text"][-1])
|
| 68 |
+
```
|
| 69 |
|
| 70 |
[More Information Needed]
|
| 71 |
|