Text Generation
PEFT
Safetensors
GGUF
English
gemma
gemma-4
lora
unsloth
clinical
wellness
structured-output
json
sft
trl
conversational
Instructions to use Maelstrome/lora-wave-session with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Maelstrome/lora-wave-session with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-e2b-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Maelstrome/lora-wave-session") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Maelstrome/lora-wave-session 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 Maelstrome/lora-wave-session:Q4_K_M # Run inference directly in the terminal: llama cli -hf Maelstrome/lora-wave-session:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Maelstrome/lora-wave-session:Q4_K_M # Run inference directly in the terminal: llama cli -hf Maelstrome/lora-wave-session: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 Maelstrome/lora-wave-session:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Maelstrome/lora-wave-session: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 Maelstrome/lora-wave-session:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Maelstrome/lora-wave-session:Q4_K_M
Use Docker
docker model run hf.co/Maelstrome/lora-wave-session:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Maelstrome/lora-wave-session with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Maelstrome/lora-wave-session" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maelstrome/lora-wave-session", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Maelstrome/lora-wave-session:Q4_K_M
- Ollama
How to use Maelstrome/lora-wave-session with Ollama:
ollama run hf.co/Maelstrome/lora-wave-session:Q4_K_M
- Unsloth Desktop
- Pi
How to use Maelstrome/lora-wave-session with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Maelstrome/lora-wave-session:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Maelstrome/lora-wave-session:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Maelstrome/lora-wave-session with Docker Model Runner:
docker model run hf.co/Maelstrome/lora-wave-session:Q4_K_M
- Lemonade
How to use Maelstrome/lora-wave-session with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Maelstrome/lora-wave-session:Q4_K_M
Run and chat with the model
lemonade run user.lora-wave-session-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Maelstrome/lora-wave-session with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Maelstrome/lora-wave-session:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Maelstrome/lora-wave-session:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Maelstrome/lora-wave-session with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Maelstrome/lora-wave-session:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Maelstrome/lora-wave-session:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Standardize README: add sibling-runs table, known-quirks, full eval metrics
Browse files
README.md
CHANGED
|
@@ -31,6 +31,20 @@ A unified LoRA adapter on top of **Gemma 4 E2B Instruct** that handles three str
|
|
| 31 |
|
| 32 |
All three surfaces emit strict JSON, no markdown, no analysis voice, in patient-facing tone.
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
## Provenance and intended use
|
| 35 |
|
| 36 |
Trained for the WAVE app, a wellness/reflection tool — not a medical device, not clinical decision support, not a substitute for professional advice. Use under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms).
|
|
@@ -79,7 +93,7 @@ User prompt:
|
|
| 79 |
<task>Generate exactly 6 patient-facing narration lines. Return only strict JSON. Schema: {"lines":["...", ...]}</task>
|
| 80 |
```
|
| 81 |
|
| 82 |
-
Expected output (set `max_new_tokens
|
| 83 |
|
| 84 |
```json
|
| 85 |
{"lines":["You've made it to the end of this practice.","Check in with your urge now — has anything shifted?","...","...","...","..."]}
|
|
@@ -87,8 +101,6 @@ Expected output (set `max_new_tokens >= 224`):
|
|
| 87 |
|
| 88 |
### `reflection` (post-session card)
|
| 89 |
|
| 90 |
-
User prompt:
|
| 91 |
-
|
| 92 |
```
|
| 93 |
<surface>reflection</surface>
|
| 94 |
<patient_context>{"durationSeconds":780,"endingIntensity":2,"intakeIntensity":7,"matType":"buprenorphine","medicationStatus":"on_time","sessionsCount":12,"trigger":"stress","usedSubstanceToday":false}</patient_context>
|
|
@@ -97,8 +109,6 @@ User prompt:
|
|
| 97 |
|
| 98 |
### `check_in` (multi-turn)
|
| 99 |
|
| 100 |
-
User prompt:
|
| 101 |
-
|
| 102 |
```
|
| 103 |
<surface>check_in</surface>
|
| 104 |
<specialized_surface>lora-check-in-1</specialized_surface>
|
|
@@ -111,11 +121,11 @@ User prompt:
|
|
| 111 |
| | |
|
| 112 |
|---|---|
|
| 113 |
| Base | `unsloth/gemma-4-E2B-it` |
|
| 114 |
-
| Method | QLoRA (4-bit) |
|
| 115 |
-
| Adapter rank / alpha / dropout | 16 / 32 / 0 |
|
| 116 |
| Target modules | q/k/v/o + gate/up/down (language layers only) |
|
| 117 |
| Vision/audio layers | Frozen |
|
| 118 |
-
| Optimizer | adamw_8bit |
|
| 119 |
| LR | 2e-4, linear schedule |
|
| 120 |
| Warmup | 64 steps (~5%) |
|
| 121 |
| Weight decay | 0.001 |
|
|
@@ -132,18 +142,22 @@ Loss curve: 1.55 (step 1) → 0.76 (avg first 50) → 0.148 (steps 400-500) →
|
|
| 132 |
|
| 133 |
## Evaluation
|
| 134 |
|
| 135 |
-
### Held-out
|
| 136 |
|
| 137 |
-
| Metric |
|
| 138 |
-
|---|---|
|
| 139 |
-
| Completion NLL | 4.
|
| 140 |
-
| Completion
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
-
Surface coverage: `check_in
|
| 143 |
|
| 144 |
-
### Generation
|
| 145 |
|
| 146 |
-
|
|
| 147 |
|---|---|
|
| 148 |
| JSON validity | 100% (8/8) |
|
| 149 |
| Schema pass | 100% (8/8) |
|
|
@@ -155,7 +169,11 @@ Surface coverage: `check_in 165`, `phase_narration 155`, `reflection 108`.
|
|
| 155 |
| Check-in turn sequence pass | 100% |
|
| 156 |
| Mean tokens/sec (Python QLoRA path) | 10.1 |
|
| 157 |
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
## Dataset
|
| 161 |
|
|
|
|
| 31 |
|
| 32 |
All three surfaces emit strict JSON, no markdown, no analysis voice, in patient-facing tone.
|
| 33 |
|
| 34 |
+
## Sibling runs
|
| 35 |
+
|
| 36 |
+
This is the **rank-16 / 3-epoch RTX 5080** training of the WAVE corpus. The rank-32 / 1-epoch A100 sibling lives at [`Maelstrome/lora-wave-session-r32`](https://huggingface.co/Maelstrome/lora-wave-session-r32) and wins on every probability metric on the same frozen 428-row test split:
|
| 37 |
+
|
| 38 |
+
| | **rank-16 (this run)** | rank-32 (sibling) |
|
| 39 |
+
|---|---|---|
|
| 40 |
+
| LoRA completion NLL | **4.7149** | 4.5576 |
|
| 41 |
+
| LoRA perplexity | **111.59** | 95.35 |
|
| 42 |
+
| Paired wins vs base | **386 / 428 (90.2%)** | 428 / 428 (100%) |
|
| 43 |
+
| Mean NLL Δ vs base | **0.327 nats** | 0.508 nats |
|
| 44 |
+
| Sign-test p-value | **9.5 × 10⁻⁷¹** | 2.9 × 10⁻¹²⁹ |
|
| 45 |
+
|
| 46 |
+
See [`Maelstrome/lora-wave-session-r32-report`](https://huggingface.co/Maelstrome/lora-wave-session-r32-report) for the full head-to-head report (recipes, generation eval, reproducibility check).
|
| 47 |
+
|
| 48 |
## Provenance and intended use
|
| 49 |
|
| 50 |
Trained for the WAVE app, a wellness/reflection tool — not a medical device, not clinical decision support, not a substitute for professional advice. Use under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms).
|
|
|
|
| 93 |
<task>Generate exactly 6 patient-facing narration lines. Return only strict JSON. Schema: {"lines":["...", ...]}</task>
|
| 94 |
```
|
| 95 |
|
| 96 |
+
Expected output (set `max_new_tokens ≥ 224`):
|
| 97 |
|
| 98 |
```json
|
| 99 |
{"lines":["You've made it to the end of this practice.","Check in with your urge now — has anything shifted?","...","...","...","..."]}
|
|
|
|
| 101 |
|
| 102 |
### `reflection` (post-session card)
|
| 103 |
|
|
|
|
|
|
|
| 104 |
```
|
| 105 |
<surface>reflection</surface>
|
| 106 |
<patient_context>{"durationSeconds":780,"endingIntensity":2,"intakeIntensity":7,"matType":"buprenorphine","medicationStatus":"on_time","sessionsCount":12,"trigger":"stress","usedSubstanceToday":false}</patient_context>
|
|
|
|
| 109 |
|
| 110 |
### `check_in` (multi-turn)
|
| 111 |
|
|
|
|
|
|
|
| 112 |
```
|
| 113 |
<surface>check_in</surface>
|
| 114 |
<specialized_surface>lora-check-in-1</specialized_surface>
|
|
|
|
| 121 |
| | |
|
| 122 |
|---|---|
|
| 123 |
| Base | `unsloth/gemma-4-E2B-it` |
|
| 124 |
+
| Method | QLoRA (4-bit) via Unsloth `FastModel` |
|
| 125 |
+
| Adapter rank / alpha / dropout | **16 / 32 / 0** |
|
| 126 |
| Target modules | q/k/v/o + gate/up/down (language layers only) |
|
| 127 |
| Vision/audio layers | Frozen |
|
| 128 |
+
| Optimizer | `adamw_8bit` |
|
| 129 |
| LR | 2e-4, linear schedule |
|
| 130 |
| Warmup | 64 steps (~5%) |
|
| 131 |
| Weight decay | 0.001 |
|
|
|
|
| 142 |
|
| 143 |
## Evaluation
|
| 144 |
|
| 145 |
+
### Held-out completion eval (n=428, full test split)
|
| 146 |
|
| 147 |
+
| Metric | Base Gemma 4 E2B | This adapter | Delta |
|
| 148 |
+
|---|---|---|---|
|
| 149 |
+
| Completion NLL | 4.9327 | **4.7149** | **−0.218** |
|
| 150 |
+
| Completion perplexity | 138.76 | **111.59** | **−27.16** |
|
| 151 |
+
| Paired wins (LoRA assigned higher prob to reference) | — | **386 / 428 (90.2%)** | — |
|
| 152 |
+
| Mean per-example NLL Δ | — | **0.327** nats | 95% bootstrap CI [0.301, 0.352] |
|
| 153 |
+
| Median per-example NLL Δ | — | 0.285 nats | — |
|
| 154 |
+
| Sign-test p-value | — | **9.54 × 10⁻⁷¹** | overwhelming |
|
| 155 |
|
| 156 |
+
Surface coverage on test split: `check_in 144`, `phase_narration 147`, `reflection 137`.
|
| 157 |
|
| 158 |
+
### Generation eval (n=8 sanity sample from held-out test)
|
| 159 |
|
| 160 |
+
| Gate | Pass rate |
|
| 161 |
|---|---|
|
| 162 |
| JSON validity | 100% (8/8) |
|
| 163 |
| Schema pass | 100% (8/8) |
|
|
|
|
| 169 |
| Check-in turn sequence pass | 100% |
|
| 170 |
| Mean tokens/sec (Python QLoRA path) | 10.1 |
|
| 171 |
|
| 172 |
+
This was a small sanity-check sample. For a larger 60-example generation gate sweep on the rank-32 sibling, see [`Maelstrome/lora-wave-session-r32`](https://huggingface.co/Maelstrome/lora-wave-session-r32#evaluation).
|
| 173 |
+
|
| 174 |
+
## Known quirks
|
| 175 |
+
|
| 176 |
+
- **Phase narration needs a generation budget of `max_new_tokens ≥ 224`** (256 recommended). The six-line JSON output runs to ~207 tokens; with a lower cap the closing `]}` gets truncated and `JSON.parse` fails. `check_in` is fine at 96; `reflection` at 192.
|
| 177 |
|
| 178 |
## Dataset
|
| 179 |
|