Instructions to use Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k") model = AutoModelForCausalLM.from_pretrained("Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k
- SGLang
How to use Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k with Docker Model Runner:
docker model run hf.co/Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k
Qwen2.5-0.5B-Med-Post-Trained-92k
A domain-adapted and instruction-tuned variant of Qwen/Qwen2.5-0.5B, produced through a two-stage training pipeline: full-parameter continued pre-training (CPT) on biomedical text followed by supervised fine-tuning (SFT) on a general instruction dataset.
Training Pipeline
Stage 1 โ Continued Pre-Training (CPT)
| Property | Value |
|---|---|
| Base model | Qwen/Qwen2.5-0.5B |
| Training type | Full-parameter CPT (no LoRA) |
| Dataset | VietAI/vi_pubmed (92k English abstracts) |
| Tokens | ~23.6 million |
| Objective | Causal Language Modeling (CLM) |
| Optimizer | AdamW 8-bit |
| Learning rate | 2e-5 cosine |
| Hardware | Kaggle Tesla T4 |
| Training time | ~3h 45m |
| Loss | 2.581 โ 2.478 |
Stage 2 โ Supervised Fine-Tuning (SFT)
| Property | Value |
|---|---|
| Base model | Rumiii/Qwen2.5-0.5B-Med-Pre-Trained-92k |
| Training type | Full-parameter SFT (no LoRA) |
| Dataset | causal-lm/ultrachat (20k samples) |
| Format | Qwen2.5 ChatML chat template |
| Optimizer | AdamW 8-bit |
| Learning rate | 2e-5 cosine |
| Hardware | Kaggle Tesla T4 |
| Training time | ~1h 13m |
| Loss | 2.093 โ 1.289 |
Usage
This model uses the Qwen2.5 ChatML chat template. A system prompt is required for best results. The recommended inference setup is shown below.
Recommended system prompt
SYSTEM_PROMPT = (
"You are a knowledgeable medical AI assistant named MedAssist. "
"Answer all questions clearly, directly, and informatively. "
"For medical questions provide accurate information. "
"Never generate multiple choice questions unless explicitly asked."
)
Basic inference
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
)
model.eval()
SYSTEM_PROMPT = (
"You are a knowledgeable medical AI assistant named MedAssist. "
"Answer all questions clearly, directly, and informatively. "
"For medical questions provide accurate information. "
"Never generate multiple choice questions unless explicitly asked."
)
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "What are the symptoms of pneumonia?"},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
).to(model.device)
im_end_id = tokenizer.convert_tokens_to_ids("<|im_end|>")
stop_ids = [tokenizer.eos_token_id]
if im_end_id and im_end_id != tokenizer.eos_token_id:
stop_ids.append(im_end_id)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.2,
top_p=0.9,
repetition_penalty=1.15,
do_sample=True,
eos_token_id=stop_ids,
pad_token_id=tokenizer.eos_token_id,
)
new_tokens = outputs[0][inputs["input_ids"].shape[-1]:]
response = tokenizer.decode(new_tokens, skip_special_tokens=True).strip()
print(response)
Recommended generation parameters
| Parameter | Value | Reason |
|---|---|---|
| temperature | 0.2 | Low temperature for factual medical responses |
| top_p | 0.9 | Stable token sampling |
| repetition_penalty | 1.15 | Prevents response loops |
| max_new_tokens | 512 | Sufficient for complete answers |
| eos_token_id | include <|im_end|> |
Required to stop at turn boundary |
Important note on greetings
As a 0.5B model fine-tuned on instruction data, this model may produce inconsistent responses to simple greetings such as "Hi" or "Hello." It performs best when given direct questions or requests. For production deployments, greeting inputs should be handled with a fixed response rather than passed to the model.
Intended Use
- Medical question answering and clinical education
- Research into small biomedical language models
- Lightweight medical AI prototyping
- Demonstration of CPT + SFT pipeline on consumer hardware
Not Intended For
- Clinical decision making in real patient care
- Diagnostic or treatment decisions
- Replacement of licensed medical professionals
Limitations
- 494M parameters โ reasoning depth is limited compared to larger models
- Trained on single-turn instruction pairs โ multi-turn coherence is basic
- Clinical accuracy not guaranteed โ all outputs require expert verification
- Simple greetings may produce inconsistent responses at this model scale
- English only
- Downloads last month
- 126
Model tree for Rumiii/Qwen2.5-0.5B-Med-Post-Trained-92k
Base model
Qwen/Qwen2.5-0.5B