🧹 Remove deprecated RotaryEmbedding parts in the Attention layers (#34858)
* update * style * fix missing args * remove last trace of old rope classes * remove deprecated copied from * fix copies * trigger CIs * post rebase clean-up * reverse mistral * cleanup after dropping commits * Add comment
This commit is contained in:
@@ -50,8 +50,6 @@ if is_torch_available():
|
||||
FalconModel,
|
||||
)
|
||||
from transformers.models.falcon.modeling_falcon import (
|
||||
FalconDynamicNTKScalingRotaryEmbedding,
|
||||
FalconLinearScalingRotaryEmbedding,
|
||||
FalconRotaryEmbedding,
|
||||
)
|
||||
|
||||
@@ -484,11 +482,12 @@ class FalconModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
|
||||
|
||||
# Sanity check linear RoPE scaling
|
||||
# New position "x" should match original position with index "x/scaling_factor"
|
||||
linear_scaling_rope = FalconLinearScalingRotaryEmbedding(
|
||||
linear_scaling_rope = FalconRotaryEmbedding(
|
||||
head_dim,
|
||||
max_position_embeddings=config.max_position_embeddings,
|
||||
base=config.rope_theta,
|
||||
scaling_factor=scaling_factor,
|
||||
rope_type="linear",
|
||||
).to(torch_device)
|
||||
linear_cos_short, linear_sin_short = linear_scaling_rope(x, position_ids_short)
|
||||
linear_cos_long, linear_sin_long = linear_scaling_rope(x, position_ids_long)
|
||||
@@ -502,11 +501,12 @@ class FalconModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMix
|
||||
# Sanity check Dynamic NTK RoPE scaling
|
||||
# Scaling should only be observed after a long input is fed. We can observe that the frequencies increase
|
||||
# with scaling_factor (or that `inv_freq` decreases)
|
||||
ntk_scaling_rope = FalconDynamicNTKScalingRotaryEmbedding(
|
||||
ntk_scaling_rope = FalconRotaryEmbedding(
|
||||
head_dim,
|
||||
max_position_embeddings=config.max_position_embeddings,
|
||||
base=config.rope_theta,
|
||||
scaling_factor=scaling_factor,
|
||||
rope_type="dynamic",
|
||||
).to(torch_device)
|
||||
ntk_cos_short, ntk_sin_short = ntk_scaling_rope(x, position_ids_short)
|
||||
ntk_cos_long, ntk_sin_long = ntk_scaling_rope(x, position_ids_long)
|
||||
|
||||
Reference in New Issue
Block a user