Skip to content

Commit 31a8954

Browse files
committed
fix(mlx): a RoPE class missing from mlx-lm refuses the state cache instead of breaking the start
1 parent a7c7335 commit 31a8954

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎basal/engine.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3760,7 +3760,8 @@ def _cache_rope_ok(self):
37603760
match the longer one; a RoPE of any other kind is refused as well."""
37613761
import mlx.nn as nn
37623762
from mlx_lm.models import rope_utils as ru
3763-
fixed = (nn.RoPE, ru.Llama3RoPE, ru.YarnRoPE, ru.SuScaledRoPE, ru.ProportionalRoPE)
3763+
names = ("Llama3RoPE", "YarnRoPE", "SuScaledRoPE", "ProportionalRoPE") # a kind a later mlx-lm renames is refused
3764+
fixed = (nn.RoPE, *(c for c in (getattr(ru, n, None) for n in names) if c is not None))
37643765
for layer in self.lm.model.layers:
37653766
rope = getattr(getattr(layer, "self_attn", None), "rope", None)
37663767
rope = getattr(rope, "rope", rope) # under --mlx-packed's PositionRoPE

0 commit comments

Comments
 (0)