[CI/Build] Declare the video modality on the CohereCompass reference model (#60063)

Signed-off-by: Stefan Koncarevic <Stefan.Koncarevic@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
stefankoncarevic
2026-10-05 16:25:42 +00:00
committed by GitHub
co-authored by Andreas Karatzas
parent d23af12cb1
commit 87954c5b04
2 changed files with 17 additions and 0 deletions
@@ -36,6 +36,7 @@ VIDEO_MODEL_SETTINGS: dict[str, dict[str, Any]] = {
"<|VISION_START|><|VIDEO_PAD|><|VISION_END|>Describe this video."
"<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"
),
"patch_hf_runner": model_utils.cohere_compass_patch_hf_runner,
},
"Qwen/Qwen2.5-VL-3B-Instruct": {
"prompt": (
@@ -88,6 +89,9 @@ def test_transformers_video_generation(
model_id, dtype="bfloat16", auto_cls=AutoModelForImageTextToText
) as hf_model:
hf_model = model_utils.qwen3_vl_patch_hf_runner(hf_model)
patch_hf_runner = VIDEO_MODEL_SETTINGS[model_id].get("patch_hf_runner")
if patch_hf_runner is not None:
hf_model = patch_hf_runner(hf_model)
hf_outputs = hf_model.generate_greedy_logprobs_limit(
[prompt], 128, num_logprobs=10, videos=[video]
)
@@ -1111,6 +1111,19 @@ def qwen3_vl_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
return hf_model
def cohere_compass_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
"""Declare the video modality that CohereCompass omits upstream.
Without it ``generate`` leaves ``pixel_values_videos`` unconsumed and the
forward pass rejects it, see huggingface/transformers#49320. Drop this once
the pinned transformers declares the modality itself.
"""
model = hf_model.model
if "video" not in model.input_modalities:
model.input_modalities = (*model.input_modalities, "video")
return hf_model
def voxtral_patch_hf_runner(hf_model: "HfRunner") -> "HfRunner":
"""Patch HfRunner for Voxtral's conversation-based processor.