Skip to content

Conversation

@Jing1Ling
Copy link

@Jing1Ling Jing1Ling commented Oct 22, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results

Purpose

The current multimodal model warmup logic is tightly coupled with HPUModelRunner, making it difficult to extend when adding new models.
Ideally, HPUModelRunner should only handle abstract warmup flow (e.g., wrap_multimodal_module_in_hpu(), init_multimodal_buckets(), create_dummy_inputs()) without any model-specific conditions.

This PR introduces an extensible MultimodalHandler class to unify the key steps of multimodal model warmup.
By subclassing MultimodalHandler and overriding specific methods, new multimodal models can be easily integrated.

The default implementation targets QwenVL-series models, and a separate Gemma3MultimodalHandler is provided to maintain backward compatibility with Gemma3.

Test Plan

Test Result

[[1, image_h, int(mm_len / image_h)]])
pixel_values = torch.randn(
image_grid_thw[0].prod(),
1176) # TODO: figure out the variable name

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can find a way to change 1176 to "channel * temporal_patch_size * patch_size * patch_size" to avoid magic number.


def compute_input_embedding(self, model, **kwargs):
input_ids = kwargs['input_ids']
if model.config.model_type == 'qwen2_5_omni_thinker':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we refactor the code, we don't need to check it here. we can overwrite this function in qwen2_5_omni_thinker.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants