@@ -424,19 +424,31 @@ def test_qwen3_vl_plugin():
424424 tokenizer_module = _load_tokenizer_module (model_name_or_path = "Qwen/Qwen3-VL-30B-A3B-Instruct" )
425425 qwen3_vl_plugin = get_mm_plugin (name = "qwen3_vl" , video_token = "<|video_pad|>" )
426426 check_inputs = {"plugin" : qwen3_vl_plugin , ** tokenizer_module }
427+ video_token = "<|video_pad|>" * frame_seqlen
428+ first_video = (
429+ f"<0.2 seconds><|vision_start|>{ video_token } <|vision_end|>"
430+ f"<1.2 seconds><|vision_start|>{ video_token } <|vision_end|>"
431+ )
432+ second_video = first_video + f"<2.2 seconds><|vision_start|>{ video_token } <|vision_end|>"
433+ videos = [
434+ [Image .new ("RGB" , (32 , 32 ), (255 , 255 , 255 ))] * 4 ,
435+ [Image .new ("RGB" , (32 , 32 ), (255 , 255 , 255 ))] * 6 ,
436+ ]
437+ messages = [
438+ {"role" : "user" , "content" : "Compare these videos: <video> and <video>." },
439+ {"role" : "assistant" , "content" : "They are different." },
440+ ]
427441 check_inputs ["expected_mm_messages" ] = [
428- {
429- key : value .replace (
430- "<video>" , # little different with original processor for default `fps=2` in our repo
431- "<0.2 seconds><|vision_start|>{}<|vision_end|><1.2 seconds><|vision_start|>{}<|vision_end|>" .format (
432- "<|video_pad|>" * frame_seqlen , "<|video_pad|>" * frame_seqlen
433- ),
434- )
435- for key , value in message .items ()
436- }
437- for message in VIDEO_MESSAGES
442+ {key : value .replace ("<video>" , first_video ) for key , value in message .items ()} for message in VIDEO_MESSAGES
438443 ]
439444 _check_plugin (** check_inputs )
445+ assert qwen3_vl_plugin .process_messages (messages , NO_IMAGES , videos , NO_AUDIOS , tokenizer_module ["processor" ]) == [
446+ {
447+ "role" : "user" ,
448+ "content" : f"Compare these videos: { first_video } and { second_video } ." ,
449+ },
450+ {"role" : "assistant" , "content" : "They are different." },
451+ ]
440452
441453
442454@pytest .mark .runs_on (["cpu" , "mps" ])
0 commit comments