TÜDÜM : TÜrkçe Düşünen Üretken Model
Turkish Reasoning Model based on DeepSeek-R1-0508-Qwen3-8B. This model has undergone SFT (with OpenTurkishDiverseReasoning dataset) and GRPO training stages for creating better Turkish reasoning traces.
For a detailed Turkish technical blog checkout this link
Usage (transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
MODEL_ID = "barandinho/TDM-8b-v0.1"
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
SYSTEM_PROMPT = """Sen TÜDÜM (TÜrkçe Düşünen Üretken Model) isimli yardımsever bir yapay zeka modelisin.
Türkçe cevap ver ve cevabını tamamla."""
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "lollapalooza kelimesinde kaç tane l harfi vardır?"}
]
streamer = TextStreamer(tokenizer, skip_prompt=True)
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# NOTE: If you are not using TextStreamer, you can decode created_ids with tokenizer and print out the result.
# Keep in mind that it could take long to see the results without streamer.
generated_ids = model.generate(
**model_inputs,
max_new_tokens=16384,
temperature=0.6,
top_p=0.95,
do_sample=True,
streamer=streamer
)
<think>
Kullanıcı "lollapalooza" kelimesinde kaç tane "l" harfi olduğunu soruyor. Önce kelimeyi yazıp harflerini saymalıyım.
Kelime: l-o-l-l-a-p-a-l-o-o-z-a
Şimdi her harfi kontrol edelim:
- İlk harf: l → bir l
- İkinci harf: o → değil
- Üçüncü harf: l → ikinci l
- Dördüncü harf: l → üçüncü l
- Beşinci harf: a → değil
- Altıncı harf: p → değil
- Yedinci harf: a → değil
- Sekizinci harf: l → dördüncü l
- Dokuzuncu harf: o → değil
- Onuncu harf: o → değil
- On birinci harf: z → değil
- On ikinci harf: a → değil
Yani l harfleri: 1. pozisyonda, 3. pozisyonda, 4. pozisyonda, 8. pozisyonda.
Toplam 4 tane.
Daha kolay bir yöntem: kelimeyi yazıp l'leri işaretleyerek sayabilirim.
l o l l a p a l o o z a
İlk l, üçüncü l, dördüncü l, sekizinci l → 4 tane.
Kelimeyi bilgisayarda saydıramam ama mantıken zaten 4. Şimdi cevap 4.
Kullanıcıya cevap olarak 4 demeliyim.
Düşünce sürecimde zaten hesapladım, şimdi özet kısmına geçeyim.
Özet: "lollapalooza" kelimesinde 4 tane "l" harfi vardır.
</think>
"lollapalooza" kelimesinde toplam 4 tane "l" harfi bulunmaktadır.
Usage (transformers) for multi-turn conversation
You should strip out thinking parts for multi-turn conversation. A simple while loop that provides this is like below :
import re
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
MODEL_ID = "barandinho/TDM-8b-v0.1"
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
SYSTEM_PROMPT = """Sen TÜDÜM (TÜrkçe Düşünen Üretken Model) isimli yardımsever bir yapay zeka modelisin.
Türkçe cevap ver ve cevabını tamamla."""
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
print("Çıkmak için 'q' yazınız.")
print("-" * 40)
while True:
user_input = input("\nSen: ").strip()
if user_input.lower() == 'q':
break
if not user_input:
continue
messages.append({"role": "user", "content": user_input})
# apply chat template and generate response.
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
print("TÜDÜM: ", end="", flush=True)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=16384,
temperature=0.6,
top_p=0.95,
do_sample=True,
streamer=streamer
)
# get assistant response
input_length = model_inputs.input_ids.shape[1]
assistant_tokens = generated_ids[0][input_length:]
raw_response = tokenizer.decode(assistant_tokens, skip_special_tokens=True)
# critical : clean thinking parts for multi-turn conversation.
clean_response = re.sub(r'<think>.*?</think>', '', raw_response, flags=re.DOTALL).strip()
clean_response = re.sub(r'<|.*?|>', '', clean_response).strip()
messages.append({"role": "assistant", "content": clean_response})
Usage (local)
You can use LM Studio (or any other local llm client) to run this model on your own computer locally via GGUF version of this model
- Downloads last month
- 13
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support