Update README.md
Browse files
README.md
CHANGED
|
@@ -59,10 +59,19 @@ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
| 59 |
|
| 60 |
### **📝Inference with TextStreamer**
|
| 61 |
```bash
|
|
|
|
|
|
|
|
|
|
| 62 |
{'content': 'why even let a tranny in they arent really even human',
|
| 63 |
'role': 'user'},
|
| 64 |
]
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
tokenizer = get_chat_template(
|
| 67 |
tokenizer,
|
| 68 |
chat_template = "llama-3", # Supports zephyr, chatml, mistral, llama, alpaca, vicuna, vicuna_old, unsloth
|
|
@@ -81,4 +90,6 @@ inputs = tokenizer.apply_chat_template(
|
|
| 81 |
from transformers import TextStreamer
|
| 82 |
text_streamer = TextStreamer(tokenizer)
|
| 83 |
_ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 10, use_cache = True)
|
|
|
|
|
|
|
| 84 |
```
|
|
|
|
| 59 |
|
| 60 |
### **📝Inference with TextStreamer**
|
| 61 |
```bash
|
| 62 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 63 |
+
|
| 64 |
+
messages=[
|
| 65 |
{'content': 'why even let a tranny in they arent really even human',
|
| 66 |
'role': 'user'},
|
| 67 |
]
|
| 68 |
|
| 69 |
+
tokenizer = get_chat_template(
|
| 70 |
+
tokenizer,
|
| 71 |
+
chat_template = "llama-3", # Supports zephyr, chatml, mistral, llama, alpaca, vicuna, vicuna_old, unsloth
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
tokenizer = get_chat_template(
|
| 76 |
tokenizer,
|
| 77 |
chat_template = "llama-3", # Supports zephyr, chatml, mistral, llama, alpaca, vicuna, vicuna_old, unsloth
|
|
|
|
| 90 |
from transformers import TextStreamer
|
| 91 |
text_streamer = TextStreamer(tokenizer)
|
| 92 |
_ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 10, use_cache = True)
|
| 93 |
+
|
| 94 |
+
Hate speech, personal attacks, and discrimination
|
| 95 |
```
|