Skip to content

[VLM] Clean up models #16873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/offline_inference/mistral-small.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def run_simple_demo(args: argparse.Namespace):
tokenizer_mode="mistral" if args.format == "mistral" else "auto",
config_format="mistral" if args.format == "mistral" else "auto",
load_format="mistral" if args.format == "mistral" else "auto",
limit_mm_per_prompt={"image": 1},
max_model_len=4096,
max_num_seqs=2,
tensor_parallel_size=2,
Expand Down
2 changes: 1 addition & 1 deletion examples/offline_inference/vision_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ def run_qwen2_5_omni(questions: list[str], modality: str):
"max_pixels": 1280 * 28 * 28,
"fps": [1],
},
disable_mm_preprocessor_cache=args.disable_mm_preprocessor_cache,
limit_mm_per_prompt={"image": 1},
)

if modality == "image":
Expand Down
23 changes: 0 additions & 23 deletions vllm/model_executor/models/phi4mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,26 +503,6 @@ def get_feature_extractor(self) -> SequenceFeatureExtractor:
def get_supported_mm_limits(self) -> Mapping[str, Optional[int]]:
return {"audio": None, "image": None}

def get_mm_max_tokens_per_item(
self,
seq_len: int,
mm_counts: Mapping[str, int],
) -> Mapping[str, int]:
return {
"image": self.get_max_image_tokens(),
"audio": self.get_max_audio_tokens(),
}

def get_max_audio_tokens(self) -> int:
sr = self.get_feature_extractor().sampling_rate
num_frames = self.get_audio_num_frames(_AUDIO_MAX_SOUNDFILE_SIZE, sr)
return self._compute_audio_embed_size(num_frames)

def get_max_image_tokens(self) -> int:
target_width, target_height = self.get_image_size_with_most_features()
return self.get_num_image_tokens(image_width=target_width,
image_height=target_height)

def _find_target_aspect_ratio(
self,
orig_width: int,
Expand Down Expand Up @@ -764,9 +744,6 @@ def get_dummy_mm_data(
num_audios = mm_counts.get("audio", 0)
num_images = mm_counts.get("image", 0)

target_width, target_height = \
self.info.get_image_size_with_most_features()

target_width, target_height = \
self.info.get_image_size_with_most_features()

Expand Down
18 changes: 0 additions & 18 deletions vllm/model_executor/models/qwen2_5_omni_thinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,9 @@ def get_feature_extractor(
assert isinstance(feature_extractor, WhisperFeatureExtractor)
return feature_extractor

def get_max_audio_tokens(self) -> int:
hf_config = self.get_hf_config()
max_source_position = hf_config.audio_config.max_source_positions
output_lengths = (max_source_position - 2) // 2 + 1
return output_lengths

def get_supported_mm_limits(self) -> Mapping[str, Optional[int]]:
return {"audio": None, "image": None, "video": None}

def get_mm_max_tokens_per_item(
self,
seq_len: int,
mm_counts: Mapping[str, int],
) -> Mapping[str, int]:
return {
"audio": self.get_max_audio_tokens(),
"image": self.get_max_image_tokens(),
"video": self.get_max_video_tokens(seq_len, mm_counts),
}


class Qwen2_5OmniThinkerDummyInputsBuilder(
BaseDummyInputsBuilder[Qwen2_5OmniThinkerProcessingInfo]):
Expand All @@ -210,7 +193,6 @@ def get_dummy_text(self, mm_counts: Mapping[str, int]) -> str:
return (audio_token * num_audios + image_token * num_images +
video_token * num_videos)

# TODO: @abstractmethod after transition
def get_dummy_mm_data(
self,
seq_len: int,
Expand Down