Text Generation
Transformers
GGUF
lora
qwen3
health-coaching
non-diagnostic
fine-tuned
conversational
Instructions to use ameowra/qwen3-4b-backpain-fused with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ameowra/qwen3-4b-backpain-fused with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ameowra/qwen3-4b-backpain-fused") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ameowra/qwen3-4b-backpain-fused", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ameowra/qwen3-4b-backpain-fused 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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: llama cli -hf ameowra/qwen3-4b-backpain-fused:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: llama cli -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: ./llama-cli -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ameowra/qwen3-4b-backpain-fused:F16
Use Docker
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- LM Studio
- Jan
- vLLM
How to use ameowra/qwen3-4b-backpain-fused with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ameowra/qwen3-4b-backpain-fused" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ameowra/qwen3-4b-backpain-fused", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- SGLang
How to use ameowra/qwen3-4b-backpain-fused 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 "ameowra/qwen3-4b-backpain-fused" \ --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": "ameowra/qwen3-4b-backpain-fused", "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 "ameowra/qwen3-4b-backpain-fused" \ --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": "ameowra/qwen3-4b-backpain-fused", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ameowra/qwen3-4b-backpain-fused with Ollama:
ollama run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- Unsloth Desktop
- Pi
How to use ameowra/qwen3-4b-backpain-fused with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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": "ameowra/qwen3-4b-backpain-fused:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use ameowra/qwen3-4b-backpain-fused with Docker Model Runner:
docker model run hf.co/ameowra/qwen3-4b-backpain-fused:F16
- Lemonade
How to use ameowra/qwen3-4b-backpain-fused with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ameowra/qwen3-4b-backpain-fused:F16
Run and chat with the model
lemonade run user.qwen3-4b-backpain-fused-F16
List all available models
lemonade list
- Hermes Agent
How to use ameowra/qwen3-4b-backpain-fused with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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 ameowra/qwen3-4b-backpain-fused:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ameowra/qwen3-4b-backpain-fused with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ameowra/qwen3-4b-backpain-fused:F16
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 "ameowra/qwen3-4b-backpain-fused:F16" \ --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"
Update model card: real training details, file listing, corrected usage
Browse files
README.md
CHANGED
|
@@ -11,12 +11,12 @@ tags:
|
|
| 11 |
- fine-tuned
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# Qwen3-4B Back-Pain Coaching (LoRA fine-tune
|
| 15 |
|
| 16 |
-
A LoRA fine-tune of `Qwen/Qwen3-4B-Instruct-2507`,
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
**This is not a diagnostic tool** and is not a substitute for professional
|
| 22 |
medical advice.
|
|
@@ -45,17 +45,46 @@ repo below) that runs *before* the model is ever called and does not
|
|
| 45 |
depend on model behavior. **Deploying this model without an equivalent
|
| 46 |
independent safety layer is not the intended or recommended use.**
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
## Training
|
| 49 |
|
| 50 |
- **Base model**: `Qwen/Qwen3-4B-Instruct-2507`
|
| 51 |
-
- **Method**: LoRA fine-tuning via `mlx_lm.lora` (MLX, Apple Silicon)
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
## System prompt
|
| 61 |
|
|
@@ -79,8 +108,15 @@ general advice.
|
|
| 79 |
|
| 80 |
## Limitations
|
| 81 |
|
| 82 |
-
- Small base model (4B parameters) and a small fine-tuning set (
|
| 83 |
examples) β expect narrower conversational range than a frontier model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
- English only
|
| 85 |
- "Call 000" guidance is Australia-specific; adapt for other regions
|
| 86 |
- General lifestyle advice only, not personalized clinical guidance
|
|
@@ -97,26 +133,32 @@ uv sync --extra inference
|
|
| 97 |
uv run inference/serve.py
|
| 98 |
```
|
| 99 |
|
| 100 |
-
Direct usage via
|
| 101 |
|
| 102 |
```python
|
| 103 |
-
from
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
| 108 |
|
| 109 |
messages = [
|
| 110 |
{"role": "system", "content": "<see System prompt section above>"},
|
| 111 |
{"role": "user", "content": "My lower back has been aching for about a week."},
|
| 112 |
]
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
```
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
`
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- fine-tuned
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Qwen3-4B Back-Pain Coaching (LoRA fine-tune)
|
| 15 |
|
| 16 |
+
A LoRA fine-tune of `Qwen/Qwen3-4B-Instruct-2507`, specialized for
|
| 17 |
+
back-pain coaching conversations: it asks structured intake questions,
|
| 18 |
+
screens for red-flag symptoms, and otherwise suggests general exercises,
|
| 19 |
+
stretches, and lifestyle/diet guidance.
|
| 20 |
|
| 21 |
**This is not a diagnostic tool** and is not a substitute for professional
|
| 22 |
medical advice.
|
|
|
|
| 45 |
depend on model behavior. **Deploying this model without an equivalent
|
| 46 |
independent safety layer is not the intended or recommended use.**
|
| 47 |
|
| 48 |
+
## Files in this repo
|
| 49 |
+
|
| 50 |
+
- `adapter_config.json` + `adapters.safetensors` β the trained LoRA
|
| 51 |
+
adapter (29MB), applied on top of the base model at load time (MLX) or
|
| 52 |
+
used to fuse/convert to another format
|
| 53 |
+
- `qwen3-4b-instruct-2507-backpain-f16.gguf` β full-precision GGUF (~8GB)
|
| 54 |
+
- `qwen3-4b-instruct-2507-backpain-q4_k_m.gguf` β quantized GGUF (~2.5GB),
|
| 55 |
+
the one this project actually serves via `llama-cpp-python`
|
| 56 |
+
|
| 57 |
+
No full fused HF-`transformers`-format safetensors checkpoint is hosted
|
| 58 |
+
here β the adapter was fused directly into an MLX checkpoint and converted
|
| 59 |
+
straight to GGUF, skipping an intermediate HF-format export.
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
hf download ameowra/qwen3-4b-backpain-fused \
|
| 63 |
+
qwen3-4b-instruct-2507-backpain-q4_k_m.gguf --local-dir models/
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
## Training
|
| 67 |
|
| 68 |
- **Base model**: `Qwen/Qwen3-4B-Instruct-2507`
|
| 69 |
+
- **Method**: LoRA fine-tuning via `mlx_lm.lora` (MLX, Apple Silicon) β
|
| 70 |
+
rank 8, dropout 0.0, scale 20.0, 16 of 36 layers tuned (7.34M / 4022M
|
| 71 |
+
trainable params, 0.182%); adam optimizer, lr 1e-5 constant, batch size
|
| 72 |
+
4, max sequence length 2048; fused into the base weights and converted
|
| 73 |
+
to GGUF via `llama.cpp`
|
| 74 |
+
- **Data**: 136 hand-authored chat-format examples (110 train / 26 valid,
|
| 75 |
+
~27,470 tokens/epoch) across 6 categories β structured intake,
|
| 76 |
+
exercise/stretch recommendation, diet/lifestyle guidance, red-flag
|
| 77 |
+
referral, medical-term explanation, and back-muscle anatomy β grounded
|
| 78 |
+
in real sources (Mayo Clinic, NHS Inform, Kaiser, Arthritis UK, Spine
|
| 79 |
+
Health's glossary, NCBI StatPearls, TeachMeAnatomy) collected via
|
| 80 |
+
Firecrawl and paraphrased rather than copied verbatim
|
| 81 |
+
- **Checkpoint selection**: trained for 430 of a nominal 1000 iterations on
|
| 82 |
+
an Apple M5 Max (~1.7 it/s, ~6 minutes wall clock); validation loss
|
| 83 |
+
bottomed out at iteration 100 (0.441) and rose steadily after while
|
| 84 |
+
train loss kept falling β plain overfitting on a small dataset, so
|
| 85 |
+
iteration 100 was selected rather than the final checkpoint. At this
|
| 86 |
+
dataset size, ~100-150 iterations is the useful range; a longer run
|
| 87 |
+
needs more data, not more patience.
|
| 88 |
|
| 89 |
## System prompt
|
| 90 |
|
|
|
|
| 108 |
|
| 109 |
## Limitations
|
| 110 |
|
| 111 |
+
- Small base model (4B parameters) and a small fine-tuning set (136
|
| 112 |
examples) β expect narrower conversational range than a frontier model
|
| 113 |
+
- Style transfer more than knowledge transfer: the adapter mainly changes
|
| 114 |
+
*how* the model responds (ask first, screen, defer, stay
|
| 115 |
+
non-prescriptive) rather than adding back-pain knowledge the base model
|
| 116 |
+
lacked
|
| 117 |
+
- Single-turn training data β multi-turn conversations work if prior turns
|
| 118 |
+
are replayed as history, but every training example was one user turn
|
| 119 |
+
and one reply
|
| 120 |
- English only
|
| 121 |
- "Call 000" guidance is Australia-specific; adapt for other regions
|
| 122 |
- General lifestyle advice only, not personalized clinical guidance
|
|
|
|
| 133 |
uv run inference/serve.py
|
| 134 |
```
|
| 135 |
|
| 136 |
+
Direct usage via MLX, applying the adapter on top of the base model:
|
| 137 |
|
| 138 |
```python
|
| 139 |
+
from mlx_lm import load, generate
|
| 140 |
+
from mlx_lm.sample_utils import make_sampler
|
| 141 |
|
| 142 |
+
model, tokenizer = load(
|
| 143 |
+
"Qwen/Qwen3-4B-Instruct-2507",
|
| 144 |
+
adapter_path="path/to/downloaded/adapter_config.json's directory",
|
| 145 |
+
)
|
| 146 |
|
| 147 |
messages = [
|
| 148 |
{"role": "system", "content": "<see System prompt section above>"},
|
| 149 |
{"role": "user", "content": "My lower back has been aching for about a week."},
|
| 150 |
]
|
| 151 |
+
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
| 152 |
+
print(generate(model, tokenizer, prompt=prompt, max_tokens=512,
|
| 153 |
+
sampler=make_sampler(temp=0.7, top_p=0.9)))
|
| 154 |
```
|
| 155 |
|
| 156 |
+
There is no full fused HF-`transformers`-format checkpoint hosted in this
|
| 157 |
+
repo (see "Files in this repo" above) β direct `transformers` usage would
|
| 158 |
+
require fusing the adapter into the base weights yourself first (e.g. via
|
| 159 |
+
`mlx_lm.fuse` then a HF-format export), or using one of the GGUF builds
|
| 160 |
+
via `llama.cpp`/`llama-cpp-python` as shown above, which is what this
|
| 161 |
+
project's own inference server actually does. See the project repo for
|
| 162 |
+
the full training-to-serving pipeline and the `ProjectScope.md` design
|
| 163 |
+
rationale (structured intake, hardcoded safety layer, planned RAG
|
| 164 |
+
grounding, fully local/offline deployment).
|