Views
No views yet

Megatron-Bots-1.7B-Reasoning is a logical reasoning and general-purpose thinking model fine-tuned from Qwen3-1.7B, specifically designed for advanced reasoning tasks and analytical problem-solving. Built with data entries from the SynLogic Dataset, it excels at structured thinking, logical deduction, and comprehensive problem analysis in a compact yet powerful architecture.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "prithivMLmods/Megatron-Bots-1.7B-Reasoning"
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 this logic puzzle: If all A are B, and some B are C, what can we conclude about A and C?"
13
14messages = [
15 {"role": "system", "content": "You are an advanced reasoning assistant specialized in logical analysis and problem-solving."},
16 {"role": "user", "content": prompt}
17]
18
19text = tokenizer.apply_chat_template(
20 messages,
21 tokenize=False,
22 add_generation_prompt=True
23)
24
25model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
26
27generated_ids = model.generate(
28 **model_inputs,
29 max_new_tokens=512,
30 temperature=0.1, # Lower temperature for more consistent reasoning
31 do_sample=True
32)
33
34generated_ids = [
35 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
36]
37
38response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
39print(response)