Instructions to use k2walia/slm-125m-med-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use k2walia/slm-125m-med-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="k2walia/slm-125m-med-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("k2walia/slm-125m-med-base") model = AutoModelForCausalLM.from_pretrained("k2walia/slm-125m-med-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use k2walia/slm-125m-med-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "k2walia/slm-125m-med-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "k2walia/slm-125m-med-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/k2walia/slm-125m-med-base
- SGLang
How to use k2walia/slm-125m-med-base 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 "k2walia/slm-125m-med-base" \ --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": "k2walia/slm-125m-med-base", "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 "k2walia/slm-125m-med-base" \ --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": "k2walia/slm-125m-med-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use k2walia/slm-125m-med-base with Docker Model Runner:
docker model run hf.co/k2walia/slm-125m-med-base
slm-125m-med-base
A 125.8M-parameter medical base language model, pretrained from scratch on a cleaned, deduplicated, and decontaminated ~1.76B-token medical corpus. This is a base (completion) model โ it continues text, it is not instruction-tuned or a chat model.
Model details
| Architecture | Llama (decoder-only) |
| Parameters | 125,848,320 (~125.8M) |
| Layers / hidden / heads | 12 / 768 / 12 |
| Context length | 1024 |
| Vocab | 16,384 (byte-level BPE, trained on this corpus) |
| Tied embeddings | yes |
Training
| Tokens seen | 1.76B (1 epoch) |
| Optimizer steps | 3,360 |
| Hardware | 8ร H100 (data-parallel) |
| Wall-clock | ~12 minutes |
| Compute cost | ~$6โ7 |
| Validation perplexity | 27.26 |
Optimizer AdamW (betas 0.9/0.95, wd 0.1), cosine LR 6e-4โ6e-5 with 200M-token warmup, global batch 524,288 tokens, seq len 1024, bf16.
Data mix (abstracts-first)
Built from public, ungated sources, streamed and cleaned from scratch:
| Source | Share | What |
|---|---|---|
| MedRAG/pubmed | ~82% | PubMed title+abstract snippets |
| HuggingFaceFW/fineweb-edu | ~12% | educational web (fluency) |
| epfl-llm/guidelines | ~5% | clinical practice guidelines |
| MedRAG/textbooks | ~1% | USMLE medical textbooks |
The corpus was decontaminated against PubMedQA, MedMCQA, and MedQA-USMLE (13-gram overlap removed) so downstream medical-QA evaluation is not leaked.
Intended use & limitations
Base model for research and as a starting point for fine-tuning (e.g. medical QA). It is not a medical device and must not be used for clinical decisions or to provide medical advice. Outputs may be inaccurate, outdated, or fabricated.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("k2walia/slm-125m-med-base")
model = AutoModelForCausalLM.from_pretrained("k2walia/slm-125m-med-base")
ids = tok("The patient presented with acute onset dyspnea and", return_tensors="pt")
out = model.generate(**ids, max_new_tokens=64, temperature=0.8, do_sample=True)
print(tok.decode(out[0], skip_special_tokens=True))
- Downloads last month
- 32