Repository navigation
model: add dots3-note - #27060
model: add dots3-note#27060
Conversation
| const bool has_swa = swa_type != LLAMA_SWA_TYPE_NONE; | ||
|
|
||
| const layer_filter_cb filter_mla_full = [&](int32_t il) { | ||
| if (filter_mla && !filter_mla(il)) { | ||
| return false; | ||
| } | ||
|
|
||
| return !(has_swa && model.hparams.is_swa(il)); | ||
| }; | ||
|
|
||
| const layer_filter_cb filter_mla_swa = [&](int32_t il) { | ||
| if (filter_mla && !filter_mla(il)) { | ||
| return false; | ||
| } | ||
|
|
||
| return model.hparams.is_swa(il); | ||
| }; | ||
|
|
There was a problem hiding this comment.
CC @fairydreaming @ggerganov , I think adding SWA to DSA cache is not too invasive, do you think it's ok to keep this change as-is?
There was a problem hiding this comment.
@ngxson From my understanding SWA in Dots3 is for non-DSA layers (they are ordinary MLA layers that don't use lightning indexer at all), so the cleanest solution that follows other memory classes would be probably to create llama_kv_cache_dsa_iswa class that would combine llama_kv_cache_dsa instance for DSA layers and llama_kv_cache instance for SWA layers.
There was a problem hiding this comment.
that makes sense, I moved the logic to a new llama_kv_cache_dsa_iswa, PTAL: d9de2b2
|
I think this PR is ready to be reviewed as-is 2 follow-up PRs planned: multimodal (see xsn/dots3-note...xsn/dots3-note-mtmd) and MTP support (TODO) |
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa
Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Signed-off-by: JenySadadia <jeny.sadadia@collabora.com>
Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit 2d5615b) b10297 rebase: - implement seq_token_count for the new upstream llama_kv_cache_msa wrapper (delegates to kv_base, same pattern as llama_kv_cache_dsa). --- llama: add seq_token_count override for the DSA KV cache Signed-off-by: Marcus Edel <marcus.edel@collabora.com> (cherry picked from commit 0eeebe0) --- b9840 rebase: - seq_token_count() is a pure-virtual on llama_memory_i (added by "llama: add sequence token count memory API"), so every memory implementation must override it or it stays abstract. - upstream 8c146a8 ("DeepSeek V4", ggml-org#24162) introduced a second DSA cache class, llama_kv_cache_dsv4, alongside llama_kv_cache_dsa. The target commit only added the override to llama_kv_cache_dsa and missed dsv4, so on b9840 dsv4 is abstract and the tree fails to build. Co-authored-by: Guilherme Gallo <guilherme.gallo@collabora.com> Squashed-with: d885b79b66bc, a6b9695be14d (cherry picked from commit 6c2e317) (cherry picked from commit 6bd56d7) b10796 squash: folded 1 commit. - b10796 rebase: fix `llama_kv_cache_dsa_iswa` --- From a466710: Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Squashed-with: a466710 Co-authored-by: JenySadadia <jeny.sadadia@collabora.com> Assisted-by: Claude Opus 5 (cherry picked from commit b8ce533) (cherry picked from commit a0e0162)
Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit 2d5615b) b10297 rebase: - implement seq_token_count for the new upstream llama_kv_cache_msa wrapper (delegates to kv_base, same pattern as llama_kv_cache_dsa). --- llama: add seq_token_count override for the DSA KV cache Signed-off-by: Marcus Edel <marcus.edel@collabora.com> (cherry picked from commit 0eeebe0) --- b9840 rebase: - seq_token_count() is a pure-virtual on llama_memory_i (added by "llama: add sequence token count memory API"), so every memory implementation must override it or it stays abstract. - upstream 8c146a8 ("DeepSeek V4", ggml-org#24162) introduced a second DSA cache class, llama_kv_cache_dsv4, alongside llama_kv_cache_dsa. The target commit only added the override to llama_kv_cache_dsa and missed dsv4, so on b9840 dsv4 is abstract and the tree fails to build. Co-authored-by: Guilherme Gallo <guilherme.gallo@collabora.com> Squashed-with: d885b79b66bc, a6b9695be14d (cherry picked from commit 6c2e317) (cherry picked from commit 6bd56d7) b10796 squash: folded 1 commit. - b10796 rebase: fix `llama_kv_cache_dsa_iswa` --- From a466710: Implement `seq_token_count` for the new upstream `llama_kv_cache_dsa_iswa` wrapper. Fixes: 5a32f7b ("model: add dots3-note (ggml-org#27060)") Squashed-with: a466710 Co-authored-by: JenySadadia <jeny.sadadia@collabora.com> Assisted-by: Claude Opus 5 (cherry picked from commit b8ce533)
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa

Overview
Support https://huggingface.co/dots-studio/dots3-note-prev
Ref HF impl: huggingface/transformers#47844
So far, the biggest change is DSA + SWA, so the
llama-kv-cache-dsahad to be extendedAdditional information
This PR was tested with a slice (3 layers, 16 experts) from the real weight. Other configs and tokenizer stay unchanged
Logits validation (passed --> good/acceptable NMSE):
TODO:
llama-kv-cache-dsais okRequirements