PEFT
Safetensors
GGUF
English
medical
clinical-notes
patient-communication
lora
medgemma
conversational
Instructions to use dejori/note-explain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use dejori/note-explain with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use dejori/note-explain with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf dejori/note-explain:Q4_K_M # Run inference directly in the terminal: llama cli -hf dejori/note-explain:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf dejori/note-explain:Q4_K_M # Run inference directly in the terminal: llama cli -hf dejori/note-explain:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf dejori/note-explain:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf dejori/note-explain:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf dejori/note-explain:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf dejori/note-explain:Q4_K_M
Use Docker
docker model run hf.co/dejori/note-explain:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use dejori/note-explain with Ollama:
ollama run hf.co/dejori/note-explain:Q4_K_M
- Unsloth Studio
How to use dejori/note-explain with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for dejori/note-explain to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for dejori/note-explain to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for dejori/note-explain to start chatting
- Docker Model Runner
How to use dejori/note-explain with Docker Model Runner:
docker model run hf.co/dejori/note-explain:Q4_K_M
- Lemonade
How to use dejori/note-explain with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull dejori/note-explain:Q4_K_M
Run and chat with the model
lemonade run user.note-explain-Q4_K_M
List all available models
lemonade list
- Atomic Chat
File size: 2,688 Bytes
d3cd80a 688c96a d3cd80a 688c96a d3cd80a 688c96a d3cd80a a735493 d3cd80a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ---
license: apache-2.0
tags:
- medical
- clinical-notes
- patient-communication
- lora
- peft
- medgemma
- gguf
language:
- en
library_name: peft
---
# NoteExplain Models
Trained models for clinical note simplification - translating medical documents into patient-friendly language.
## Models
| Model | Base | Description | Overall | Accuracy | Patient-Centered |
|-------|------|-------------|---------|----------|------------------|
| **gemma-2b-distilled** | gemma-2-2b-it | Final mobile model | 70% | 73% | **76%** |
| **gemma-2b-dpo** | gemma-2-2b-it | DPO comparison | **73%** | **82%** | 61% |
| **gemma-9b-dpo** | gemma-2-9b-it | Teacher model | 79% | 91% | 70% |
## GGUF for Mobile/Local Inference
Pre-quantized GGUF models (Q4_K_M, ~1.6GB each) for llama.cpp, Ollama, LM Studio:
| File | Description | Download |
|------|-------------|----------|
| `gguf/gemma-2b-distilled-q4_k_m.gguf` | Distilled model (better patient communication) | [Download](https://huggingface.co/dejori/note-explain/resolve/main/gguf/gemma-2b-distilled-q4_k_m.gguf) |
| `gguf/gemma-2b-dpo-q4_k_m.gguf` | DPO model (higher accuracy) | [Download](https://huggingface.co/dejori/note-explain/resolve/main/gguf/gemma-2b-dpo-q4_k_m.gguf) |
### Quick Start with Ollama
```bash
# Download and run
ollama run hf.co/dejori/note-explain:gemma-2b-distilled-q4_k_m.gguf
```
### Quick Start with llama.cpp
```bash
# Download
wget https://huggingface.co/dejori/note-explain/resolve/main/gguf/gemma-2b-distilled-q4_k_m.gguf
# Run
./llama-cli -m gemma-2b-distilled-q4_k_m.gguf -p "Simplify this clinical note for a patient: [your note]"
```
## LoRA Adapters
For fine-tuning or full-precision inference:
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the distilled model
base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2-2b-it")
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
model = PeftModel.from_pretrained(base_model, "dejori/note-explain", subfolder="gemma-2b-distilled")
# Generate
prompt = "Simplify this clinical note for a patient:\n\n[clinical note]\n\nSimplified version:"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
## Training
- **DPO Training**: MedGemma-27B scored 5 candidate outputs per clinical note, creating preference pairs
- **Distillation**: 9B-DPO model generated high-quality outputs to train the 2B model via SFT
## Dataset
Training data: [dejori/note-explain](https://huggingface.co/datasets/dejori/note-explain)
## License
Apache 2.0
|