Instructions to use tweijie/tinyllama-medical-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tweijie/tinyllama-medical-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tweijie/tinyllama-medical-merged")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tweijie/tinyllama-medical-merged") model = AutoModelForCausalLM.from_pretrained("tweijie/tinyllama-medical-merged", device_map="auto") - PEFT
How to use tweijie/tinyllama-medical-merged with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tweijie/tinyllama-medical-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tweijie/tinyllama-medical-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tweijie/tinyllama-medical-merged", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tweijie/tinyllama-medical-merged
- SGLang
How to use tweijie/tinyllama-medical-merged 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 "tweijie/tinyllama-medical-merged" \ --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": "tweijie/tinyllama-medical-merged", "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 "tweijie/tinyllama-medical-merged" \ --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": "tweijie/tinyllama-medical-merged", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tweijie/tinyllama-medical-merged with Docker Model Runner:
docker model run hf.co/tweijie/tinyllama-medical-merged
TinyLlama-1.1B — Medical QLoRA (Merged)
A QLoRA fine-tuned variant of TinyLlama-1.1B-intermediate-step-1431k-3T, trained on medical question-answering data. The LoRA adapter has been merged into the base weights, so this repo is a standalone model — no separate adapter loading required.
⚠️ Intended use
This model was trained as part of a GenAI training lab to demonstrate the fine-tuning → merge → deploy workflow. It is not validated for real clinical or medical use and should not be used to inform actual medical decisions. Treat its outputs as educational examples of what a small fine-tuned LLM can produce, not medical advice.
Training details
- Base model:
TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T - Method: QLoRA (4-bit NF4 quantization during training) via
peft+trl.SFTTrainer - LoRA config:
r=8,lora_alpha=16 - Dataset:
BI55/MedText— medical case/question-answer pairs - Steps: 400
- Merge: adapter merged into the base model via
PeftModel.merge_and_unload(), then saved as a full standalone model
How to use
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
repo_id = "tweijie/tinyllama-medical-merged"
model = AutoModelForCausalLM.from_pretrained(repo_id)
tokenizer = AutoTokenizer.from_pretrained(repo_id)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_length=200)
prompt = "<s>[INST] A patient presents with restless leg sensations at night. What could be the cause? [/INST]"
print(pipe(prompt)[0]["generated_text"])
Limitations
1.1B parameters — small model, prone to hallucination and factual errors, especially on medical content.
Fine-tuned on a single narrow dataset (400 training steps); not broadly evaluated.
No safety/alignment tuning beyond the base model's own training.
- Downloads last month
- 36