@@ -1422,18 +1422,18 @@ def test_stable_diffusion_inpaint_pipeline_k_lms(self):
14221422 @slow
14231423 def test_stable_diffusion_onnx (self ):
14241424 sd_pipe = StableDiffusionOnnxPipeline .from_pretrained (
1425- "CompVis/stable-diffusion-v1-4" , revision = "onnx" , provider = "CUDAExecutionProvider " , use_auth_token = True
1425+ "CompVis/stable-diffusion-v1-4" , revision = "onnx" , provider = "CPUExecutionProvider " , use_auth_token = True
14261426 )
14271427
14281428 prompt = "A painting of a squirrel eating a burger"
14291429 np .random .seed (0 )
1430- output = sd_pipe ([prompt ], guidance_scale = 6.0 , num_inference_steps = 20 , output_type = "np" )
1430+ output = sd_pipe ([prompt ], guidance_scale = 6.0 , num_inference_steps = 5 , output_type = "np" )
14311431 image = output .images
14321432
14331433 image_slice = image [0 , - 3 :, - 3 :, - 1 ]
14341434
14351435 assert image .shape == (1 , 512 , 512 , 3 )
1436- expected_slice = np .array ([0.0385 , 0.0252 , 0.0234 , 0.0287 , 0.0358 , 0.0287 , 0.0276 , 0.0235 , 0.0010 ])
1436+ expected_slice = np .array ([0.3602 , 0.3688 , 0.3652 , 0.3895 , 0.3782 , 0.3747 , 0.3927 , 0.4241 , 0.4327 ])
14371437 assert np .abs (image_slice .flatten () - expected_slice ).max () < 1e-3
14381438
14391439 @slow
@@ -1592,7 +1592,7 @@ def test_callback_fn(step: int, timestep: int, latents: np.ndarray) -> None:
15921592 assert latents .shape == (1 , 4 , 64 , 64 )
15931593 latents_slice = latents [0 , - 3 :, - 3 :, - 1 ]
15941594 expected_slice = np .array (
1595- [- 0.6254 , - 0.2742 , - 1.0710 , 0.2296 , - 1.1683 , 0.6913 , - 2.0605 , - 0.0682 , 0.9700 ]
1595+ [- 0.5950 , - 0.3039 , - 1.1672 , 0.1594 , - 1.1572 , 0.6719 , - 1.9712 , - 0.0403 , 0.9592 ]
15961596 )
15971597 assert np .abs (latents_slice .flatten () - expected_slice ).max () < 1e-3
15981598
@@ -1606,6 +1606,6 @@ def test_callback_fn(step: int, timestep: int, latents: np.ndarray) -> None:
16061606 prompt = "Andromeda galaxy in a bottle"
16071607
16081608 np .random .seed (0 )
1609- pipe (prompt = prompt , num_inference_steps = 50 , guidance_scale = 7.5 , callback = test_callback_fn , callback_steps = 1 )
1609+ pipe (prompt = prompt , num_inference_steps = 5 , guidance_scale = 7.5 , callback = test_callback_fn , callback_steps = 1 )
16101610 assert test_callback_fn .has_been_called
1611- assert number_of_steps == 51
1611+ assert number_of_steps == 6
0 commit comments