Skip to content

Commit 0460d92

Browse files
committed
disable context shifting for gemma3
1 parent ca698f0 commit 0460d92

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

gpttype_adapter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,7 @@ void PurgeMissingTokens(llama_context * ctx, llama_context * draft_ctx, std::vec
17921792

17931793
auto shared = LongestCommonSubseq(curr_ctx_without_memory, new_ctx_without_memory);
17941794

1795+
printf("\nSharedSize: %d, LCSTokThreshold: %d, ArrPass: %d\n",shared.size(),LCSTokThreshold,ArrStartWith(new_ctx_without_memory, shared));
17951796
if (shared.size() > LCSTokThreshold && ArrStartWith(new_ctx_without_memory, shared)) // enough tokens in common
17961797
{
17971798
int found = ArrFindIndexOf(current_context_tokens,shared);
@@ -2128,6 +2129,11 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
21282129
printf("Qwen2VL detected! Mrope will be used, and context shift will be disabled!\n");
21292130
kcpp_data->use_contextshift = false;
21302131
}
2132+
if(file_format_meta.model_architecture == GGUFArch::ARCH_GEMMA3)
2133+
{
2134+
printf("Gemma3 detected! Context shift will be disabled!\n");
2135+
kcpp_data->use_contextshift = false;
2136+
}
21312137
model_params.main_gpu = cu_parseinfo_maindevice;
21322138

21332139
#if defined(GGML_USE_CUDA)

model_adapter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ void print_tok_vec(std::vector<float> &embd)
321321
{
322322
fileformatmeta->model_architecture = GGUFArch::ARCH_QWEN2VL;
323323
}
324+
else if(modelarch=="gemma3")
325+
{
326+
fileformatmeta->model_architecture = GGUFArch::ARCH_GEMMA3;
327+
}
324328
else if(modelarch=="rwkv6")
325329
{
326330
fileformatmeta->model_architecture = GGUFArch::ARCH_RWKV;

model_adapter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ enum GGUFArch
6060
ARCH_QWEN2 = 5,
6161
ARCH_RWKV = 6,
6262
ARCH_QWEN2VL = 7,
63+
ARCH_GEMMA3 = 8,
6364
};
6465

6566
struct FileFormatExtraMeta

0 commit comments

Comments
 (0)