[Bugfix] Align vLLM YaRN with Transformers and stop re-scaling max_model_len (#56446)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a5b714eee4
commit
c191787a68
@@ -252,21 +252,28 @@ class MRotaryEmbedding(RotaryEmbeddingBase):
|
||||
# YaRN parameters.
|
||||
*,
|
||||
scaling_factor: float | None = None,
|
||||
extrapolation_factor: float = 1,
|
||||
attn_factor: float = 1,
|
||||
beta_fast: int = 32,
|
||||
beta_slow: int = 1,
|
||||
mscale: float | None = None,
|
||||
mscale_all_dim: float | None = None,
|
||||
attention_factor: float | None = None,
|
||||
truncate: bool = True,
|
||||
) -> None:
|
||||
self.scaling_factor = scaling_factor
|
||||
self.extrapolation_factor = extrapolation_factor
|
||||
self.attn_factor = attn_factor
|
||||
self.beta_fast = beta_fast
|
||||
self.beta_slow = beta_slow
|
||||
self.truncate = truncate
|
||||
if self.scaling_factor is not None:
|
||||
# Get n-d magnitude scaling corrected for interpolation
|
||||
self.mscale = float(yarn_get_mscale(self.scaling_factor) * attn_factor)
|
||||
if attention_factor is not None:
|
||||
self.mscale = float(attention_factor)
|
||||
elif mscale and mscale_all_dim:
|
||||
self.mscale = float(
|
||||
yarn_get_mscale(self.scaling_factor, mscale)
|
||||
/ yarn_get_mscale(self.scaling_factor, mscale_all_dim)
|
||||
)
|
||||
else:
|
||||
self.mscale = float(yarn_get_mscale(self.scaling_factor))
|
||||
else:
|
||||
self.mscale = 1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user