@@ -335,7 +335,15 @@ def setup_vllm_model(preset: str, dtype: str = "float16") -> str:
335335 "_name_or_path" : f"keras_hub:{ preset } " ,
336336 "keras_hub_preset" : preset ,
337337 "torch_dtype" : dtype ,
338- "model_type" : model_type ,
338+ # transformers maps "gemma3" to the MULTIMODAL Gemma3 config
339+ # class, which ignores top-level dims and sizes the KV cache from
340+ # its text-config defaults (wrong KV head count for e.g.
341+ # gemma3_instruct_1b's MQA). "gemma3_text" is the text-only config
342+ # class that respects the real dims written below.
343+ "model_type" : {
344+ "gemma3" : "gemma3_text" ,
345+ "gemma4" : "gemma3_text" ,
346+ }.get (model_type , model_type ),
339347 "vocab_size" : vocab_size ,
340348 }
341349 if eos_token_id is not None :
@@ -408,6 +416,8 @@ def _derive_arch_config(preset: str) -> dict:
408416 arch ["hidden_size" ] = int (hidden )
409417 if cfg .get ("intermediate_dim" ):
410418 arch ["intermediate_size" ] = int (cfg ["intermediate_dim" ])
419+ if cfg .get ("sliding_window_size" ):
420+ arch ["sliding_window" ] = int (cfg ["sliding_window_size" ])
411421 return arch
412422
413423
0 commit comments