Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: llama3
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3
|
| 3 |
+
---
|
| 4 |
+
'''
|
| 5 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
+
import torch
|
| 7 |
+
|
| 8 |
+
model_id = "OPENZEKA/openzeka_llm_beta"
|
| 9 |
+
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 11 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 12 |
+
model_id,
|
| 13 |
+
torch_dtype=torch.bfloat16,
|
| 14 |
+
device_map="auto",
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
messages = [
|
| 18 |
+
{"role": "system", "content": "Sen Openzeka firmaının eğittiği asistansın sorulan sorulara doğru cevaplar ver "},
|
| 19 |
+
{"role": "user", "content": "Türkiye'nin yapay zeka alanında lider ülke olması için firmaların izleyeceği adımlar ne olmalıdır ?"},
|
| 20 |
+
]
|
| 21 |
+
|
| 22 |
+
input_ids = tokenizer.apply_chat_template(
|
| 23 |
+
messages,
|
| 24 |
+
add_generation_prompt=True,
|
| 25 |
+
return_tensors="pt"
|
| 26 |
+
).to(model.device)
|
| 27 |
+
|
| 28 |
+
terminators = [
|
| 29 |
+
tokenizer.eos_token_id,
|
| 30 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
| 31 |
+
]
|
| 32 |
+
|
| 33 |
+
outputs = model.generate(
|
| 34 |
+
input_ids,
|
| 35 |
+
max_new_tokens=1024,
|
| 36 |
+
eos_token_id=terminators,
|
| 37 |
+
do_sample=True,
|
| 38 |
+
repetition_penalty=1.1,
|
| 39 |
+
temperature=0.6,
|
| 40 |
+
top_p=0.9,
|
| 41 |
+
)
|
| 42 |
+
response = outputs[0][input_ids.shape[-1]:]
|
| 43 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
| 44 |
+
'''
|