Instructions to use yasserrmd/MedScholar-Reasoning-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasserrmd/MedScholar-Reasoning-1.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yasserrmd/MedScholar-Reasoning-1.5B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yasserrmd/MedScholar-Reasoning-1.5B") model = AutoModelForCausalLM.from_pretrained("yasserrmd/MedScholar-Reasoning-1.5B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yasserrmd/MedScholar-Reasoning-1.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasserrmd/MedScholar-Reasoning-1.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/MedScholar-Reasoning-1.5B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yasserrmd/MedScholar-Reasoning-1.5B
- SGLang
How to use yasserrmd/MedScholar-Reasoning-1.5B 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 "yasserrmd/MedScholar-Reasoning-1.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/MedScholar-Reasoning-1.5B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "yasserrmd/MedScholar-Reasoning-1.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasserrmd/MedScholar-Reasoning-1.5B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yasserrmd/MedScholar-Reasoning-1.5B with Docker Model Runner:
docker model run hf.co/yasserrmd/MedScholar-Reasoning-1.5B
MedScholar-Reasoning-1.5B
This is a merge of preβtrained language models created with mergekit.
Purpose: compact model (β1.5B) tuned via model-merging for concise clinical recognition and short, structured rationales.
Disclaimer: Educational use only β not a substitute for professional medical judgment or emergency care.
𧬠Models Merged
π Merge Details
Merge Method
- SLERP (spherical linear interpolation).
π Inference (Transformers)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
MODEL = "yasserrmd/MedScholar-Reasoning-1.5B"
tok = AutoTokenizer.from_pretrained(MODEL, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
MODEL,
torch_dtype=(torch.float16 if torch.cuda.is_available() else torch.float32),
device_map=("auto" if torch.cuda.is_available() else None),
trust_remote_code=True,
).eval()
if tok.pad_token is None and tok.eos_token is not None:
tok.pad_token = tok.eos_token
prompt = (
"System: You are a concise medical reasoning assistant.\n"
"User: 65-year-old with fever, neck stiffness, photophobia. Initial step?\n"
"Assistant:"
)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(
**inputs,
max_new_tokens=64,
do_sample=False, # deterministic for recognition-style tasks
eos_token_id=tok.eos_token_id,
pad_token_id=tok.pad_token_id,
)
print(tok.decode(out[0], skip_special_tokens=True))
Recommended decoding
- Recognition / MCQ: greedy (
do_sample=False). - Free text: light sampling (
temperatureβ0.2β0.4,top_pβ0.9) if needed. - Keep generations short (50β150 tokens) to reduce drift.
π Safety & Intended Use
- Intended: education, examβstyle recognition, triage training, dataset bootstrapping.
- Not intended: to diagnose, treat, or manage real patients; making dosing or emergent decisions.
- Add guardrails for uncertainty (allow βuncertainβ), unsafe action filters, and referral prompts.
π License
The merged model inherits constraints from all upstream licenses.
Before distribution or commercial use, review the licenses of:
yasserrmd/MedScholar-1.5Bnvidia/OpenReasoning-Nemotron-1.5B
Your usage must comply with the most restrictive terms among the sources.
βοΈ Tips
- If your tokenizer includes a chat template, you may use it; otherwise, plain prompts like the examples above are fine.
- To shift personality/conciseness, prepend a system line (e.g., βUse 6β8 bullets; no repetition; say βuncertainβ if unsureβ).
- For reproducible merges, pin
mergekitversion and keep your YAML under version control.
βοΈ Citation
If you build on this work, please cite the original model authors and the mergekit project:
- mergekit: cg123/mergekit (GitHub)
- Upstream models: yasserrmd/MedScholar-1.5B, nvidia/OpenReasoning-Nemotron-1.5B
- Downloads last month
- 4