Skip to content

Commit a1fa8be

Browse files
joshua-j-hongJoshua Hong
andauthored
[Model] Disable sliding window for Gemma3 (#3176)
* Initial commit with gemma3 * Add QK normalization * Format changes and small fixes * Fix sliding window size in config * Fix formatting * Fix import formatting * Remove sliding window size * Set context window to a min of 8192 --------- Co-authored-by: Joshua Hong <jjhong@andrew.cmu.edu>
1 parent 547740a commit a1fa8be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/mlc_llm/model/gemma3/gemma3_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __post_init__(self):
8888
self.prefill_chunk_size = min(self.context_window_size, 8192)
8989
# NOTE: override the context window size with the Gemma2 sliding window size,
9090
# as the sliding window attention every other layer is yet to be supported.
91-
self.context_window_size = self.sliding_window
91+
self.context_window_size = max(self.sliding_window, 8192)
9292

9393

9494
@dataclasses.dataclass
@@ -121,9 +121,9 @@ def __post_init__(self):
121121
if hasattr(self.text_config, k):
122122
setattr(self, k, getattr(self.text_config, k))
123123

124-
if getattr(self, "sliding_window_size") <= 0:
125-
if hasattr(self.text_config, "sliding_window"):
126-
setattr(self, "sliding_window_size", getattr(self.text_config, "sliding_window"))
124+
# if getattr(self, "sliding_window_size") <= 0:
125+
# if hasattr(self.text_config, "sliding_window"):
126+
# setattr(self, "sliding_window_size", getattr(self.text_config, "sliding_window"))
127127

128128

129129
# pylint: disable=invalid-name,missing-docstring

0 commit comments

Comments
 (0)