Unverified Commit 14e2f123 authored by Cyrus Leung's avatar Cyrus Leung Committed by GitHub
Browse files

[Bugfix] Make `get_mrope_input_positions` instance methods (#27342)


Signed-off-by: default avatarDarkLight1337 <tlleungac@connect.ust.hk>
parent 7c4767f1
...@@ -1404,9 +1404,8 @@ class Ernie4_5_VLMoeForConditionalGeneration( ...@@ -1404,9 +1404,8 @@ class Ernie4_5_VLMoeForConditionalGeneration(
else: else:
self.visual_token_mask = None self.visual_token_mask = None
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
...@@ -619,9 +619,8 @@ class GLM4VForCausalLM( ...@@ -619,9 +619,8 @@ class GLM4VForCausalLM(
return self.transformer.vision(pixel_values) return self.transformer.vision(pixel_values)
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
...@@ -594,9 +594,8 @@ class KeyeVL1_5ForConditionalGeneration( ...@@ -594,9 +594,8 @@ class KeyeVL1_5ForConditionalGeneration(
new_video_embeds.append(video_embeds[start:end]) new_video_embeds.append(video_embeds[start:end])
return tuple(new_video_embeds) return tuple(new_video_embeds)
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
...@@ -986,9 +986,8 @@ class Qwen2_5OmniThinkerForConditionalGeneration( ...@@ -986,9 +986,8 @@ class Qwen2_5OmniThinkerForConditionalGeneration(
def get_language_model(self) -> torch.nn.Module: def get_language_model(self) -> torch.nn.Module:
return self.language_model return self.language_model
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
...@@ -1078,9 +1078,8 @@ class Qwen2_5_VLForConditionalGeneration( ...@@ -1078,9 +1078,8 @@ class Qwen2_5_VLForConditionalGeneration(
supports_encoder_tp_data = True supports_encoder_tp_data = True
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
...@@ -1421,7 +1421,6 @@ class Qwen3OmniMoeThinkerForConditionalGeneration( ...@@ -1421,7 +1421,6 @@ class Qwen3OmniMoeThinkerForConditionalGeneration(
return loaded_weights return loaded_weights
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
self, self,
input_tokens: list[int], input_tokens: list[int],
......
...@@ -1480,9 +1480,8 @@ class Qwen3VLForConditionalGeneration( ...@@ -1480,9 +1480,8 @@ class Qwen3VLForConditionalGeneration(
) )
return mm_input_by_modality return mm_input_by_modality
@classmethod
def get_mrope_input_positions( def get_mrope_input_positions(
cls, self,
input_tokens: list[int], input_tokens: list[int],
hf_config: PretrainedConfig, hf_config: PretrainedConfig,
image_grid_thw: list[list[int]] | torch.Tensor, image_grid_thw: list[list[int]] | torch.Tensor,
......
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