Update llms/mlx_lm/models/cohere2.py

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>
This commit is contained in:
Prince Canuma 2025-01-12 15:23:19 +01:00 committed by GitHub
parent 1107364c3a
commit ad93729dce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,7 +157,8 @@ class CohereModel(nn.Module):
h = self.embed_tokens(inputs)
if mask is None:
mask = create_attention_mask(h, cache, layer_idx=self.args.sliding_window_pattern - 1)
j = self.args.sliding_window_pattern
mask = create_attention_mask(h, cache[j - 1: j])
if cache is None:
cache = [None] * len(self.layers)