Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix Gemma4 31B global attention: k_eq_v with 4 KV heads (#17220)

Henry Lee1a82e6d01f39
diff --git a/comfy/text_encoders/gemma4.py b/comfy/text_encoders/gemma4.py
index bba11b183..bb350802f 100644
--- a/comfy/text_encoders/gemma4.py
+++ b/comfy/text_encoders/gemma4.py
@@ -87,6 +87,8 @@ class Gemma4_31B_Config(Gemma4Config):
num_hidden_layers: int = 60
num_attention_heads: int = 32
num_key_value_heads: int = 16
+ num_global_key_value_heads = 4
+ attention_k_eq_v = True
vision_bidirectional = True
sliding_attention = [1024, 1024, 1024, 1024, 1024, False]
hidden_size_per_layer_input: int = 0