Downloads · 30 days
16
8% of all-time downloads
hashamulhaq/MedQwen2.5-3B-Improved
MedQwen2.5-3B-Improved is a text generation model from hashamulhaq. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is a specialized variant of Qwen2.5-3B-Instruct, fine-tuned using GRPO to excel at medical domain reasoning while maintaining strong mathematical problem-solving capabilities. The model demonstrates enhanced reas…
Downloads · 30 days
16
8% of all-time downloads
All-time downloads
212
Public
Parameters
3.1B
6.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.2 GB · 100%
From the Hugging Face model README
This is a specialized variant of Qwen2.5-3B-Instruct, fine-tuned using GRPO to excel at medical domain reasoning while maintaining strong mathematical problem-solving capabilities. The model demonstrates enhanced reasoning abilities and can express uncertainty when appropriate.
If you use ollama, llama-cpp, vllm or any other inference iengine, you need to set the system prompt as below as the model performs best with the following prompt:
'\nRespond in the following format:\n<reasoning>\n...\n</reasoning>\n<answer>\n...\n</answer>\n'
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "hashamulhaq/MedQwen2.5-3B-Improved"
# Initialize model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Prepare prompt
prompt = "What is the relationship between BMI and cardiovascular disease risk?"
messages = [
{"role": "system", "content": "\nRespond in the following format:\n<reasoning>\n...\n</reasoning>\n<answer>\n...\n</answer>\n"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Generate response
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
This model is licensed under Apache 2.0.