mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 06:54:39 +08:00
Update cohere2.py
This commit is contained in:
parent
d7638e029c
commit
0e908bddff
@ -156,13 +156,13 @@ class CohereModel(nn.Module):
|
|||||||
):
|
):
|
||||||
h = self.embed_tokens(inputs)
|
h = self.embed_tokens(inputs)
|
||||||
|
|
||||||
|
if cache is None:
|
||||||
|
cache = [None] * len(self.layers)
|
||||||
|
|
||||||
if mask is None:
|
if mask is None:
|
||||||
j = self.args.sliding_window_pattern
|
j = self.args.sliding_window_pattern
|
||||||
mask = create_attention_mask(h, cache[j - 1 : j])
|
mask = create_attention_mask(h, cache[j - 1 : j])
|
||||||
|
|
||||||
if cache is None:
|
|
||||||
cache = [None] * len(self.layers)
|
|
||||||
|
|
||||||
for layer, c in zip(self.layers, cache):
|
for layer, c in zip(self.layers, cache):
|
||||||
h = layer(h, mask, c)
|
h = layer(h, mask, c)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user