Skip to content

Commit

Permalink
Update gemma.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhanchen committed Jul 31, 2024
1 parent fdab3d6 commit d0a7dce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unsloth/models/gemma.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from .llama import *
from ._utils import __version__
import math

try:
from transformers.models.gemma.modeling_gemma import (
Expand Down Expand Up @@ -256,7 +257,7 @@ def forward(self, x, position_ids=None, seq_len=None):
def extend_rope_embedding(self, x, seq_len):
if seq_len <= self.current_rope_size: return
# Iteratively grow by increments of 8192
self.current_rope_size = int(round(seq_len / 8192)) * 8192
self.current_rope_size = math.ceil(seq_len / 8192) * 8192
self._set_cos_sin_cache(self.current_rope_size, device = "cuda:0", dtype = x.dtype)
pass
pass
Expand Down

0 comments on commit d0a7dce

Please sign in to comment.