Update README.md
#1
by
atahanuz
- opened
README.md
CHANGED
|
@@ -85,6 +85,8 @@ The examples below demonstrate how to use the model to generate content based on
|
|
| 85 |
```python
|
| 86 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 87 |
import torch
|
|
|
|
|
|
|
| 88 |
model_id = "ytu-ce-cosmos/Turkish-Gemma-9b-T1"
|
| 89 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 90 |
model = AutoModelForCausalLM.from_pretrained(
|
|
@@ -92,6 +94,13 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 92 |
torch_dtype=torch.bfloat16,
|
| 93 |
device_map="auto",
|
| 94 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
messages = [
|
| 96 |
{"role": "user", "content": "İstanbul halkı, timsahları evcilleştirip balkonlarda beslemeyi alışkanlık hale getirmiştir. Hangi timsah türleri en çok tercih edilir?"}
|
| 97 |
]
|
|
@@ -113,6 +122,9 @@ outputs = model.generate(
|
|
| 113 |
response = outputs[0][input_ids.shape[-1]:]
|
| 114 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
| 115 |
|
|
|
|
|
|
|
|
|
|
| 116 |
```
|
| 117 |
|
| 118 |
# Tips
|
|
|
|
| 85 |
```python
|
| 86 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 87 |
import torch
|
| 88 |
+
import transformers
|
| 89 |
+
|
| 90 |
model_id = "ytu-ce-cosmos/Turkish-Gemma-9b-T1"
|
| 91 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 92 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 94 |
torch_dtype=torch.bfloat16,
|
| 95 |
device_map="auto",
|
| 96 |
)
|
| 97 |
+
|
| 98 |
+
pipeline = transformers.pipeline(
|
| 99 |
+
"text-generation",
|
| 100 |
+
model=model_id,
|
| 101 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 102 |
+
device_map="auto",
|
| 103 |
+
)
|
| 104 |
messages = [
|
| 105 |
{"role": "user", "content": "İstanbul halkı, timsahları evcilleştirip balkonlarda beslemeyi alışkanlık hale getirmiştir. Hangi timsah türleri en çok tercih edilir?"}
|
| 106 |
]
|
|
|
|
| 122 |
response = outputs[0][input_ids.shape[-1]:]
|
| 123 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
| 124 |
|
| 125 |
+
## <think> .... </think>
|
| 126 |
+
## Bu soru gerçek dışı bir senaryo içeriyor. **İstanbul'da veya herhangi bir kentsel alanda timsahların evcilleştirilip balkonlarda beslenmesi mümkün değildir ve bu bir alışkanlık değildir.
|
| 127 |
+
|
| 128 |
```
|
| 129 |
|
| 130 |
# Tips
|