Skip to content

Commit 022af24

Browse files
yuekaizhangyuekaiz
andauthored
Fix qwen-omni processor text only mode (#40336)
* Fix qwen-omni processor text only mode * remove try except --------- Co-authored-by: yuekaiz <[email protected]>
1 parent c99ed49 commit 022af24

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/transformers/models/qwen2_5_omni/processing_qwen2_5_omni.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,17 @@ def __call__(
195195
if not isinstance(text, list):
196196
text = [text]
197197

198-
text = self.replace_multimodal_special_tokens(
199-
text,
200-
audio_lengths,
201-
image_grid_thw,
202-
video_grid_thw,
203-
video_second_per_grid=video_second_per_grid,
204-
use_audio_in_video=use_audio_in_video,
205-
position_id_per_seconds=position_id_per_seconds,
206-
seconds_per_chunk=seconds_per_chunk,
207-
)
198+
if images is not None or videos is not None or audio is not None:
199+
text = self.replace_multimodal_special_tokens(
200+
text,
201+
audio_lengths,
202+
image_grid_thw,
203+
video_grid_thw,
204+
video_second_per_grid=video_second_per_grid,
205+
use_audio_in_video=use_audio_in_video,
206+
position_id_per_seconds=position_id_per_seconds,
207+
seconds_per_chunk=seconds_per_chunk,
208+
)
208209

209210
texts_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
210211

0 commit comments

Comments
 (0)