Views
No views yet
Qwen/Qwen2.5-7B-Instruct trained to produce explicit step-by-step <think>...</think> Chain-of-Thought (CoT) reasoning.Qwen/Qwen2.5-7B-InstructFreedomIntelligence/medical-o1-reasoning-SFT (10,000 instructions)| Metric / Feature | Benchmark Score |
|---|---|
CoT Reasoning Tag Rate (<think>) | 25.0% |
| Holdout Benchmark Accuracy | 100.0% |
| Training Duration | 19.77 minutes |
| Final Epoch Loss | 1.520 |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5base_model_id = "Qwen/Qwen2.5-7B-Instruct"
6adapter_model_id = "DexterSptizu/qwen2.5-7b-reasoning-qlora"
7
8# Load base model & tokenizer
9tokenizer = AutoTokenizer.from_pretrained(base_model_id)
10base_model = AutoModelForCausalLM.from_pretrained(
11 base_model_id,
12 torch_dtype=torch.bfloat16,
13 device_map="auto"
14)
15
16# Attach fine-tuned reasoning adapter
17model = PeftModel.from_pretrained(base_model, adapter_model_id)
18
19# Inference Example
20prompt = "<|im_start|>system\nYou are a helpful reasoning assistant.<|im_end|>\n<|im_start|>user\nSolve step by step: What is 15 * 24?<|im_end|>\n<|im_start|>assistant\n<think>\n"
21inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
22outputs = model.generate(**inputs, max_new_tokens=512)
23print(tokenizer.decode(outputs[0], skip_special_tokens=True))