[CI/Build] Refactor processing tests (#27470)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Cyrus Leung
2025-10-25 16:14:30 +00:00
committed by GitHub
co-authored by Isotr0py
parent a99564ac5b
commit 66a168a197
4 changed files with 174 additions and 230 deletions
@@ -733,17 +733,21 @@ class Qwen3OmniMoeThinkerMultiModalProcessor(
else (pad_to_hop_length(audio[0], hop_length), audio[1])
for audio in audios
]
mm_kwargs = dict(
**mm_kwargs,
)
# TODO(Isotr0py): Remove this patch after upstream fix PR
# released and Transformers version update:
# https://github.com/huggingface/transformers/pull/41473
if (
Version(TRANSFORMERS_VERSION) < Version("4.58.0")
and "truncation" not in mm_kwargs
):
mm_kwargs["truncation"] = False
mm_kwargs = dict(mm_kwargs)
tok_kwargs = dict(tok_kwargs)
if Version(TRANSFORMERS_VERSION) < Version("4.58.0"):
# move truncation to audio_kwargs level to avoid conflict
# with tok_kwargs
mm_kwargs["audio_kwargs"] = {
"truncation": mm_kwargs.pop("truncation", False)
}
mm_kwargs["text_kwargs"] = {
"truncation": tok_kwargs.pop("truncation", False)
}
hf_inputs = super()._call_hf_processor(
prompt=prompt,
+3 -7
View File
@@ -898,16 +898,12 @@ class Qwen3VLMultiModalProcessor(BaseMultiModalProcessor[Qwen3VLProcessingInfo])
processor = self.info.get_hf_processor(**mm_kwargs)
# Separate video processing from image processing. Because the videos
# are processed into serval image patches
if (
"videos" in mm_data
and isinstance(mm_data["videos"], list)
and len(mm_data["videos"]) > 0
):
# are processed into several image patches
if videos := mm_data.pop("videos", []):
video_grid_thw_lst = []
pixel_values_videos_lst = []
for item_idx, item in enumerate(mm_data.pop("videos", [])):
for item in videos:
video_array, metadata = item
# NOTE: @JJJYmmm new attr metadata.frames_indices indicates