@@ -117,19 +117,21 @@ def test_text_to_image(self):
117117 images = pipeline (** inputs ).images
118118 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
119119
120- expected_slice = np .array ([0.8110 , 0.8843 , 0.9326 , 0.9224 , 0.9878 , 1.0 , 0.9736 , 1.0 , 1.0 ])
120+ expected_slice = np .array ([0.80810547 , 0.88183594 , 0.9296875 , 0.9189453 , 0.9848633 , 1.0 , 0.97021484 , 1.0 , 1.0 ])
121121
122- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
122+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
123123
124124 pipeline .load_ip_adapter ("h94/IP-Adapter" , subfolder = "models" , weight_name = "ip-adapter-plus_sd15.bin" )
125125
126126 inputs = self .get_dummy_inputs ()
127127 images = pipeline (** inputs ).images
128128 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
129129
130- expected_slice = np .array ([0.3013 , 0.2615 , 0.2202 , 0.2722 , 0.2510 , 0.2023 , 0.2498 , 0.2415 , 0.2139 ])
130+ expected_slice = np .array (
131+ [0.30444336 , 0.26513672 , 0.22436523 , 0.2758789 , 0.25585938 , 0.20751953 , 0.25390625 , 0.24633789 , 0.21923828 ]
132+ )
131133
132- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
134+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
133135
134136 def test_image_to_image (self ):
135137 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
@@ -143,19 +145,23 @@ def test_image_to_image(self):
143145 images = pipeline (** inputs ).images
144146 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
145147
146- expected_slice = np .array ([0.2253 , 0.2251 , 0.2219 , 0.2312 , 0.2236 , 0.2434 , 0.2275 , 0.2575 , 0.2805 ])
148+ expected_slice = np .array (
149+ [0.22167969 , 0.21875 , 0.21728516 , 0.22607422 , 0.21948242 , 0.23925781 , 0.22387695 , 0.25268555 , 0.2722168 ]
150+ )
147151
148- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
152+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
149153
150154 pipeline .load_ip_adapter ("h94/IP-Adapter" , subfolder = "models" , weight_name = "ip-adapter-plus_sd15.bin" )
151155
152156 inputs = self .get_dummy_inputs (for_image_to_image = True )
153157 images = pipeline (** inputs ).images
154158 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
155159
156- expected_slice = np .array ([0.3550 , 0.2600 , 0.2520 , 0.2412 , 0.1870 , 0.3831 , 0.1453 , 0.1880 , 0.5371 ])
160+ expected_slice = np .array (
161+ [0.35913086 , 0.265625 , 0.26367188 , 0.24658203 , 0.19750977 , 0.39990234 , 0.15258789 , 0.20336914 , 0.5517578 ]
162+ )
157163
158- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
164+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
159165
160166 def test_inpainting (self ):
161167 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
@@ -169,19 +175,23 @@ def test_inpainting(self):
169175 images = pipeline (** inputs ).images
170176 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
171177
172- expected_slice = np .array ([0.2700 , 0.2388 , 0.2202 , 0.2304 , 0.2095 , 0.2097 , 0.2173 , 0.2058 , 0.1987 ])
178+ expected_slice = np .array (
179+ [0.27148438 , 0.24047852 , 0.22167969 , 0.23217773 , 0.21118164 , 0.21142578 , 0.21875 , 0.20751953 , 0.20019531 ]
180+ )
173181
174- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
182+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
175183
176184 pipeline .load_ip_adapter ("h94/IP-Adapter" , subfolder = "models" , weight_name = "ip-adapter-plus_sd15.bin" )
177185
178186 inputs = self .get_dummy_inputs (for_inpainting = True )
179187 images = pipeline (** inputs ).images
180188 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
181189
182- expected_slice = np .array ([0.2744 , 0.2410 , 0.2202 , 0.2334 , 0.2090 , 0.2053 , 0.2175 , 0.2033 , 0.1934 ])
190+ expected_slice = np .array (
191+ [0.27294922 , 0.24023438 , 0.21948242 , 0.23242188 , 0.20825195 , 0.2055664 , 0.21679688 , 0.20336914 , 0.19360352 ]
192+ )
183193
184- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
194+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
185195
186196 def test_text_to_image_model_cpu_offload (self ):
187197 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
@@ -224,10 +234,10 @@ def test_text_to_image_full_face(self):
224234 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
225235
226236 expected_slice = np .array (
227- [0.1706543 , 0.1303711 , 0.12573242 , 0.21777344 , 0.14550781 , 0.14038086 , 0.40820312 , 0.41455078 , 0.42529297 ]
237+ [0.18115234 , 0.13500977 , 0.13427734 , 0.24194336 , 0.17138672 , 0.16625977 , 0.4260254 , 0.43359375 , 0.4416504 ]
228238 )
229239
230- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
240+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
231241
232242 def test_unload (self ):
233243 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
@@ -269,9 +279,21 @@ def test_text_to_image_sdxl(self):
269279 images = pipeline (** inputs ).images
270280 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
271281
272- expected_slice = np .array ([0.0965 , 0.0956 , 0.0849 , 0.0908 , 0.0944 , 0.0927 , 0.0888 , 0.0929 , 0.0920 ])
282+ expected_slice = np .array (
283+ [
284+ 0.09630299 ,
285+ 0.09551358 ,
286+ 0.08480701 ,
287+ 0.09070173 ,
288+ 0.09437338 ,
289+ 0.09264627 ,
290+ 0.08883232 ,
291+ 0.09287417 ,
292+ 0.09197289 ,
293+ ]
294+ )
273295
274- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
296+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
275297
276298 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
277299
@@ -292,9 +314,11 @@ def test_text_to_image_sdxl(self):
292314 images = pipeline (** inputs ).images
293315 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
294316
295- expected_slice = np .array ([0.0592 , 0.0573 , 0.0459 , 0.0542 , 0.0559 , 0.0523 , 0.0500 , 0.0540 , 0.0501 ])
317+ expected_slice = np .array (
318+ [0.0576596 , 0.05600825 , 0.04479006 , 0.05288461 , 0.05461192 , 0.05137569 , 0.04867965 , 0.05301541 , 0.04939842 ]
319+ )
296320
297- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
321+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
298322
299323 def test_image_to_image_sdxl (self ):
300324 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "sdxl_models/image_encoder" )
@@ -313,9 +337,21 @@ def test_image_to_image_sdxl(self):
313337 images = pipeline (** inputs ).images
314338 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
315339
316- expected_slice = np .array ([0.0652 , 0.0698 , 0.0723 , 0.0744 , 0.0699 , 0.0636 , 0.0784 , 0.0803 , 0.0742 ])
340+ expected_slice = np .array (
341+ [
342+ 0.06513795 ,
343+ 0.07009393 ,
344+ 0.07234055 ,
345+ 0.07426041 ,
346+ 0.07002589 ,
347+ 0.06415862 ,
348+ 0.07827643 ,
349+ 0.07962808 ,
350+ 0.07411247 ,
351+ ]
352+ )
317353
318- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
354+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
319355
320356 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
321357 feature_extractor = self .get_image_processor ("laion/CLIP-ViT-bigG-14-laion2B-39B-b160k" )
@@ -337,9 +373,21 @@ def test_image_to_image_sdxl(self):
337373 images = pipeline (** inputs ).images
338374 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
339375
340- expected_slice = np .array ([0.0708 , 0.0701 , 0.0735 , 0.0760 , 0.0739 , 0.0679 , 0.0756 , 0.0824 , 0.0837 ])
376+ expected_slice = np .array (
377+ [
378+ 0.07126552 ,
379+ 0.07025367 ,
380+ 0.07348302 ,
381+ 0.07580167 ,
382+ 0.07467338 ,
383+ 0.06918576 ,
384+ 0.07480252 ,
385+ 0.08279955 ,
386+ 0.08547315 ,
387+ ]
388+ )
341389
342- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
390+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
343391
344392 def test_inpainting_sdxl (self ):
345393 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "sdxl_models/image_encoder" )
@@ -359,9 +407,11 @@ def test_inpainting_sdxl(self):
359407 image_slice = images [0 , :3 , :3 , - 1 ].flatten ()
360408 image_slice .tolist ()
361409
362- expected_slice = np .array ([0.1420 , 0.1495 , 0.1430 , 0.1462 , 0.1493 , 0.1502 , 0.1474 , 0.1502 , 0.1517 ])
410+ expected_slice = np .array (
411+ [0.14181179 , 0.1493012 , 0.14283323 , 0.14602411 , 0.14915377 , 0.15015268 , 0.14725655 , 0.15009224 , 0.15164584 ]
412+ )
363413
364- assert np .allclose (image_slice , expected_slice , atol = 1e-4 , rtol = 1e-4 )
414+ assert np .allclose (image_slice , expected_slice , atol = 1e-3 )
365415
366416 image_encoder = self .get_image_encoder (repo_id = "h94/IP-Adapter" , subfolder = "models/image_encoder" )
367417 feature_extractor = self .get_image_processor ("laion/CLIP-ViT-bigG-14-laion2B-39B-b160k" )
0 commit comments