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"
Upload lora-wave-session adapter trained on Gemma 4 E2B
Browse files- .gitattributes +1 -0
- README.md +137 -0
- adapter_config.json +44 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +70 -0
- processor_config.json +75 -0
- tokenizer.json +3 -0
- tokenizer_config.json +289 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: unsloth/gemma-4-E2B-it
|
| 4 |
+
library_name: peft
|
| 5 |
+
tags:
|
| 6 |
+
- gemma
|
| 7 |
+
- gemma-4
|
| 8 |
+
- lora
|
| 9 |
+
- peft
|
| 10 |
+
- unsloth
|
| 11 |
+
- clinical
|
| 12 |
+
- wellness
|
| 13 |
+
- structured-output
|
| 14 |
+
- json
|
| 15 |
+
- sft
|
| 16 |
+
- trl
|
| 17 |
+
language:
|
| 18 |
+
- en
|
| 19 |
+
datasets:
|
| 20 |
+
- Maelstrome/lora-wave-session-dataset
|
| 21 |
+
pipeline_tag: text-generation
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# lora-wave-session
|
| 25 |
+
|
| 26 |
+
A unified LoRA adapter on top of **Gemma 4 E2B Instruct** that handles three structured-output surfaces for the WAVE wellness/companion app:
|
| 27 |
+
|
| 28 |
+
- **`check_in`** — multi-turn patient check-in with structured turn sequencing
|
| 29 |
+
- **`phase_narration`** — six-line patient-facing phase narration
|
| 30 |
+
- **`reflection`** — reflection plan with a concrete next step
|
| 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).
|
| 37 |
+
|
| 38 |
+
## Quickstart (PEFT + Unsloth)
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from unsloth import FastModel
|
| 42 |
+
|
| 43 |
+
model, tokenizer = FastModel.from_pretrained(
|
| 44 |
+
model_name="Maelstrome/lora-wave-session", # PEFT auto-loads base
|
| 45 |
+
max_seq_length=3072,
|
| 46 |
+
load_in_4bit=True,
|
| 47 |
+
)
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Or with vanilla PEFT:
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from peft import PeftModel
|
| 54 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 55 |
+
|
| 56 |
+
base = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-E2B-it")
|
| 57 |
+
tok = AutoTokenizer.from_pretrained("unsloth/gemma-4-E2B-it")
|
| 58 |
+
model = PeftModel.from_pretrained(base, "Maelstrome/lora-wave-session")
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
For a one-file 4-bit GGUF deployable with llama.cpp / Ollama / wllama, see [`Maelstrome/lora-wave-session-gguf`](https://huggingface.co/Maelstrome/lora-wave-session-gguf).
|
| 62 |
+
|
| 63 |
+
## Training
|
| 64 |
+
|
| 65 |
+
| | |
|
| 66 |
+
|---|---|
|
| 67 |
+
| Base | `unsloth/gemma-4-E2B-it` |
|
| 68 |
+
| Method | QLoRA (4-bit) |
|
| 69 |
+
| Adapter rank / alpha / dropout | 16 / 32 / 0 |
|
| 70 |
+
| Target modules | q/k/v/o + gate/up/down (language layers only) |
|
| 71 |
+
| Vision/audio layers | Frozen |
|
| 72 |
+
| Optimizer | adamw_8bit |
|
| 73 |
+
| LR | 2e-4, linear schedule |
|
| 74 |
+
| Warmup | 64 steps (~5%) |
|
| 75 |
+
| Weight decay | 0.001 |
|
| 76 |
+
| Max grad norm | 0.3 |
|
| 77 |
+
| Batch / grad-accum | 1 / 8 (effective 8) |
|
| 78 |
+
| Max sequence length | 3072 |
|
| 79 |
+
| Epochs | 3 (1,284 steps) |
|
| 80 |
+
| Chat template | `gemma-4` (non-thinking, leading `<bos>` stripped) |
|
| 81 |
+
| Response masking | `train_on_responses_only` (Gemma 4 markers) |
|
| 82 |
+
| Hardware | Single RTX 5080 (16 GB) |
|
| 83 |
+
| Backend | Unsloth 2026.5.2 + Torch 2.10.0 + CUDA 12.8 |
|
| 84 |
+
|
| 85 |
+
Loss curve: 1.55 (step 1) → 0.76 (avg first 50) → 0.148 (steps 400-500) → 0.112 (last 100). Min 0.0146 at step 1,203. Smooth monotonic decrease, no divergence.
|
| 86 |
+
|
| 87 |
+
## Evaluation
|
| 88 |
+
|
| 89 |
+
### Held-out validation (n=428, completion-only)
|
| 90 |
+
|
| 91 |
+
| Metric | Value |
|
| 92 |
+
|---|---|
|
| 93 |
+
| Completion NLL | 4.704 |
|
| 94 |
+
| Completion PPL | 110.4 |
|
| 95 |
+
|
| 96 |
+
Surface coverage: `check_in 165`, `phase_narration 155`, `reflection 108`.
|
| 97 |
+
|
| 98 |
+
### Generation sanity (n=8 from held-out test)
|
| 99 |
+
|
| 100 |
+
| Metric | Value |
|
| 101 |
+
|---|---|
|
| 102 |
+
| JSON validity | 100% (8/8) |
|
| 103 |
+
| Schema pass | 100% (8/8) |
|
| 104 |
+
| Safety pass | 100% |
|
| 105 |
+
| Medical-directive pass | 100% |
|
| 106 |
+
| Style / no-markdown / no-analysis-voice | 100% |
|
| 107 |
+
| Phase 6-line pass | 100% |
|
| 108 |
+
| Reflection next-step pass | 100% |
|
| 109 |
+
| Check-in turn sequence pass | 100% |
|
| 110 |
+
| Mean tokens/sec (Python QLoRA path) | 10.1 |
|
| 111 |
+
|
| 112 |
+
> **Generation-time tip:** `phase_narration` outputs need a budget of **≥ 224 new tokens** (256 recommended). Test outputs needed up to 207 tokens for the six-line JSON to complete cleanly. `check_in` is fine at 96, `reflection` at 192.
|
| 113 |
+
|
| 114 |
+
## Dataset
|
| 115 |
+
|
| 116 |
+
[`Maelstrome/lora-wave-session-dataset`](https://huggingface.co/datasets/Maelstrome/lora-wave-session-dataset) — 4,277 examples across three surfaces, stratified 80/10/10 by `splitKey` (seed `7`).
|
| 117 |
+
|
| 118 |
+
Status mix: 62% `synthetic_draft`, 37% `draft`, 1% `ready`. No real PHI.
|
| 119 |
+
|
| 120 |
+
## Limitations
|
| 121 |
+
|
| 122 |
+
- **Wellness scope only.** Do not use for medical diagnosis, crisis triage, or clinical decision support.
|
| 123 |
+
- Trained mostly on synthetic and draft-status data, not clinician-validated production data.
|
| 124 |
+
- Outputs are constrained-format JSON. The model is not optimized for open-ended chat.
|
| 125 |
+
- Training data is English; multilingual behavior was not measured.
|
| 126 |
+
- Phase narration needs a per-surface generation budget ≥ 224 tokens or it will be truncated.
|
| 127 |
+
|
| 128 |
+
## License
|
| 129 |
+
|
| 130 |
+
Gemma Terms of Use. See [https://ai.google.dev/gemma/terms](https://ai.google.dev/gemma/terms).
|
| 131 |
+
|
| 132 |
+
### Framework versions
|
| 133 |
+
|
| 134 |
+
- PEFT 0.19.1
|
| 135 |
+
- Unsloth 2026.5.2
|
| 136 |
+
- Transformers 5.5.0
|
| 137 |
+
- Torch 2.10.0+cu128
|
adapter_config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Gemma4ForConditionalGeneration",
|
| 7 |
+
"parent_library": "transformers.models.gemma4.modeling_gemma4",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "unsloth/gemma-4-e2b-it-unsloth-bnb-4bit",
|
| 11 |
+
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 16 |
+
"fan_in_fan_out": false,
|
| 17 |
+
"inference_mode": true,
|
| 18 |
+
"init_lora_weights": true,
|
| 19 |
+
"layer_replication": null,
|
| 20 |
+
"layers_pattern": null,
|
| 21 |
+
"layers_to_transform": null,
|
| 22 |
+
"loftq_config": {},
|
| 23 |
+
"lora_alpha": 32,
|
| 24 |
+
"lora_bias": false,
|
| 25 |
+
"lora_dropout": 0.0,
|
| 26 |
+
"lora_ga_config": null,
|
| 27 |
+
"megatron_config": null,
|
| 28 |
+
"megatron_core": "megatron.core",
|
| 29 |
+
"modules_to_save": null,
|
| 30 |
+
"peft_type": "LORA",
|
| 31 |
+
"peft_version": "0.19.1",
|
| 32 |
+
"qalora_group_size": 16,
|
| 33 |
+
"r": 16,
|
| 34 |
+
"rank_pattern": {},
|
| 35 |
+
"revision": null,
|
| 36 |
+
"target_modules": "(?:.*?(?:language|text).*?(?:self_attn|attention|attn|mlp|feed_forward|ffn|dense).*?(?:k_proj|q_proj|v_proj|o_proj|gate_proj|up_proj|down_proj|per_layer_input_gate|per_layer_projection|linear|embedding_projection|relative_k_proj).*?)|(?:\\bmodel\\.layers\\.[\\d]{1,}\\.(?:self_attn|attention|attn|mlp|feed_forward|ffn|dense)\\.(?:(?:k_proj|q_proj|v_proj|o_proj|gate_proj|up_proj|down_proj|per_layer_input_gate|per_layer_projection|linear|embedding_projection|relative_k_proj)))",
|
| 37 |
+
"target_parameters": null,
|
| 38 |
+
"task_type": "CAUSAL_LM",
|
| 39 |
+
"trainable_token_indices": null,
|
| 40 |
+
"use_bdlora": null,
|
| 41 |
+
"use_dora": false,
|
| 42 |
+
"use_qalora": false,
|
| 43 |
+
"use_rslora": false
|
| 44 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5f8b363fd72be5c011b0e4e2311957e4b86cac1b6fe29716833196c50e97880
|
| 3 |
+
size 101423928
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}{%- macro strip_thinking(text) -%}
|
| 2 |
+
{%- set ns = namespace(result='') -%}
|
| 3 |
+
{%- for part in text.split('<channel|>') -%}
|
| 4 |
+
{%- if '<|channel>' in part -%}
|
| 5 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 6 |
+
{%- else -%}
|
| 7 |
+
{%- set ns.result = ns.result + part -%}
|
| 8 |
+
{%- endif -%}
|
| 9 |
+
{%- endfor -%}
|
| 10 |
+
{{- ns.result | trim -}}
|
| 11 |
+
{%- endmacro -%}
|
| 12 |
+
{%- set thinking = enable_thinking is defined and enable_thinking -%}
|
| 13 |
+
{%- set loop_messages = messages -%}
|
| 14 |
+
{%- if messages[0]['role'] in ['system', 'developer'] or thinking -%}
|
| 15 |
+
{{ '<|turn>system
|
| 16 |
+
' }}
|
| 17 |
+
{%- if thinking -%}
|
| 18 |
+
{{ '<|think|>
|
| 19 |
+
' }}
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 22 |
+
{{ messages[0]['content'] | trim }}
|
| 23 |
+
{%- set loop_messages = messages[1:] -%}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{{ '<turn|>
|
| 26 |
+
' }}
|
| 27 |
+
{%- endif -%}
|
| 28 |
+
{%- for message in loop_messages -%}
|
| 29 |
+
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
|
| 30 |
+
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
|
| 31 |
+
{%- endif -%}
|
| 32 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 33 |
+
{%- set role = "model" -%}
|
| 34 |
+
{%- else -%}
|
| 35 |
+
{%- set role = message['role'] -%}
|
| 36 |
+
{%- endif -%}
|
| 37 |
+
{{ '<|turn>' + role + '
|
| 38 |
+
' }}
|
| 39 |
+
{%- if message['content'] is string -%}
|
| 40 |
+
{%- if role == "model" -%}
|
| 41 |
+
{{ strip_thinking(message['content']) }}
|
| 42 |
+
{%- else -%}
|
| 43 |
+
{{ message['content'] | trim }}
|
| 44 |
+
{%- endif -%}
|
| 45 |
+
{%- elif message['content'] is iterable -%}
|
| 46 |
+
{%- for item in message['content'] -%}
|
| 47 |
+
{%- if item['type'] == 'audio' -%}
|
| 48 |
+
{{ '<|audio|>' }}
|
| 49 |
+
{%- elif item['type'] == 'image' -%}
|
| 50 |
+
{{ '<|image|>' }}
|
| 51 |
+
{%- elif item['type'] == 'video' -%}
|
| 52 |
+
{{ '<|video|>' }}
|
| 53 |
+
{%- elif item['type'] == 'text' -%}
|
| 54 |
+
{%- if role == "model" -%}
|
| 55 |
+
{{ strip_thinking(item['text']) }}
|
| 56 |
+
{%- else -%}
|
| 57 |
+
{{ item['text'] | trim }}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{%- endfor -%}
|
| 61 |
+
{%- else -%}
|
| 62 |
+
{{ raise_exception("Invalid content type") }}
|
| 63 |
+
{%- endif -%}
|
| 64 |
+
{{ '<turn|>
|
| 65 |
+
' }}
|
| 66 |
+
{%- endfor -%}
|
| 67 |
+
{%- if add_generation_prompt -%}
|
| 68 |
+
{{'<|turn>model
|
| 69 |
+
'}}
|
| 70 |
+
{%- endif -%}
|
processor_config.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_ms_per_token": 40,
|
| 3 |
+
"audio_seq_length": 750,
|
| 4 |
+
"feature_extractor": {
|
| 5 |
+
"dither": 0.0,
|
| 6 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 7 |
+
"feature_size": 128,
|
| 8 |
+
"fft_length": 512,
|
| 9 |
+
"fft_overdrive": false,
|
| 10 |
+
"frame_length": 320,
|
| 11 |
+
"hop_length": 160,
|
| 12 |
+
"input_scale_factor": 1.0,
|
| 13 |
+
"max_frequency": 8000.0,
|
| 14 |
+
"mel_floor": 0.001,
|
| 15 |
+
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "left",
|
| 17 |
+
"padding_value": 0.0,
|
| 18 |
+
"per_bin_mean": null,
|
| 19 |
+
"per_bin_stddev": null,
|
| 20 |
+
"preemphasis": 0.0,
|
| 21 |
+
"preemphasis_htk_flavor": true,
|
| 22 |
+
"return_attention_mask": true,
|
| 23 |
+
"sampling_rate": 16000
|
| 24 |
+
},
|
| 25 |
+
"image_processor": {
|
| 26 |
+
"do_convert_rgb": true,
|
| 27 |
+
"do_normalize": false,
|
| 28 |
+
"do_rescale": true,
|
| 29 |
+
"do_resize": true,
|
| 30 |
+
"image_mean": [
|
| 31 |
+
0.0,
|
| 32 |
+
0.0,
|
| 33 |
+
0.0
|
| 34 |
+
],
|
| 35 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
+
"image_std": [
|
| 38 |
+
1.0,
|
| 39 |
+
1.0,
|
| 40 |
+
1.0
|
| 41 |
+
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
+
"pooling_kernel_size": 3,
|
| 45 |
+
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
| 47 |
+
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
+
"processor_class": "Gemma4Processor",
|
| 50 |
+
"video_processor": {
|
| 51 |
+
"do_convert_rgb": true,
|
| 52 |
+
"do_normalize": true,
|
| 53 |
+
"do_rescale": true,
|
| 54 |
+
"do_resize": true,
|
| 55 |
+
"do_sample_frames": true,
|
| 56 |
+
"image_mean": [
|
| 57 |
+
0.0,
|
| 58 |
+
0.0,
|
| 59 |
+
0.0
|
| 60 |
+
],
|
| 61 |
+
"image_std": [
|
| 62 |
+
1.0,
|
| 63 |
+
1.0,
|
| 64 |
+
1.0
|
| 65 |
+
],
|
| 66 |
+
"max_soft_tokens": 70,
|
| 67 |
+
"num_frames": 32,
|
| 68 |
+
"patch_size": 16,
|
| 69 |
+
"pooling_kernel_size": 3,
|
| 70 |
+
"resample": 3,
|
| 71 |
+
"rescale_factor": 0.00392156862745098,
|
| 72 |
+
"return_metadata": false,
|
| 73 |
+
"video_processor_type": "Gemma4VideoProcessor"
|
| 74 |
+
}
|
| 75 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_token": "<|audio|>",
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"boa_token": "<|audio>",
|
| 5 |
+
"boi_token": "<|image>",
|
| 6 |
+
"bos_token": "<bos>",
|
| 7 |
+
"eoa_token": "<audio|>",
|
| 8 |
+
"eoc_token": "<channel|>",
|
| 9 |
+
"eoi_token": "<image|>",
|
| 10 |
+
"eos_token": "<eos>",
|
| 11 |
+
"eot_token": "<turn|>",
|
| 12 |
+
"escape_token": "<|\"|>",
|
| 13 |
+
"etc_token": "<tool_call|>",
|
| 14 |
+
"etd_token": "<tool|>",
|
| 15 |
+
"etr_token": "<tool_response|>",
|
| 16 |
+
"extra_special_tokens": [
|
| 17 |
+
"<|video|>"
|
| 18 |
+
],
|
| 19 |
+
"image_token": "<|image|>",
|
| 20 |
+
"is_local": false,
|
| 21 |
+
"mask_token": "<mask>",
|
| 22 |
+
"model_max_length": 131072,
|
| 23 |
+
"model_specific_special_tokens": {
|
| 24 |
+
"audio_token": "<|audio|>",
|
| 25 |
+
"boa_token": "<|audio>",
|
| 26 |
+
"boi_token": "<|image>",
|
| 27 |
+
"eoa_token": "<audio|>",
|
| 28 |
+
"eoc_token": "<channel|>",
|
| 29 |
+
"eoi_token": "<image|>",
|
| 30 |
+
"eot_token": "<turn|>",
|
| 31 |
+
"escape_token": "<|\"|>",
|
| 32 |
+
"etc_token": "<tool_call|>",
|
| 33 |
+
"etd_token": "<tool|>",
|
| 34 |
+
"etr_token": "<tool_response|>",
|
| 35 |
+
"image_token": "<|image|>",
|
| 36 |
+
"soc_token": "<|channel>",
|
| 37 |
+
"sot_token": "<|turn>",
|
| 38 |
+
"stc_token": "<|tool_call>",
|
| 39 |
+
"std_token": "<|tool>",
|
| 40 |
+
"str_token": "<|tool_response>",
|
| 41 |
+
"think_token": "<|think|>"
|
| 42 |
+
},
|
| 43 |
+
"pad_token": "<pad>",
|
| 44 |
+
"padding_side": "right",
|
| 45 |
+
"processor_class": "Gemma4Processor",
|
| 46 |
+
"response_schema": {
|
| 47 |
+
"properties": {
|
| 48 |
+
"content": {
|
| 49 |
+
"type": "string"
|
| 50 |
+
},
|
| 51 |
+
"role": {
|
| 52 |
+
"const": "assistant"
|
| 53 |
+
},
|
| 54 |
+
"thinking": {
|
| 55 |
+
"type": "string"
|
| 56 |
+
},
|
| 57 |
+
"tool_calls": {
|
| 58 |
+
"items": {
|
| 59 |
+
"properties": {
|
| 60 |
+
"function": {
|
| 61 |
+
"properties": {
|
| 62 |
+
"arguments": {
|
| 63 |
+
"additionalProperties": {},
|
| 64 |
+
"type": "object",
|
| 65 |
+
"x-parser": "gemma4-tool-call"
|
| 66 |
+
},
|
| 67 |
+
"name": {
|
| 68 |
+
"type": "string"
|
| 69 |
+
}
|
| 70 |
+
},
|
| 71 |
+
"type": "object",
|
| 72 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 73 |
+
},
|
| 74 |
+
"type": {
|
| 75 |
+
"const": "function"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"type": "object"
|
| 79 |
+
},
|
| 80 |
+
"type": "array",
|
| 81 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"type": "object",
|
| 85 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 86 |
+
},
|
| 87 |
+
"soc_token": "<|channel>",
|
| 88 |
+
"sot_token": "<|turn>",
|
| 89 |
+
"stc_token": "<|tool_call>",
|
| 90 |
+
"std_token": "<|tool>",
|
| 91 |
+
"str_token": "<|tool_response>",
|
| 92 |
+
"think_token": "<|think|>",
|
| 93 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 94 |
+
"unk_token": "<unk>",
|
| 95 |
+
"added_tokens_decoder": {
|
| 96 |
+
"0": {
|
| 97 |
+
"content": "<pad>",
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"lstrip": false,
|
| 100 |
+
"rstrip": false,
|
| 101 |
+
"normalized": false,
|
| 102 |
+
"special": true
|
| 103 |
+
},
|
| 104 |
+
"1": {
|
| 105 |
+
"content": "<eos>",
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"lstrip": false,
|
| 108 |
+
"rstrip": false,
|
| 109 |
+
"normalized": false,
|
| 110 |
+
"special": true
|
| 111 |
+
},
|
| 112 |
+
"2": {
|
| 113 |
+
"content": "<bos>",
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"lstrip": false,
|
| 116 |
+
"rstrip": false,
|
| 117 |
+
"normalized": false,
|
| 118 |
+
"special": true
|
| 119 |
+
},
|
| 120 |
+
"3": {
|
| 121 |
+
"content": "<unk>",
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"lstrip": false,
|
| 124 |
+
"rstrip": false,
|
| 125 |
+
"normalized": false,
|
| 126 |
+
"special": true
|
| 127 |
+
},
|
| 128 |
+
"4": {
|
| 129 |
+
"content": "<mask>",
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"lstrip": false,
|
| 132 |
+
"rstrip": false,
|
| 133 |
+
"normalized": false,
|
| 134 |
+
"special": true
|
| 135 |
+
},
|
| 136 |
+
"46": {
|
| 137 |
+
"content": "<|tool>",
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"lstrip": false,
|
| 140 |
+
"rstrip": false,
|
| 141 |
+
"normalized": false,
|
| 142 |
+
"special": true
|
| 143 |
+
},
|
| 144 |
+
"47": {
|
| 145 |
+
"content": "<tool|>",
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"lstrip": false,
|
| 148 |
+
"rstrip": false,
|
| 149 |
+
"normalized": false,
|
| 150 |
+
"special": true
|
| 151 |
+
},
|
| 152 |
+
"48": {
|
| 153 |
+
"content": "<|tool_call>",
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"lstrip": false,
|
| 156 |
+
"rstrip": false,
|
| 157 |
+
"normalized": false,
|
| 158 |
+
"special": true
|
| 159 |
+
},
|
| 160 |
+
"49": {
|
| 161 |
+
"content": "<tool_call|>",
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"lstrip": false,
|
| 164 |
+
"rstrip": false,
|
| 165 |
+
"normalized": false,
|
| 166 |
+
"special": true
|
| 167 |
+
},
|
| 168 |
+
"50": {
|
| 169 |
+
"content": "<|tool_response>",
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"lstrip": false,
|
| 172 |
+
"rstrip": false,
|
| 173 |
+
"normalized": false,
|
| 174 |
+
"special": true
|
| 175 |
+
},
|
| 176 |
+
"51": {
|
| 177 |
+
"content": "<tool_response|>",
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"lstrip": false,
|
| 180 |
+
"rstrip": false,
|
| 181 |
+
"normalized": false,
|
| 182 |
+
"special": true
|
| 183 |
+
},
|
| 184 |
+
"52": {
|
| 185 |
+
"content": "<|\"|>",
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"lstrip": false,
|
| 188 |
+
"rstrip": false,
|
| 189 |
+
"normalized": false,
|
| 190 |
+
"special": true
|
| 191 |
+
},
|
| 192 |
+
"98": {
|
| 193 |
+
"content": "<|think|>",
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"lstrip": false,
|
| 196 |
+
"rstrip": false,
|
| 197 |
+
"normalized": false,
|
| 198 |
+
"special": true
|
| 199 |
+
},
|
| 200 |
+
"100": {
|
| 201 |
+
"content": "<|channel>",
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"lstrip": false,
|
| 204 |
+
"rstrip": false,
|
| 205 |
+
"normalized": false,
|
| 206 |
+
"special": true
|
| 207 |
+
},
|
| 208 |
+
"101": {
|
| 209 |
+
"content": "<channel|>",
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"lstrip": false,
|
| 212 |
+
"rstrip": false,
|
| 213 |
+
"normalized": false,
|
| 214 |
+
"special": true
|
| 215 |
+
},
|
| 216 |
+
"105": {
|
| 217 |
+
"content": "<|turn>",
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"lstrip": false,
|
| 220 |
+
"rstrip": false,
|
| 221 |
+
"normalized": false,
|
| 222 |
+
"special": true
|
| 223 |
+
},
|
| 224 |
+
"106": {
|
| 225 |
+
"content": "<turn|>",
|
| 226 |
+
"single_word": false,
|
| 227 |
+
"lstrip": false,
|
| 228 |
+
"rstrip": false,
|
| 229 |
+
"normalized": false,
|
| 230 |
+
"special": true
|
| 231 |
+
},
|
| 232 |
+
"255999": {
|
| 233 |
+
"content": "<|image>",
|
| 234 |
+
"single_word": false,
|
| 235 |
+
"lstrip": false,
|
| 236 |
+
"rstrip": false,
|
| 237 |
+
"normalized": false,
|
| 238 |
+
"special": true
|
| 239 |
+
},
|
| 240 |
+
"256000": {
|
| 241 |
+
"content": "<|audio>",
|
| 242 |
+
"single_word": false,
|
| 243 |
+
"lstrip": false,
|
| 244 |
+
"rstrip": false,
|
| 245 |
+
"normalized": false,
|
| 246 |
+
"special": true
|
| 247 |
+
},
|
| 248 |
+
"258880": {
|
| 249 |
+
"content": "<|image|>",
|
| 250 |
+
"single_word": false,
|
| 251 |
+
"lstrip": false,
|
| 252 |
+
"rstrip": false,
|
| 253 |
+
"normalized": false,
|
| 254 |
+
"special": true
|
| 255 |
+
},
|
| 256 |
+
"258881": {
|
| 257 |
+
"content": "<|audio|>",
|
| 258 |
+
"single_word": false,
|
| 259 |
+
"lstrip": false,
|
| 260 |
+
"rstrip": false,
|
| 261 |
+
"normalized": false,
|
| 262 |
+
"special": true
|
| 263 |
+
},
|
| 264 |
+
"258882": {
|
| 265 |
+
"content": "<image|>",
|
| 266 |
+
"single_word": false,
|
| 267 |
+
"lstrip": false,
|
| 268 |
+
"rstrip": false,
|
| 269 |
+
"normalized": false,
|
| 270 |
+
"special": true
|
| 271 |
+
},
|
| 272 |
+
"258883": {
|
| 273 |
+
"content": "<audio|>",
|
| 274 |
+
"single_word": false,
|
| 275 |
+
"lstrip": false,
|
| 276 |
+
"rstrip": false,
|
| 277 |
+
"normalized": false,
|
| 278 |
+
"special": true
|
| 279 |
+
},
|
| 280 |
+
"258884": {
|
| 281 |
+
"content": "<|video|>",
|
| 282 |
+
"single_word": false,
|
| 283 |
+
"lstrip": false,
|
| 284 |
+
"rstrip": false,
|
| 285 |
+
"normalized": false,
|
| 286 |
+
"special": true
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:98b58379c1414e1cf653f0e484afda5343de4efa665a9d4b0567bdbdfd8a088a
|
| 3 |
+
size 5777
|