Skip to content

Commit 0779d69

Browse files
authored
Resize rope embeddings for long sequence training (#3586)
1 parent 68a9788 commit 0779d69

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

unsloth/models/llama.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,10 @@ def LlamaModel_fast_forward(
10511051
# Also, transformers 4.45.0 supports granite but with the attention refactor (it always had the refactor)
10521052
# unsloth's check for granite too has "version >= 4.45.0 (rightly so)".
10531053
# so let granite always use the attention refactor implementation.
1054+
1055+
self.rotary_emb.extend_rope_embedding(
1056+
hidden_states, self.config.max_position_embeddings
1057+
)
10541058
position_embeddings = self.rotary_emb.get_cached(
10551059
self.config.max_position_embeddings, hidden_states.device.index
10561060
)

0 commit comments

Comments
 (0)