Views
No views yet

Castula-U2-QwenRe-1.5B is a compact, multilingual reasoning model fine-tuned from Qwen-1.5B, excelling in mathematical problem solving, logical reasoning, code generation, and general-purpose tasks. Its step-by-step reasoning and bilingual fluency make it ideal for educational systems, coding assistants, and lightweight reasoning applications.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "prithivMLmods/Castula-U2-QwenRe-1.5B"
4
5model = AutoModelForCausalLM.from_pretrained(
6 model_name,
7 torch_dtype="auto",
8 device_map="auto"
9)
10tokenizer = AutoTokenizer.from_pretrained(model_name)
11
12prompt = "Solve: A train travels 180 km in 3 hours. What is its average speed?"
13messages = [
14 {"role": "system", "content": "You are a helpful tutor skilled in solving math, logic, and code problems with step-by-step explanations."},
15 {"role": "user", "content": prompt}
16]
17text = tokenizer.apply_chat_template(
18 messages,
19 tokenize=False,
20 add_generation_prompt=True
21)
22model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
23
24generated_ids = model.generate(
25 **model_inputs,
26 max_new_tokens=512
27)
28generated_ids = [
29 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
30]
31
32response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]