Unverified Commit 1c9648c4 authored by Suraj Patil's avatar Suraj Patil Committed by GitHub
Browse files

[M2M100, XGLM] fix positional emb resize (#15444)

parent 2ca62683
......@@ -170,7 +170,7 @@ class M2M100SinusoidalPositionalEmbedding(nn.Module):
position_ids = self.create_position_ids_from_inputs_embeds(inputs_embeds)
# expand embeddings if needed
max_pos = self.padding_idx + 1 + seq_len
max_pos = self.padding_idx + 1 + seq_len + past_key_values_length
if max_pos > self.weights.size(0):
self.make_weights(max_pos + self.offset, self.embedding_dim, self.padding_idx)
......
......@@ -214,7 +214,7 @@ class XGLMSinusoidalPositionalEmbedding(nn.Module):
position_ids = self.create_position_ids_from_inputs_embeds(inputs_embeds)
# expand embeddings if needed
max_pos = self.padding_idx + 1 + seq_len
max_pos = self.padding_idx + 1 + seq_len + past_key_values_length
if max_pos > self.weights.size(0):
self.make_weights(max_pos + self.offset, self.embedding_dim, self.padding_idx)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment