Text Generation
Transformers
Safetensors
llama
medical
qa
tinyllama
lora
instruction-tuning
conversational
text-generation-inference
Instructions to use prav-974/medical-qa-tinyllama with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prav-974/medical-qa-tinyllama with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prav-974/medical-qa-tinyllama") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prav-974/medical-qa-tinyllama") model = AutoModelForCausalLM.from_pretrained("prav-974/medical-qa-tinyllama") 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
- vLLM
How to use prav-974/medical-qa-tinyllama with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prav-974/medical-qa-tinyllama" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prav-974/medical-qa-tinyllama", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prav-974/medical-qa-tinyllama
- SGLang
How to use prav-974/medical-qa-tinyllama 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 "prav-974/medical-qa-tinyllama" \ --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": "prav-974/medical-qa-tinyllama", "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 "prav-974/medical-qa-tinyllama" \ --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": "prav-974/medical-qa-tinyllama", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prav-974/medical-qa-tinyllama with Docker Model Runner:
docker model run hf.co/prav-974/medical-qa-tinyllama
Model Card for Model ID
This model is a fine-tuned medical question-answering language model based on TinyLlama-1.1B-Chat, optimized using LoRA for efficient training on limited hardware.
Model Details
Model Description
This model is a medical Q&A instruction-tuned language model built by fine-tuning TinyLlama-1.1B-Chat using supervised fine-tuning (SFT) with LoRA.
It is designed to generate structured and informative responses to medical-related questions for educational and research purposes.
- Developed by: Praveen
- Funded by [optional]: Self / Academic Project
- Shared by [optional]: Hugging Face Hub
- Model type: Causal Language Model (Instruction-tuned)
- Language(s) (NLP): English
- License: Apache 2.0
- Finetuned from model [optional]: TinyLlama/TinyLlama-1.1B-Chat-v1.0
Model Sources [optional]
- Repository: https://huggingface.co//medical-qa-tinyllama
- Paper [optional]: N/A
- Demo [optional]: Included in inference code
Uses
Direct Use
- Medical question answering
- Educational assistance
- Learning basic healthcare concepts
Downstream Use [optional]
- Medical chatbots (non-clinical)
- AI tutors for students
- Research prototypes
Out-of-Scope Use
- Clinical diagnosis
- Emergency medical advice
- Real-world healthcare decision-making
- Any life-critical applications
Bias, Risks, and Limitations
- May generate incorrect or outdated medical information
- Limited dataset (~10K samples)
- Not clinically validated
- Can hallucinate plausible but incorrect answers
- Lacks patient-specific reasoning
Recommendations
- Use only for educational purposes
- Always verify outputs with medical professionals
- Do not deploy in high-risk environments
- Apply safety filters if used in applications
How to Get Started with the Model
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "pra-974/medical-qa-tinyllama"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
def ask(question):
prompt = f"### Instruction:\n{question}\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
print(ask("What are symptoms of diabetes?"))
- Downloads last month
- 39