koboldcpp/otherarch/acestep
Alistair Stewart 5ff6cefce0
Fix music generation token stopping (#2057)
* Fix music generation token stopping for quantized models

In Phase 1 lyrics mode, the FSM transitions to CODES state after
TOKEN_THINK_END and disables itself. The quantized Q4_K_M model was
not efficiently generating TOKEN_IM_END to stop the generation,
causing it to continue until hitting the 8192 token limit.

This fix forces TOKEN_IM_END to be generated immediately after
TOKEN_THINK_END in lyrics mode, ensuring clean completion of the
planning phase without excessive token generation.

Testing shows generation now completes in ~500ms instead of 80+
seconds with timeout errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clarify comment - fix applies to all models, not just quantized

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Improve fix: only force TOKEN_IM_END at token limit

Instead of forcing TOKEN_IM_END immediately after TOKEN_THINK_END,
only force it when we've reached the token limit. This allows the model
to generate lyrics after the thinking block while still preventing KV
cache exhaustion.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-23 17:02:14 +08:00
..
mp3 ace step optimizations 2026-03-15 20:58:45 +08:00
ace-qwen3.cpp Fix music generation token stopping (#2057) 2026-03-23 17:02:14 +08:00
acestep_convert.py ace converter 2026-02-26 19:53:02 +08:00
ACESTEP_LICENSE add ace step cpp license info 2026-02-22 13:24:28 +08:00
backend.h initial files for ace step 2026-02-22 13:22:24 +08:00
bpe.h initial files for ace step 2026-02-22 13:22:24 +08:00
cond.h some fixes but some issues 2026-02-25 23:41:32 +08:00
debug.h initial files for ace step 2026-02-22 13:22:24 +08:00
dit-vae.cpp add some debug prints 2026-03-16 16:27:49 +08:00
dit.h wip on ref audio, but it compiles 2026-03-12 23:46:10 +08:00
gguf_weights.h initial files for ace step 2026-02-22 13:22:24 +08:00
music_adapter.cpp better audio runtime reload 2026-03-13 14:02:56 +08:00
quantize-acestep.cpp initial files for ace step 2026-02-22 13:22:24 +08:00
qwen3-lm.h updated ace step cpp 2026-02-23 23:01:10 +08:00
qwen3.h updated ace step cpp 2026-02-23 23:01:10 +08:00
request.cpp wip on ref audio, but it compiles 2026-03-12 23:46:10 +08:00
request.h wip on ref audio, but it compiles 2026-03-12 23:46:10 +08:00
tokenizer.h updated ace step cpp 2026-02-23 23:01:10 +08:00
vae-enc.h wip on ref audio, but it compiles 2026-03-12 23:46:10 +08:00
vae.h claude fixes for ace step, idk man who am i to argue with an agi 2026-03-14 12:27:26 +08:00
weight_ctx.h initial files for ace step 2026-02-22 13:22:24 +08:00