disable context shifting for gemma3

This commit is contained in:
Concedo 2025-03-13 20:28:26 +08:00
parent ca698f0cbe
commit 0460d92cc3
3 changed files with 11 additions and 0 deletions

View file

@ -1792,6 +1792,7 @@ void PurgeMissingTokens(llama_context * ctx, llama_context * draft_ctx, std::vec
auto shared = LongestCommonSubseq(curr_ctx_without_memory, new_ctx_without_memory); auto shared = LongestCommonSubseq(curr_ctx_without_memory, new_ctx_without_memory);
printf("\nSharedSize: %d, LCSTokThreshold: %d, ArrPass: %d\n",shared.size(),LCSTokThreshold,ArrStartWith(new_ctx_without_memory, shared));
if (shared.size() > LCSTokThreshold && ArrStartWith(new_ctx_without_memory, shared)) // enough tokens in common if (shared.size() > LCSTokThreshold && ArrStartWith(new_ctx_without_memory, shared)) // enough tokens in common
{ {
int found = ArrFindIndexOf(current_context_tokens,shared); int found = ArrFindIndexOf(current_context_tokens,shared);
@ -2128,6 +2129,11 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
printf("Qwen2VL detected! Mrope will be used, and context shift will be disabled!\n"); printf("Qwen2VL detected! Mrope will be used, and context shift will be disabled!\n");
kcpp_data->use_contextshift = false; kcpp_data->use_contextshift = false;
} }
if(file_format_meta.model_architecture == GGUFArch::ARCH_GEMMA3)
{
printf("Gemma3 detected! Context shift will be disabled!\n");
kcpp_data->use_contextshift = false;
}
model_params.main_gpu = cu_parseinfo_maindevice; model_params.main_gpu = cu_parseinfo_maindevice;
#if defined(GGML_USE_CUDA) #if defined(GGML_USE_CUDA)

View file

@ -321,6 +321,10 @@ void print_tok_vec(std::vector<float> &embd)
{ {
fileformatmeta->model_architecture = GGUFArch::ARCH_QWEN2VL; fileformatmeta->model_architecture = GGUFArch::ARCH_QWEN2VL;
} }
else if(modelarch=="gemma3")
{
fileformatmeta->model_architecture = GGUFArch::ARCH_GEMMA3;
}
else if(modelarch=="rwkv6") else if(modelarch=="rwkv6")
{ {
fileformatmeta->model_architecture = GGUFArch::ARCH_RWKV; fileformatmeta->model_architecture = GGUFArch::ARCH_RWKV;

View file

@ -60,6 +60,7 @@ enum GGUFArch
ARCH_QWEN2 = 5, ARCH_QWEN2 = 5,
ARCH_RWKV = 6, ARCH_RWKV = 6,
ARCH_QWEN2VL = 7, ARCH_QWEN2VL = 7,
ARCH_GEMMA3 = 8,
}; };
struct FileFormatExtraMeta struct FileFormatExtraMeta