Text Generation
Transformers
PyTorch
English
llama
unsloth
trl
sft
conversational
text-generation-inference
Instructions to use deep-div/MediLlama-3.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deep-div/MediLlama-3.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deep-div/MediLlama-3.2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("deep-div/MediLlama-3.2") model = AutoModelForCausalLM.from_pretrained("deep-div/MediLlama-3.2", device_map="auto") 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 Settings
- vLLM
How to use deep-div/MediLlama-3.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deep-div/MediLlama-3.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deep-div/MediLlama-3.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deep-div/MediLlama-3.2
- SGLang
How to use deep-div/MediLlama-3.2 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 "deep-div/MediLlama-3.2" \ --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": "deep-div/MediLlama-3.2", "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 "deep-div/MediLlama-3.2" \ --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": "deep-div/MediLlama-3.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use deep-div/MediLlama-3.2 with Docker Model Runner:
docker model run hf.co/deep-div/MediLlama-3.2
| library_name: transformers | |
| tags: | |
| - unsloth | |
| - trl | |
| - sft | |
| license: apache-2.0 | |
| language: | |
| - en | |
| base_model: | |
| - meta-llama/Llama-3.2-3B-Instruct | |
| pipeline_tag: text-generation | |
| metrics: | |
| - accuracy | |
| - bleu | |
| - rouge | |
| # Model Card for MediLlama-3.2 | |
| A fine-tuned version of Meta's LLaMA 3.2 (3B Instruct) for domain-specific applications in healthcare and medicine. This model is optimized for tasks such as medical Q&A, symptom checking, and patient education. | |
| ## Model Details | |
| ### Model Description | |
| This model is a domain-adapted version of LLaMA 3.2 3B Instruct. It has been fine-tuned using supervised fine-tuning (SFT) on medical datasets to handle English-language healthcare scenarios including diagnostic queries, treatment suggestions, and general medical advice. | |
| - **Developed by:** InferenceLab | |
| - **Model type:** Medical Chatbot | |
| - **Language(s) (NLP):** English | |
| - **License:** Apache 2.0 | |
| - **Finetuned from model:** meta-llama/Llama-3.2-3B-Instruct | |
| ### Model Sources | |
| - **Repository:** [More Information Needed] | |
| - **Paper [optional]:** [More Information Needed] | |
| - **Demo [optional]:** [More Information Needed] | |
| ## Uses | |
| ### Direct Use | |
| MediLlama-3.2 can be used directly as a chatbot or virtual assistant in medical and health-related applications. Ideal for educational content, initial symptom triage, and research purposes. | |
| ### Downstream Use | |
| Can be integrated into larger telehealth systems, clinical documentation tools, or diagnostic assistants after further task-specific fine-tuning. | |
| ### Out-of-Scope Use | |
| - Should not be used for real-time diagnosis or treatment decisions without expert validation. | |
| - Not suitable for high-risk or life-threatening emergency response. | |
| - Not trained on pediatric or highly specialized medical domains. | |
| ## Bias, Risks, and Limitations | |
| While the model is trained on medical data, it may still exhibit: | |
| - Biases from source data | |
| - Hallucinations or incorrect suggestions | |
| - Outdated or non-region-specific medical advice | |
| ### Recommendations | |
| Users should validate outputs with certified medical professionals. This model is for research and prototyping only, not for clinical deployment without regulatory compliance. | |
| ## How to Get Started with the Model | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("InferenceLab/MediLlama-3.2") | |
| tokenizer = AutoTokenizer.from_pretrained("InferenceLab/MediLlama-3.2") | |
| input_text = "What are the symptoms of diabetes?" | |
| inputs = tokenizer(input_text, return_tensors="pt") | |
| outputs = model.generate(**inputs) | |
| print(tokenizer.decode(outputs[0])) | |
| ```` | |
| ## Training Details | |
| ### Training Data | |
| Model trained using cleaned and preprocessed medical QA datasets, synthetic doctor-patient conversations, and publicly available health forums. Protected health information (PHI) was removed. | |
| ### Training Procedure | |
| Supervised fine-tuning (SFT) using TRL and Unsloth libraries. | |
| #### Preprocessing | |
| Tokenization using LLaMA tokenizer with special medical instruction formatting. | |
| #### Training Hyperparameters | |
| * **Training regime:** bf16 mixed precision | |
| * **Epochs:** 3 | |
| * **Batch size:** 64 | |
| * **Learning rate:** 2e-5 | |
| #### Speeds, Sizes, Times | |
| * **Training time:** \~12 hours on 4×A100 GPUs | |
| * **Final model size:** \~3.1B parameters | |
| ## Evaluation | |
| ### Testing Data, Factors & Metrics | |
| #### Testing Data | |
| Subset of unseen medical QA pairs, synthetic test cases, and MedQA-derived examples. | |
| #### Factors | |
| * Input prompt complexity | |
| * Use of medical terminology | |
| * Chat length | |
| #### Metrics | |
| * **Accuracy:** 81.3% | |
| * **BLEU:** 34.5 | |
| * **ROUGE-L:** 62.2 | |
| ### Results | |
| #### Summary | |
| Model shows good generalization to unseen prompts and performs competitively for general medical dialogue. Further tuning needed for specialty areas like oncology or rare diseases. | |
| ## Model Examination | |
| Explainability tools like LLaMA-MedLens (if available) are suggested to interpret model decisions. | |
| ## Environmental Impact | |
| * **Hardware Type:** 4×NVIDIA A100 40GB | |
| * **Hours used:** 12 | |
| * **Cloud Provider:** AWS | |
| * **Compute Region:** us-west-2 | |
| * **Carbon Emitted:** \~35.8 kg CO2eq (estimated) | |
| ## Technical Specifications | |
| ### Model Architecture and Objective | |
| * Based on Meta LLaMA 3.2 3B Instruct | |
| * Decoder-only transformer | |
| * Objective: Causal Language Modeling (CLM) with instruction fine-tuning | |
| ### Compute Infrastructure | |
| #### Hardware | |
| * 4×NVIDIA A100 40GB | |
| #### Software | |
| * Python 3.10 | |
| * Transformers (v4.40+) | |
| * TRL | |
| * Unsloth | |
| * PyTorch 2.1 | |
| ## Citation | |
| **BibTeX:** | |
| ```bibtex | |
| @misc{medillama_2025, | |
| author = {InferenceLab}, | |
| title = {MediLlama-3.2: A Medical Chatbot Fine-Tuned from LLaMA 3.2}, | |
| year = {2025}, | |
| publisher = {HuggingFace}, | |
| howpublished = {\url{https://huggingface.co/InferenceLab/MediLlama-3.2}}, | |
| } | |
| ``` | |
| **APA:** | |
| InferenceLab. (2025). *MediLlama-3.2: A Medical Chatbot Fine-Tuned from LLaMA 3.2*. Hugging Face. [https://huggingface.co/InferenceLab/MediLlama-3.2](https://huggingface.co/InferenceLab/MediLlama-3.2) | |
| ## Glossary | |
| * **SFT**: Supervised Fine-Tuning | |
| * **BLEU**: Bilingual Evaluation Understudy | |
| * **ROUGE**: Recall-Oriented Understudy for Gisting Evaluation | |
| ## More Information | |
| For collaborations, deployment help, or fine-tuning extensions, please contact the developers. | |
| ## Model Card Authors | |
| * InferenceLab Team | |
| ## Model Card Contact | |
| * [contact@inferencelab.ai](mailto:contact@inferencelab.ai) | |