Skip to content

Commit

Permalink
cleanup replacement
Browse files Browse the repository at this point in the history
Signed-off-by: Isotr0py <[email protected]>
  • Loading branch information
Isotr0py committed Dec 15, 2024
1 parent ca58f8b commit e1fdd36
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions vllm/model_executor/models/ultravox.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _apply_hf_processor(
mm_data: MultiModalDataDict,
mm_processor_kwargs: Mapping[str, object],
) -> BatchFeature:
if not mm_data:
if not mm_data or not mm_data.get("audio", None):
return super()._apply_hf_processor(prompt, mm_data,
mm_processor_kwargs)

Expand Down Expand Up @@ -147,17 +147,11 @@ def _get_prompt_replacements(
mm_processor_kwargs: Mapping[str, object],
) -> list[PromptReplacement]:
hf_processor = self._get_hf_processor()
tokenizer = hf_processor.tokenizer
placeholder = hf_processor.audio_token_replacement

placeholder_token = tokenizer.encode(placeholder,
add_special_tokens=False)
assert len(placeholder_token) == 1
placeholder_token = placeholder_token[0]

def get_replacement_ultravox(item_idx: int):
audio_token_len = hf_inputs["audio_token_len"][item_idx]
return [placeholder_token] * audio_token_len
return placeholder * audio_token_len

return [
PromptReplacement(
Expand Down

0 comments on commit e1fdd36

Please sign in to comment.