model: add dots3-note (#27060)
* text: conversion * init impl * address review comments * fix rope * move to a new llama_kv_cache_dsa_iswa
This commit is contained in:
@@ -23,6 +23,7 @@ struct llama_memory_context_i;
|
||||
|
||||
class llama_kv_cache_context;
|
||||
class llama_kv_cache_dsa_context;
|
||||
class llama_kv_cache_dsa_iswa_context;
|
||||
class llama_kv_cache_msa_context;
|
||||
class llama_kv_cache_dsv4_raw_context;
|
||||
class llama_kv_cache_dsv4_context;
|
||||
@@ -374,6 +375,9 @@ public:
|
||||
|
||||
bool can_reuse(const llm_graph_params & params) override;
|
||||
|
||||
// like can_reuse, but does not re-bind mctx
|
||||
bool can_reuse_impl(const llm_graph_params & params);
|
||||
|
||||
ggml_tensor * get_k_idxs() const { return self_k_idxs; }
|
||||
|
||||
ggml_tensor * get_kq_mask() const { return self_kq_mask_cnv; }
|
||||
@@ -405,6 +409,9 @@ public:
|
||||
|
||||
bool can_reuse(const llm_graph_params & params) override;
|
||||
|
||||
// like can_reuse, but does not re-bind mctx
|
||||
bool can_reuse_impl(const llm_graph_params & params);
|
||||
|
||||
ggml_tensor * get_k_idxs_mla() const { return self_k_idxs_mla; }
|
||||
ggml_tensor * get_k_idxs_lid() const { return self_k_idxs_lid; }
|
||||
|
||||
@@ -427,6 +434,32 @@ public:
|
||||
const llama_kv_cache_dsa_context * mctx;
|
||||
};
|
||||
|
||||
// DSA input (full-attention layers + indexer) with K-only input for the SWA layers
|
||||
class llm_graph_input_attn_k_dsa_iswa : public llm_graph_input_i {
|
||||
public:
|
||||
llm_graph_input_attn_k_dsa_iswa(
|
||||
std::unique_ptr<llm_graph_input_attn_k_dsa> inp_dsa,
|
||||
std::unique_ptr<llm_graph_input_attn_k> inp_swa,
|
||||
const llama_kv_cache_dsa_iswa_context * mctx) :
|
||||
inp_dsa(std::move(inp_dsa)),
|
||||
inp_swa(std::move(inp_swa)),
|
||||
mctx(mctx) {
|
||||
}
|
||||
~llm_graph_input_attn_k_dsa_iswa() = default;
|
||||
|
||||
void set_input(const llama_ubatch * ubatch) override;
|
||||
|
||||
bool can_reuse(const llm_graph_params & params) override;
|
||||
|
||||
llm_graph_input_attn_k_dsa * get_dsa() const { return inp_dsa.get(); }
|
||||
llm_graph_input_attn_k * get_swa() const { return inp_swa.get(); }
|
||||
|
||||
std::unique_ptr<llm_graph_input_attn_k_dsa> inp_dsa;
|
||||
std::unique_ptr<llm_graph_input_attn_k> inp_swa;
|
||||
|
||||
const llama_kv_cache_dsa_iswa_context * mctx;
|
||||
};
|
||||
|
||||
// standard K/V attention input against the base cache, plus destination indices for the indexer key cache
|
||||
class llm_graph_input_attn_kv_msa : public llm_graph_input_attn_kv {
|
||||
public:
|
||||
@@ -1191,6 +1224,8 @@ struct llm_graph_context {
|
||||
|
||||
llm_graph_input_attn_k_dsa * build_attn_inp_k_dsa() const;
|
||||
|
||||
llm_graph_input_attn_k_dsa_iswa * build_attn_inp_k_dsa_iswa() const;
|
||||
|
||||
llm_graph_input_attn_kv_msa * build_attn_inp_kv_msa(bool msa_enabled) const;
|
||||
|
||||
ggml_tensor * build_attn(
|
||||
|
||||
Reference in New Issue
Block a user