From ab59e9e31e5c3266dcfafb75671456b5e150c05b Mon Sep 17 00:00:00 2001 From: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:24:06 -0800 Subject: [PATCH] Add unit tests for Phi vision (#23357) ### Description This PR adds unit tests for [fusing the vision components](https://github.com/microsoft/onnxruntime/pull/20721) of Phi-3 vision and Phi-3.5 vision. ### Motivation and Context Many multi-modal models use a CLIP encoder or a variant of CLIP as part of their encoders. These fusion unit tests will ensure that the vision components of Phi-3 vision and Phi-3.5 vision can still be fused when existing fusions are modified to support more models. --- .../phi-3.5-v-instruct-vision-attention.onnx | Bin 0 -> 7679 bytes .../phi-3.5-v-instruct-vision-layernorm.onnx | Bin 0 -> 459 bytes .../phi-3.5-v-instruct-vision-quickgelu.onnx | 16 ++ .../python/transformers/test_phi_vision.py | 254 ++++++++++++++++++ 4 files changed, 270 insertions(+) create mode 100644 onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-attention.onnx create mode 100644 onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-layernorm.onnx create mode 100644 onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-quickgelu.onnx create mode 100644 onnxruntime/test/python/transformers/test_phi_vision.py diff --git a/onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-attention.onnx b/onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-attention.onnx new file mode 100644 index 0000000000000000000000000000000000000000..a1a1bfc2a8f643737a575a53ea0d08bf0fea4226 GIT binary patch literal 7679 zcmeI1&u-H&7{Kcwt=YE%nbnQb0}_=cq#W{x2__XJv>q#l5Zt&}-kL356FVdh|4zIB zHzclm0A7IGIPeslcmp1RB!xk`R2=AG5?>@su|M12zn|qOpV_88CFQF$ms-Suqf;)k zLzTusn)O$F=eFng!_W8NJ%P1y-f*}(nJ};3vAEXKnX)8R$Iias8MGr=y-?~#(k++x zOyxSsHS_vcpH4;ckiQPnM};Eh4K`~7JQ8oX7E0Rd&<>JJL`rUa{BmpOgplFo0~I^5 zI7n5d4mErr(4YY}ceM@*hm>R=^UIyYQ)X<$DuZ(Tco?Ck0J_)jrCjr~}ZR^?} zD+a4)9ovFcna3;)_$2EYC&ZYyYzhlE1#1?`J+Alii22)h>5Z8IMTn{(x<5r{A=_w_ z4_0RL;1hwr?9dpd#d(8sB6`W+zSF-}%M>dTJ1WxsFDaxDb0OJL%9GFz&8|g8=X8%B zw_0x>EVJ3H()0_{Qo(W``)kMS&b*mV_V~23OjmHP<)VS{#CReD$iPKr!2Y&X+%ETv zyK=#o&iHieBHNF);rT)akO5=>89)Y*0b~FfKn9QjWB?gJ29N<{02#2~8Py-I#+u#u rJNe%jd3Li_bfpw5lh6(rCMlXxwC?_OD64c$qLE=;8LdOTd}@&&9Oe6& literal 0 HcmV?d00001 diff --git a/onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-layernorm.onnx b/onnxruntime/test/python/transformers/test_data/models/phi-3.5-v-instruct-vision-layernorm.onnx new file mode 100644 index 0000000000000000000000000000000000000000..7f312ddeef140973cbc5bde4e1ea30c0601764bc GIT binary patch literal 459 zcmd;J7m~=&%d03V%`3^wP1P$YO3W)x%P-1JEh?5`Gt@IO&@;4Jz|55?B%<$}pI2Ox zm{$^S6rW#OQczkFZy?2uB&x&#Q=w(W#afn_Q<|!!#~~uX<)y)3LmXVd$bxE>F;=UL zsbp0Jmk`MFR#ri&DW%D&zNv|M@djL2eTpoKaFh^}p{W$NPhw?iksmP7;tiC9;GD#q z%&Nqa%=|npK`!>xg5u1a{5;V$N7c<2Ffs~p