Instructions to use Kartikey1999/medical-qa-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Kartikey1999/medical-qa-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "Kartikey1999/medical-qa-lora") - Transformers
How to use Kartikey1999/medical-qa-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kartikey1999/medical-qa-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Kartikey1999/medical-qa-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kartikey1999/medical-qa-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kartikey1999/medical-qa-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kartikey1999/medical-qa-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kartikey1999/medical-qa-lora
- SGLang
How to use Kartikey1999/medical-qa-lora 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 "Kartikey1999/medical-qa-lora" \ --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": "Kartikey1999/medical-qa-lora", "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 "Kartikey1999/medical-qa-lora" \ --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": "Kartikey1999/medical-qa-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kartikey1999/medical-qa-lora with Docker Model Runner:
docker model run hf.co/Kartikey1999/medical-qa-lora
Medical QA LoRA
Model Description
This project fine-tunes Qwen2.5-1.5B-Instruct on medical educational text using LoRA (Low-Rank Adaptation) and supervised fine-tuning (SFT).
The goal is to adapt the language model to answer questions based on medical educational material while training only a small percentage of the model parameters.
Base Model
- Qwen/Qwen2.5-1.5B-Instruct
Fine-Tuning Method
- PEFT
- LoRA (Low-Rank Adaptation)
- Supervised Fine-Tuning (SFT)
- 4-bit quantization
Dataset
Medical educational reference material was processed and formatted into text samples for fine-tuning.
Training samples: 49
Validation samples: 6
Training
The model was fine-tuned using Hugging Face Transformers, TRL and PEFT.
LoRA was used to reduce the number of trainable parameters and memory requirements.
Evaluation Results
- Training Loss: 2.1675
- Validation Loss: 2.0194
- Mean Token Accuracy: 0.5213
- Evaluation Entropy: 2.0662
Intended Use
This model is intended for educational experimentation with LLM fine-tuning and medical question answering.
It should not be used as a substitute for professional medical advice, diagnosis or treatment.
Technologies
Python, PyTorch, Hugging Face Transformers, PEFT, LoRA, TRL, BitsAndBytes and Google Colab.
- Downloads last month
- 20