Skip to content

Commit

Permalink
longrope (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefAlbers authored Jul 12, 2024
1 parent 8bf397e commit bfc1f27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llms/mlx_lm/models/phi3.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def __post_init__(self):
if not all(key in self.rope_scaling for key in required_keys):
raise ValueError(f"rope_scaling must contain keys {required_keys}")

if self.rope_scaling["type"] not in ["su", "linear"]:
if self.rope_scaling["type"] not in ["longrope", "su", "linear"]:
print(
"[WARNING] rope_scaling 'type' currently only supports 'linear' and 'su'; setting rope scaling to false."
"[WARNING] rope_scaling 'type' currently only supports 'linear', 'su', and 'longrope'; setting rope scaling to false."
)
self.rope_scaling = None

Expand All @@ -58,7 +58,7 @@ def __init__(self, args: ModelArgs):
self.o_proj = nn.Linear(n_heads * head_dim, dim, bias=False)

rope_scale = 1.0
if args.rope_scaling and args.rope_scaling["type"] == "su":
if args.rope_scaling and args.rope_scaling["type"] in ["longrope", "su"]:
self.rope = SuScaledRotaryEmbedding(
head_dim,
traditional=False,
Expand Down

0 comments on commit bfc1f27

Please sign in to comment.