Repository navigation
Conversation
The context logits belong to the last decode of any slot, so with several server slots the score and the unguided codes were sampled from another sequence. Keep the logits of each own decode in save_logits(), which also does the guidance mix.
|
Pushed a fix for concurrent slots: the yue2 pipeline sampled from llama_get_logits_ith(lctx, -1), which with -np 2 holds the logits of whichever slot decoded last. So the score and the unguided codes (full/melody, cfg 1.0) were drawn from another sequence. Repro on llama-server -np 2, same seed and prompt:
The pipeline now keeps the logits of its own decodes in save_logits(), which also replaces cfg_mix() for the guided codes. With the fix, the concurrent scores are bit identical to the solo ones in both cases, and llama-tts output (full, cover, off) is bit identical before and after. |
The beta reshape landed between sqr and mul, so the mul, sin, sqr, mul, add chain was not consecutive and the backends never fused it. Expand both reshapes first, like qwen3tts does.
|
Second fix: the VAE snake never hit the fused kernel, the beta reshape sat between sqr and mul so the chain was not consecutive. Expanding both reshapes first, like qwen3tts does, fixes it. VAE of a 65 s song on an RTX PRO 6000: 256 ms -> 191 ms (-25%). The unfused path output is bit identical, and the fused one stays at 68.4 dB vs the torch fp32 decoder (68.5 before). We'll do a follow-up that adds a build_snake() to the mtmd graph API, so each model stops hand-rolling the chain and its node order (qwen3tts, yue2, fish_s2 spkenc, chatterbox all carry their own copy today). |
ServeurpersoCom
left a comment
There was a problem hiding this comment.
Tested on RTX PRO 6000 against the torch fp32 reference (same AR ids and noise): NAR x0 cos 0.9999986, VAE cos 0.9999999 (68 dB), end to end STFT cos 0.9999992, tokenizer id-exact on the full cover prompt. Full, cover and off modes all fine, ~10 s for a 65 s song. With the two fixes above, LGTM!
Few small nits :
- the generated ABC score is never returned, so users can't replay it for variations like the reference allows
- -n / n_predict also counts the score tokens: -n 300 in full mode fails before the first code
- no NFC normalization, unlike the reference tokenizer
- parse_special on the user text turns a literal <|codec_5|> in the lyrics into a code
|
ah yeah that makes sense, I planned to hoist the |
|
The Vulkan Apple red isn't from this PR, test-llama-context is flaky on master too. I'm installing Vulkan on my Mac to look into a CI fix. |
|
yup thanks, waiting for @CISC to have a quick look on the conversion script |
|
I think I'll merge this now to unblock other PRs, but feel free to leave review when you're available, I can push a follow-up fix @CISC |
|
|
||
| def generate_extra_tensors(self) -> Iterable[tuple[str, Tensor]]: | ||
| from safetensors.torch import load_file | ||
| path = self.dir_model / VAE_DIR / "model.safetensors" |
There was a problem hiding this comment.
Is it worth it/possible to make a general VAE loader?
There was a problem hiding this comment.
not sure tbh, maybe when there are more models supported and the directory layout are the same, then we can abstract the loader for them
|
Some music generated with this PR (rendered on top of the snake-vae refactor of #32435, which keeps YuE2 bit identical to master): |
Витрина форка обязана идти поверх актуального апстрима, но эта дельта не меняет ни одного байта в наших бинарниках: мастер не является входом сборки. build_kit.ps1 берёт llama-ногу из llama-kit (-S $src, строка 1147), а ggml для Страты - из пина llama-3cf (-DSTRATA_GGML_DIR, строка 1108); в CMakeCache прошлого цикла CMAKE_HOME_DIRECTORY равен .../llama-kit и .../engine. Поэтому мержим и пушим, а пересборку не делаем: она дала бы те же самые байты и только заняла бы окно у сетки. Что изменено? - tools/mtmd (+1326/-13, 15 файлов): поддержка YuE2-3B из ggml-org#32369 (mtmd-helper-gen.cpp +690/-5, mtmd.cpp +330, models/yue2-gen.cpp +89) и порядок vision-эмбеддингов Muse Glimmer из ggml-org#32433 (models/muse-glimmer.cpp +9/-1). Нога у нас не компилируется: LLAMA_BUILD_MTMD=OFF. - common/parsers и common/chat.cpp (+175/-54, 5 файлов): парсер inkling из ggml-org#32381 - inkling.cpp +165 вместо удалённого inkling2.cpp (-46), реестр в parsers.h и sources.cmake. - tools/server (+25/-9, 3 файла): схема и контекст под новые mtmd-модели, README. - conversion и gguf-py (+244/-1, 5 файлов): yue2.py +234, granite.py учитывает max_position_embeddings (ggml-org#32436), inkling2.py (ggml-org#32430). - models/templates (+259, 2 файла): jinja-шаблоны Inkling и Inkling-2-Small. - tests (+99, 2 файла): test-chat.cpp под новый парсер, печать исключения в test-runner.cpp. - ggml/src/ggml-opencl (+112/-1): ядро A7 Q4_K non-MoE и фиксы bin flash-attention prefill (ggml-org#30948, ggml-org#32110); у нас GGML_OPENCL=OFF. - src/llama-grammar.cpp (+2), tools/tts (+6/-2, 2 файла), docs/multimodal/tts.md (+48), skills/code-review/SKILL.md (+5). - всего: 38 файлов, +2301/-80, бинарных нет (git diff --cached --numstat). Зачем? Держать форк-витрину на актуальной базе апстрима, чтобы следующий синк комплекта (перелиновка kit-all-sync) решался по замеру, а не по накопившемуся отставанию. Заодно зафиксировано, что наш CUDA-путь от этого мержа не зависит: из дельты в компилируемых путях только common/ и src/llama-grammar.cpp, а мастер в сборку не входит вовсе. Замеры? - merge-tree refs/heads/master + refs/remotes/origin/master (9581154): rc=0, конфликтных путей 0, предсказанное дерево d7b1ac7 - мерж начат только после этого гейта. - git merge --no-commit --no-ff: rc=0, «Automatic merge went well»; неразрешённых файлов 0. - git diff --cached --numstat: 38 записей, +2301/-80, бинарных 0 (E:/tmp/sync3_numstat.txt, цифровые группы выше взяты из него же, не из памяти). - база мержа 4303cd9; до мержа master == fork/master == 77802f1, status --porcelain пуст. - страховка refs/tags/backup/llama-master-pre-sync3-2026-11-17 = 77802f1, только локально. - стенд на момент мержа: планировщиков 0, python-носителей 0, движков 0, compute-процессов на карте 0 (носитель wait_captures_drain_2026-11-17.ps1 -Check в 02:34); компиляции не было. - leakcheck --prose по этому файлу - последний вызов перед commit -F тем же носителем; при находках или rc=2 коммит не делается. Принятый остаток? - Пересборка комплекта и перелиновка kit-all-sync (29 файлов в компилируемых путях, 0 конфликтов в них, 8 конфликтов вне сборки в .github/workflows) - отдельное окно со сборкой; живые серверы остаются на sync1636, build-dir.txt не тронут. - Сетка: закрыто 38 клеток из 50, 7 cliff и 5 дыр на llama-ноге (мера grid16_gap по обоим дневным журналам) - их добирают очереди съёмки, а не этот коммит. - За пользователем: CI-аппрувы и описания PR; пуш master сделан этим прогоном по явному разрешению «push слияний - пуш разрешаю». Итог Витрина догнала апстрим, не коснувшись бинарников. Точное значение дерева сверяется с предсказанием merge-tree в том же прогоне носителя, а приёмка пуша - по полному хешу из ls-remote, так что «мерж чистый» остаётся проверенным фактом, а не обещанием. --- EN: sync: llama master took 9 upstream commits, no rebuild The fork showcase has to sit on top of current upstream, yet this delta does not change a single byte of our binaries: master is not a build input. build_kit.ps1 takes the llama leg from llama-kit (-S $src, line 1147) and the ggml for Strata from the pinned llama-3cf (-DSTRATA_GGML_DIR, line 1108); last cycle's CMakeCache reports CMAKE_HOME_DIRECTORY as .../llama-kit and .../engine. So we merge and push, and skip the rebuild - it would produce the same bytes while stealing the window from the grid. What changed? - tools/mtmd (+1326/-13, 15 files): YuE2-3B support from ggml-org#32369 (mtmd-helper-gen.cpp +690/-5, mtmd.cpp +330, models/yue2-gen.cpp +89) and Muse Glimmer vision embedding order from ggml-org#32433 (models/muse-glimmer.cpp +9/-1). We do not compile this leg: LLAMA_BUILD_MTMD=OFF. - common/parsers and common/chat.cpp (+175/-54, 5 files): inkling parser from ggml-org#32381 - inkling.cpp +165 replacing the deleted inkling2.cpp (-46), registry in parsers.h and sources.cmake. - tools/server (+25/-9, 3 files): schema and context for the new mtmd models, README. - conversion and gguf-py (+244/-1, 5 files): yue2.py +234, granite.py honours max_position_embeddings (ggml-org#32436), inkling2.py (ggml-org#32430). - models/templates (+259, 2 files): jinja templates for Inkling and Inkling-2-Small. - tests (+99, 2 files): test-chat.cpp for the new parser, exception message in test-runner.cpp. - ggml/src/ggml-opencl (+112/-1): A7 Q4_K non-MoE kernel and the bin flash-attention prefill fixes (ggml-org#30948, ggml-org#32110); we build with GGML_OPENCL=OFF. - src/llama-grammar.cpp (+2), tools/tts (+6/-2, 2 files), docs/multimodal/tts.md (+48), skills/code-review/SKILL.md (+5). - total: 38 files, +2301/-80, no binary files (git diff --cached --numstat). Why? Keep the fork showcase on a current upstream base so that the next kit sync (relining kit-all-sync) is decided by measurement rather than by accumulated lag. This also records that our CUDA path does not depend on the merge: within the delta only common/ and src/llama-grammar.cpp live in compiled paths, and master is not a build input at all. Verified? - merge-tree refs/heads/master + refs/remotes/origin/master (9581154): rc=0, zero conflicting paths, predicted tree d7b1ac7 - the merge started only after this gate. - git merge --no-commit --no-ff: rc=0, "Automatic merge went well"; zero unresolved files. - git diff --cached --numstat: 38 entries, +2301/-80, 0 binary (E:/tmp/sync3_numstat.txt - every number group above comes from it, not from memory). - merge base 4303cd9; before the merge master == fork/master == 77802f1, status clean. - safety ref refs/tags/backup/llama-master-pre-sync3-2026-11-17 = 77802f1, local only. - stand at merge time: 0 queue schedulers, 0 python carriers, 0 engines, 0 compute processes on the GPU (wait_captures_drain_2026-11-17.ps1 -Check at 02:34); nothing was compiled. - leakcheck --prose on this file is the last call before commit -F in the same carrier; on findings or rc=2 the commit does not happen. Accepted remainder? - Kit rebuild and relining kit-all-sync (29 files in compiled paths, 0 conflicts there, 8 conflicts outside the build in .github/workflows) - a separate window with a build; live servers stay on sync1636 and build-dir.txt is untouched. - Grid: 38 of 50 cells closed, 7 cliffs and 5 holes on the llama leg (grid16_gap over both daily journals) - capture queues close those, not this commit. - Up to the user: CI approvals and PR descriptions; the master push was performed by this run under the explicit permission "merges may be pushed". Result The showcase caught up with upstream without touching the binaries. The resulting tree is compared byte-exactly against the merge-tree prediction in the same carrier run, and the push is accepted via a full hash from ls-remote, so "the merge is clean" stays a measured fact rather than a promise.
* mtmd: support YuE2-3B * improve speed * add CFG * fix streaming * add cfg control from api * check ctx size * fix n_predict * add flow_steps config * nits * fix batch api * nits * adapt * mtmd: yue2 samples from its own saved logits The context logits belong to the last decode of any slot, so with several server slots the score and the unguided codes were sampled from another sequence. Keep the logits of each own decode in save_logits(), which also does the guidance mix. * mtmd: let the yue2 snake chain fuse The beta reshape landed between sqr and mul, so the mul, sin, sqr, mul, add chain was not consecutive and the backends never fused it. Expand both reshapes first, like qwen3tts does. --------- Co-authored-by: Pascal <[email protected]>
* mtmd: support YuE2-3B * improve speed * add CFG * fix streaming * add cfg control from api * check ctx size * fix n_predict * add flow_steps config * nits * fix batch api * nits * adapt * mtmd: yue2 samples from its own saved logits The context logits belong to the last decode of any slot, so with several server slots the score and the unguided codes were sampled from another sequence. Keep the logits of each own decode in save_logits(), which also does the guidance mix. * mtmd: let the yue2 snake chain fuse The beta reshape landed between sqr and mul, so the mul, sin, sqr, mul, add chain was not consecutive and the backends never fused it. Expand both reshapes first, like qwen3tts does. --------- Co-authored-by: Pascal <[email protected]>
* mtmd: support YuE2-3B * improve speed * add CFG * fix streaming * add cfg control from api * check ctx size * fix n_predict * add flow_steps config * nits * fix batch api * nits * adapt * mtmd: yue2 samples from its own saved logits The context logits belong to the last decode of any slot, so with several server slots the score and the unguided codes were sampled from another sequence. Keep the logits of each own decode in save_logits(), which also does the guidance mix. * mtmd: let the yue2 snake chain fuse The beta reshape landed between sqr and mul, so the mul, sin, sqr, mul, add chain was not consecutive and the backends never fused it. Expand both reshapes first, like qwen3tts does. --------- Co-authored-by: Pascal <[email protected]>
Overview
Target support https://huggingface.co/m-a-p/YuE2-3B
This model utilize a trick where mtmd owns a
llama_context, initializing it viallama_model_init_from_user. This makes the mmproj an all-in-one file, so from user's perspective it "just work." Other implementation where each piece as one GGUF makes it multiple files, that's quite confusing for the userMissing currently:
-n 16000 -c 24576requirement on CLIflow_stagesRequirements