Views
No views yet
1from unsloth import FastLanguageModel
2from unsloth.chat_templates import get_chat_template
3
4# Load model
5model, tokenizer = FastLanguageModel.from_pretrained(
6 "uisikdag/qwen3-14b-arc-tr",
7 max_seq_length=2048,
8 load_in_4bit=True,
9)
10tokenizer = get_chat_template(tokenizer, chat_template="qwen2.5")
11FastLanguageModel.for_inference(model)
12
13# Predict
14question = "Fotosentez sırasında bitkiler hangi gazı üretir?"
15options = ["A Karbondioksit", "B Oksijen", "C Azot", "D Hidrojen"]
16
17prompt = f"Soru: {question}\n\nSecenekler:\n" + "\n".join(options) + "\n\nDogru cevap hangisi?"
18messages = [{"role": "user", "content": prompt}]
19
20inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
21outputs = model.generate(input_ids=inputs, max_new_tokens=64, temperature=0.1)
22response = tokenizer.decode(outputs[0], skip_special_tokens=True).split("assistant")[-1].strip()
23print(f"Cevap: {response}")1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}