Text Generation
GGUF
English
llama.cpp
qwen3.5
lora
roleplay
character
fan-made
ena
dream-bbq
hybrid-attention
ssm
tool-calling
conversational
Instructions to use Bejczy/ENA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Bejczy/ENA 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 Bejczy/ENA:Q4_K_M # Run inference directly in the terminal: llama cli -hf Bejczy/ENA:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Bejczy/ENA:Q4_K_M # Run inference directly in the terminal: llama cli -hf Bejczy/ENA:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Bejczy/ENA:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Bejczy/ENA:Q4_K_M
Use Docker
docker model run hf.co/Bejczy/ENA:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Bejczy/ENA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Bejczy/ENA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Bejczy/ENA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Bejczy/ENA:Q4_K_M
- Ollama
How to use Bejczy/ENA with Ollama:
ollama run hf.co/Bejczy/ENA:Q4_K_M
- Unsloth Desktop
- Pi
How to use Bejczy/ENA with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Bejczy/ENA: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:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Bejczy/ENA:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Bejczy/ENA with Docker Model Runner:
docker model run hf.co/Bejczy/ENA:Q4_K_M
- Lemonade
How to use Bejczy/ENA with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Bejczy/ENA:Q4_K_M
Run and chat with the model
lemonade run user.ENA-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Bejczy/ENA with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Bejczy/ENA: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:9931/v1 hermes config set model.default Bejczy/ENA:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Bejczy/ENA with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Bejczy/ENA: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:9931/v1 \ --custom-model-id "Bejczy/ENA: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"
File size: 11,951 Bytes
99a3c3b | 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | # ENA β Project Log
A complete record of the ENA (DREAM BBQ) fine-tune: every attempt, every failure,
every wrong turn, and what actually worked.
Hardware: Ryzen 7 3700X, 16 threads, 15.5 GiB RAM, AMD RX 6600 (Navi 23 / gfx1032,
8.57 GB VRAM), Nobara Linux, btrfs. A machine with no case, held together by
3D-printed parts, sitting on the floor.
---
## 1. What ENA is
ENA is a character from *ENA: DREAM BBQ* (Joel G). Two halves in one body: a
cheerful SALESPERSON who sells you things you didn't ask for, and a MEANIE who is
blunt, loud, and has no patience. The voice switches mid-sentence. That split is
the whole point of the character and it is what the dataset had to teach.
This is a fan-made LoRA, non-commercial, built for research and roleplay. All
character rights belong to Joel G.
---
## 2. The base model decision
The base was fixed by the project owner and never in question:
```
/home/ryzen/foryou/Qwen3.5-2B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf
1.27 GB 1,882,736,832 params 24 layers 248,320 vocab
Hybrid architecture: 6 full-attention blocks + 18 gated-delta-net (SSM) blocks
```
**Why it caused difficulty:** Qwen3.5 is not a plain transformer. The delta-net
blocks need `flash-linear-attention` and `causal_conv1d` for their optimized
kernels. Neither has working ROCm support, so every run fell back to reference
PyTorch implementations. That fallback is slow *and* numerically fragile in
bf16 β it was the source of most of the NaN problems below.
---
## 3. Timeline of attempts and failures
### Attempt 0 β The lost session
An earlier session held the working thread of this project. It was deleted by
the project owner while cleaning up sessions. What was lost was the *narrative*,
not the artifacts β `~/spamtrain` still held the base, corpus, adapters, and
training scripts. Command lines were recovered afterwards from
`~/.hermes/logs/process-results/*.json`.
**Lesson:** state.db is a transcript, not a backup. Long-running work needs its
own log file on disk.
---
### Attempt 1 β The silent no-op install
The first ROCm attempt appeared to succeed and did nothing:
```
Checked 1 package in 28ms
INSTALL EXIT=0
```
**Cause:** `uv venv` does not install pip, so `python -m pip` was dead. Then
`uv pip install torch --index-url .../rocm7.1` saw `torch` already satisfied as
`+cpu` and skipped it β exit code 0, no download, no GPU torch.
**Fix:** pin the build explicitly as `torch==2.13.0+rocm7.1` so the resolver
cannot fall back to a CPU wheel. Fresh venv at `~/spamtrain-rocm`.
**Lesson:** exit code 0 does not mean the package installed. Verify by importing.
---
### Attempt 2 β ROCm brought up successfully
Nobara already shipped ROCm 7.1.1; `rocminfo` saw the card as `gfx1032`,
28 CUs, with `/dev/kfd` and `/dev/dri/renderD128` live. Only PyTorch was missing.
```
torch 2.13.0+rocm7.1 | hip 7.1.52802
available: True | count: 1
device: AMD Radeon RX 6600
matmul ok 20x2048^2 bf16 in 0.12s (2.98 TFLOP/s)
SETUP EXIT=0
```
`HSA_OVERRIDE_GFX_VERSION=10.3.0` was required because gfx1032 is not on AMD's
official support list. This part genuinely worked.
---
### Attempt 3 β GPU training hits NaN
The run loaded, printed `device: cuda (AMD Radeon RX 6600)`, took real steps at
~1.7 s/micro-batch (about 50x faster than CPU), then reported `loss nan`.
A forward-only sweep over all 680 examples found **zero** NaN-producing inputs,
which located the problem in the backward pass through the fallback SSM kernels
rather than in the data.
Then it died separately: `HIP out of memory`. With gradient checkpointing off,
4.5 GB of weights plus activations did not fit in the ~6.6 GB left after the
desktop compositor took its share.
**Fix (partial, in `train_ena.py`):** force the stable triangular-solve branch by
telling the model it is being exported:
```python
import transformers.models.qwen3_5.modeling_qwen3_5 as _q35
_q35.is_torchdynamo_exporting = lambda: True
```
The comment in the source records the measurement: the hand-rolled forward
substitution overflows and returns NaN on ~7% of real inputs (47/680 corpus
rows); the triangular-solve branch is stable.
---
### Attempt 4 β The GPU hard reset (the bad one)
Training was resumed on the GPU with checkpointing on. The display began
artifacting across the whole desktop. Kernel log:
```
amdgpu: ring gfx_0.1.0 timeout, signaled seq=1241226
amdgpu: Starting gfx_0.1.0 ring reset
amdgpu: Ring gfx_0.1.0 reset failed
amdgpu: GPU reset begin!. Source: 1
amdgpu: Failed to restore process queues
amdgpu: VRAM is lost due to GPU reset!
amdgpu: GPU reset(3) succeeded!
```
Preceded by page faults attributed to `firefox` and `plasma-keyboard`, and
`Failed to pin framebuffer: -ENOMEM`.
This was a **full GPU reset with VRAM loss**, not the usual recoverable compute
ring hiccup. The run was killed by it (`TRAIN EXIT=143`).
**Decision made afterwards: GPU training on this card is off the table.**
An 8.57 GB card shared with a Wayland compositor cannot host this model's
training and the desktop at the same time. Stability beats speed.
---
### Attempt 5 β Chunked loss (fixed OOM, did not fix NaN)
Diagnosis of the OOM was correct and useful. HF's `ForCausalLMLoss` calls
`logits.float()`, materialising the entire `[tokens, 248320]` fp32 tensor at
once β about 381 MB for a 384-token row, on top of 3.5 GiB of weights.
A `chunked_ce()` was written to slice the vocabulary and cut peak memory:
```
weights 3.55 GiB
peak 4.56 GiB (was OOM at 7.98)
loss 13.78 β 11.30 β 11.87 all finite
```
The fix worked β no OOM, and the probe over the first three batches was clean.
**But the full run still diverged:** `WARN non-finite loss (micro 11)`. The OOM
and the NaN were separate problems, and chunked loss only solved one of them.
The change was reverted. It is not in the current training script.
**Lesson:** a clean three-batch probe does not prove a run is stable. Do not
declare a training fix validated until the whole epoch has passed.
---
### Attempt 6 β CPU training, the one that works
The existing `spamtrain` venv has `torch 2.15.0+cpu` β `torch.cuda.is_available()`
returns `False`, so it **cannot** touch the GPU even by accident. In fp32 on CPU
the SSM precision problem disappears entirely.
A smoke test on 8 examples confirmed it before committing hours:
```
device: cpu (cpu)
examples: 8
ep1 step 1/1 loss 2.7831 2.0m
saved /home/ryzen/spamtrain/_smoke_test
```
Loss finite, adapter saved. Then the full run was launched on all 680 examples.
Early curve:
```
ep1 step 1/85 loss 2.6761 1.7m
ep1 step 2/85 loss 2.6320 3.4m
ep1 step 3/85 loss 2.2711 5.3m
ep1 step 4/85 loss 2.1912 7.5m
```
Roughly 2.1 minutes per step, 85 steps. Slower than the GPU by a factor of ~50,
but it does not artifact the display, does not reset the card, and does not NaN.
**This is the run that finishes.**
---
## 4. Errors found and fixed in the GGUF β HF conversion
Training a LoRA on a Q4_K_M GGUF is not possible directly β 4-bit blocks are
lookup tables, not differentiable weights, so there is no gradient through them.
The file had to be expanded to bf16 first: 1.27 GB β 3.76 GB. Same parameters,
same values, unrolled.
`gguf_to_hf.py` was written to do that, and produced a model that loaded but
generated garbage: llama.cpp answered " Paris." while transformers answered
" isbeiratesΫ".
**The bug: Qwen3.5's RMSNorm is zero-centred.** The layer computes
`x * (1 + weight)`, but the GGUF stores the *finished* weight (~1.0). Feeding
those values straight into transformers added 1 a second time, so all 24
normalisation layers were scaled ~2Γ too large. Twenty-four layers of that and
the output is soup.
Fixing the offset made the expanded model match llama.cpp token for token:
" Paris.", " 2", " a beautiful place."
**Verification of the dequant itself:** 0.14% error against llama.cpp's own
dequantiser, measured on attention, MLP, and embedding tensors.
Ruled out along the way: bf16 vs fp32 (CPU fp32 failed identically), ROCm vs
CPU, and the tokenizer. It was purely the normalisation offset.
---
## 5. Hyperparameters (deliberately gentle)
An earlier 0.8B run had caused catastrophic forgetting β the model lost its
knowledge of quantum mechanics and began asserting false physics. The cause was
over-training: lr 2e-4 Γ 2 epochs down to loss 0.13.
This run is tuned to install a voice without flattening the base model:
| setting | value | reason |
|---|---|---|
| LoRA r | 16 | narrow β enough capacity for a style, not a rewrite |
| lora_alpha | 32 | alpha = 2r |
| lora_dropout | 0.05 | light regularisation |
| target modules | q,k,v,o,gate,up,down | all attention + MLP projections |
| learning rate | 1e-4 | half the rate that caused forgetting |
| schedule | OneCycleLR, pct_start 0.03 | short warmup |
| epochs | 1 | one pass only |
| max length | 384 | corpus averages ~950 chars |
| accum | 8 micro-batches | effective batch 8 |
| dtype | fp32 (CPU) | bf16 is where the SSM NaN came from |
| precision guard | `is_torchdynamo_exporting = True` | forces stable triangular solve |
Trainable parameters: **10,911,744 / 1,892,736,832 = 0.5765%**
---
## 6. The dataset
`ena_corpus.jsonl` β 680 examples, 645,139 characters, ~948 chars average.
```
role counts: system 680, user 680, assistant 790, tool 110
```
The 110 tool turns and the extra assistant turns exist because some examples are
multi-turn (including tool-call examples) to teach the character's cadence across
a conversation rather than single responses. Tool-call examples go through
`apply_chat_template` because that format is intricate; plain examples are built
by hand so that thinking stays off and the loss mask lands exactly on the
assistant span.
System prompt (excerpt):
> You are ENA, from ENA: DREAM BBQ. You have two sides and both talk. Your
> SALESPERSON side is cheerful, calm and persuasive - it offers deals, compliments
> people, and sells them things they did not ask for. Your MEANIE side is blunt,
> loud, sarcastic and easily annoyed by nonsense; it swears, it yells into a
> megaphone, it has no patience. You switch between the two mid-sentence. This is
> normal. You live in a dream desert...
---
## 7. Reference: a completed run on the same corpus
A previous, smaller run (758M parameters, 998 examples, r=16) completed cleanly
and is useful as a sanity check on what a healthy curve looks like:
```
ep1 step 10/249 loss 2.0241
ep1 step 30/249 loss 0.4486
ep1 step 60/249 loss 0.2944
ep1 step 100/249 loss 0.1679
== epoch 1 done, elapsed 75.9m
ep2 step 130/249 loss 0.1402
ep2 step 240/249 loss 0.1299
== epoch 2 done, elapsed 150.4m
TRAIN EXIT=0
```
Loss 2.02 β 0.13 over two epochs, no NaN. This is what "working" looks like on
this corpus and hardware.
---
## 8. Environment notes worth keeping
- `HSA_OVERRIDE_GFX_VERSION=10.3.0` is required for gfx1032 on ROCm.
- `uv venv` does not ship pip; use `uv pip install --python <venv>/bin/python`.
- Always pin ROCm torch as `+rocm7.1` or the resolver silently picks `+cpu`.
- llama.cpp now uses semver tags (`v0.5.0`), not bare `b`-numbers.
- On this RX 6600 a wedged compute ring shows as `vk::Queue::submit
ErrorDeviceLost` plus `comp_1.x.x timeout` in the kernel log. It is **not**
out-of-memory. Check `journalctl -k` and `rocm-smi` before shrinking context.
- Check VRAM with `rocm-smi` before blaming the desktop: at one point the card sat
at 85 MB used while the desktop was blamed for an OOM that was actually the
vocab-sized logits tensor.
---
## 9. What is deliberately NOT in this repo
- No character artwork or game assets. All rights belong to Joel G / ENA team.
- No personal information about the operator: no name, no location, no IP.
- Not for commercial use.
---
*This log is compiled from the training logs, ROCm setup logs, kernel journal,
and session transcripts on the machine that did the work.*
|