Update rope_scaling to rope_parameters in preparation for Transformers v5 (#28542)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -188,7 +188,7 @@ class MiniMaxText01Attention(nn.Module):
|
||||
num_kv_heads: int,
|
||||
rotary_dim: int,
|
||||
max_position: int = 4096 * 32,
|
||||
rope_theta: float = 10000,
|
||||
rope_parameters: dict | None = None,
|
||||
sliding_window: int | None = None,
|
||||
quant_config: QuantizationConfig | None = None,
|
||||
layer_idx: int = None,
|
||||
@@ -214,7 +214,6 @@ class MiniMaxText01Attention(nn.Module):
|
||||
self.q_size = self.num_heads * self.head_dim
|
||||
self.kv_size = self.num_kv_heads * self.head_dim
|
||||
self.scaling = self.head_dim**-0.5
|
||||
self.rope_theta = rope_theta
|
||||
self.sliding_window = sliding_window
|
||||
self.prefix = prefix
|
||||
|
||||
@@ -247,7 +246,7 @@ class MiniMaxText01Attention(nn.Module):
|
||||
head_size=self.head_dim,
|
||||
rotary_dim=rotary_dim,
|
||||
max_position=max_position,
|
||||
base=int(rope_theta),
|
||||
rope_parameters=rope_parameters,
|
||||
is_neox_style=True,
|
||||
dtype=torch.float32,
|
||||
)
|
||||
@@ -287,8 +286,6 @@ class MiniMaxText01DecoderLayer(nn.Module):
|
||||
self.hidden_size = config.hidden_size
|
||||
self.expert_num = expert_num
|
||||
|
||||
rope_theta = getattr(config, "rope_theta", 10000)
|
||||
|
||||
head_dim = getattr(config, "head_dim", None)
|
||||
if head_dim is None:
|
||||
head_dim = config.hidden_size // config.num_attention_heads
|
||||
@@ -328,7 +325,7 @@ class MiniMaxText01DecoderLayer(nn.Module):
|
||||
else head_dim,
|
||||
num_kv_heads=config.num_key_value_heads,
|
||||
max_position=max_position_embeddings,
|
||||
rope_theta=rope_theta,
|
||||
rope_parameters=config.rope_parameters,
|
||||
sliding_window=config.sliding_window,
|
||||
quant_config=quant_config,
|
||||
layer_idx=self._ilayer,
|
||||
|
||||
Reference in New Issue
Block a user