Skip to content

Commit

Permalink
Fix Slow Tests (huggingface#5469)
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
DN6 authored and Jimmy committed Apr 26, 2024
1 parent 906771c commit 144768c
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 110 deletions.
3 changes: 2 additions & 1 deletion docker/diffusers-pytorch-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
scipy \
tensorboard \
transformers \
omegaconf
omegaconf \
pytorch-lightning

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion tests/pipelines/kandinsky/test_kandinsky_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_inference_batch_single_identical(self):
super().test_inference_batch_single_identical(expected_max_diff=1e-2)

def test_float16_inference(self):
super().test_float16_inference(expected_max_diff=1e-1)
super().test_float16_inference(expected_max_diff=2e-1)

def test_dict_tuple_outputs_equivalent(self):
super().test_dict_tuple_outputs_equivalent(expected_max_difference=5e-4)
Expand Down
4 changes: 2 additions & 2 deletions tests/pipelines/stable_diffusion/test_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def test_stable_diffusion_1_1_pndm(self):
image_slice = image[0, -3:, -3:, -1].flatten()

assert image.shape == (1, 512, 512, 3)
expected_slice = np.array([0.3149, 0.5246, 0.4796, 0.3218, 0.4469, 0.4729, 0.5151, 0.3597, 0.3954])
expected_slice = np.array([0.4363, 0.4355, 0.3667, 0.4066, 0.3970, 0.3866, 0.4394, 0.4356, 0.4059])
assert np.abs(image_slice - expected_slice).max() < 3e-3

def test_stable_diffusion_v1_4_with_freeu(self):
Expand All @@ -668,7 +668,7 @@ def test_stable_diffusion_1_4_pndm(self):
image_slice = image[0, -3:, -3:, -1].flatten()

assert image.shape == (1, 512, 512, 3)
expected_slice = np.array([0.3458, 0.5120, 0.4800, 0.3116, 0.4348, 0.4802, 0.5237, 0.3467, 0.3991])
expected_slice = np.array([0.5740, 0.4784, 0.3162, 0.6358, 0.5831, 0.5505, 0.5082, 0.5631, 0.5575])
assert np.abs(image_slice - expected_slice).max() < 3e-3

def test_stable_diffusion_ddim(self):
Expand Down
Loading

0 comments on commit 144768c

Please sign in to comment.