@@ -12,29 +12,54 @@ class TestVisualLanguageChat:
1212 @pytest .mark .vlm
1313 @pytest .mark .samples
1414 @pytest .mark .parametrize (
15- "convert_model, sample_args " ,
15+ "convert_model, download_test_content, questions " ,
1616 [
17- pytest .param ("llava-1.5-7b-hf" , 'Who drew this painting?\n When did the painter live?' ),
18- pytest .param ("llava-v1.6-mistral-7b-hf" , 'Who drew this painting?\n When did the painter live?' ),
19- pytest .param ("InternVL2-1B" , 'Who drew this painting?\n When did the painter live?' ),
20- pytest .param ("Qwen2-VL-2B-Instruct" , 'Who drew this painting?\n When did the painter live?' ),
17+ pytest .param ("llava-1.5-7b-hf" , "monalisa.jpg" , 'Who drew this painting?\n When did the painter live?' ),
18+ pytest .param ("llava-v1.6-mistral-7b-hf" , "monalisa.jpg" , 'Who drew this painting?\n When did the painter live?' ),
19+ pytest .param ("InternVL2-1B" , "monalisa.jpg" , 'Who drew this painting?\n When did the painter live?' ),
20+ pytest .param ("Qwen2-VL-2B-Instruct" , "monalisa.jpg" , 'Who drew this painting?\n When did the painter live?' ),
21+ pytest .param ("tiny-random-minicpmv-2_6" , "images/image.png" , 'What is unusual on this image?\n Go on.' )
2122 ],
22- indirect = ["convert_model" ],
23+ indirect = ["convert_model" , "download_test_content" ],
2324 )
24- @pytest .mark .parametrize ("download_test_content" , ["monalisa.jpg" ], indirect = True )
25- def test_sample_visual_language_chat (self , request , convert_model , download_test_content , sample_args ):
25+ def test_sample_visual_language_chat (self , request , convert_model , download_test_content , questions ):
2626 model_name = request .node .callspec .params ['convert_model' ]
2727
2828 # Test Python sample
2929 py_script = os .path .join (SAMPLES_PY_DIR , "visual_language_chat/visual_language_chat.py" )
3030 py_command = [sys .executable , py_script , convert_model , download_test_content ]
31- py_result = run_sample (py_command , sample_args )
31+ py_result = run_sample (py_command , questions )
3232
3333 # Test CPP sample
3434 cpp_sample = os .path .join (SAMPLES_CPP_DIR , 'visual_language_chat' )
3535 cpp_command = [cpp_sample , convert_model , download_test_content ]
36- cpp_result = run_sample (cpp_command , sample_args )
36+ cpp_result = run_sample (cpp_command , questions )
3737
3838 # Compare results
3939 if model_name != "Qwen2-VL-2B-Instruct" : # "Skipping result comparison for Qwen2-VL-2B-Instruct due to CVS-164144"
4040 assert py_result .stdout == cpp_result .stdout , f"Results should match"
41+
42+ @pytest .mark .vlm
43+ @pytest .mark .samples
44+ @pytest .mark .parametrize (
45+ "convert_model, questions" ,
46+ [
47+ pytest .param ("tiny-random-minicpmv-2_6" , 'Describe the images?' ),
48+ ],
49+ indirect = ["convert_model" ],
50+ )
51+ @pytest .mark .parametrize ("download_test_content" , ["images/image.png" ], indirect = True )
52+ @pytest .mark .parametrize ("generate_test_content" , ["images/lines.png" ], indirect = True )
53+ def test_sample_visual_language_chat_images (self , convert_model , download_test_content , generate_test_content , questions ):
54+ # Test Python sample
55+ py_script = os .path .join (SAMPLES_PY_DIR , "visual_language_chat/visual_language_chat.py" )
56+ py_command = [sys .executable , py_script , convert_model , os .path .dirname (generate_test_content )]
57+ py_result = run_sample (py_command , questions )
58+
59+ # Test CPP sample
60+ cpp_sample = os .path .join (SAMPLES_CPP_DIR , 'visual_language_chat' )
61+ cpp_command = [cpp_sample , convert_model , os .path .dirname (generate_test_content )]
62+ cpp_result = run_sample (cpp_command , questions )
63+
64+ # Compare results
65+ assert py_result .stdout == cpp_result .stdout , f"Results should match"
0 commit comments