Skip to content

Commit

Permalink
fix llama3 rotary in pytorch engine (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
grimoire authored Sep 11, 2024
1 parent e681077 commit edcdd8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lmdeploy/pytorch/backends/default/rotary_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __init__(

inv_freq = self.inv_freq
factor = self.scaling_factor

wavelen = 2 * math.pi / inv_freq
# wavelen < high_freq_wavelen: do nothing
# wavelen > low_freq_wavelen: divide by factor
Expand All @@ -149,7 +150,8 @@ def __init__(
low_freq_wavelen)
inv_freq_llama = torch.where(is_medium_freq, smoothed_inv_freq,
inv_freq_llama)
self.register_buffer('inv_freq_llama', inv_freq_llama)
self.scaling_factor = 1.0
self.register_buffer('inv_freq', inv_freq_llama)


def yarn_find_correction_dim(num_rotations,
Expand Down

0 comments on commit edcdd8e

Please sign in to comment.