Update README.md
Browse files
README.md
CHANGED
@@ -47,4 +47,29 @@ Evaluation performed using [LLM AutoEval](https://github.com/mlabonne/llm-autoev
|
|
47 |
|
48 |
## 🌳 Model family tree
|
49 |
|
50 |
-
![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
## 🌳 Model family tree
|
49 |
|
50 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/ekwRGgnjzEOyprT8sEBFt.png)
|
51 |
+
|
52 |
+
## 💻 Usage
|
53 |
+
|
54 |
+
```python
|
55 |
+
!pip install -qU transformers accelerate
|
56 |
+
|
57 |
+
from transformers import AutoTokenizer
|
58 |
+
import transformers
|
59 |
+
import torch
|
60 |
+
|
61 |
+
model = "mlabonne/Daredevil-8B"
|
62 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
63 |
+
|
64 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
65 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
66 |
+
pipeline = transformers.pipeline(
|
67 |
+
"text-generation",
|
68 |
+
model=model,
|
69 |
+
torch_dtype=torch.float16,
|
70 |
+
device_map="auto",
|
71 |
+
)
|
72 |
+
|
73 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
74 |
+
print(outputs[0]["generated_text"])
|
75 |
+
```
|