Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push_tests_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Install dependencies
run: |
uv pip install -e ".[quality]" "pyarrow<26"
uv pip install -e ".[quality]" "pyarrow<26" "numpy>=2"

- name: Environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-doc-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.
# Extra dependencies
RUN uv pip install --no-cache-dir \
accelerate \
numpy==1.26.4 \
"numpy>=2" \
hf_xet \
setuptools==69.5.1 \
bitsandbytes \
Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-onnxruntime-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
huggingface-hub \
Jinja2 \
librosa \
numpy==1.26.4 \
"numpy>=2" \
scipy \
tensorboard \
transformers \
Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-onnxruntime-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN python3.10 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
hf_xet \
Jinja2 \
librosa \
numpy==1.26.4 \
"numpy>=2" \
scipy \
tensorboard \
transformers
Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-pytorch-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.
# Extra dependencies
RUN uv pip install --no-cache-dir \
accelerate \
numpy==1.26.4 \
"numpy>=2" \
"pyarrow<26" \
hf_xet

Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-pytorch-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.
# Extra dependencies
RUN uv pip install --no-cache-dir \
accelerate \
numpy==1.26.4 \
"numpy>=2" \
pytorch-lightning \
hf_xet

Expand Down
2 changes: 1 addition & 1 deletion docker/diffusers-pytorch-minimum-cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.
# Extra dependencies
RUN uv pip install --no-cache-dir \
accelerate \
numpy==1.26.4 \
"numpy>=2" \
pytorch-lightning \
hf_xet

Expand Down
27 changes: 14 additions & 13 deletions tests/models/autoencoders/test_models_autoencoder_oobleck.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
# limitations under the License.

import gc
import unittest

import pytest
import torch
from datasets import load_dataset
from parameterized import parameterized

from diffusers import AutoencoderOobleck
from diffusers.utils.torch_utils import randn_tensor

from ...testing_utils import (
backend_empty_cache,
enable_full_determinism,
require_torchcodec,
slow,
torch_all_close,
torch_device,
Expand Down Expand Up @@ -132,9 +131,9 @@ def test_enable_disable_slicing(self):


@slow
class AutoencoderOobleckIntegrationTests(unittest.TestCase):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated no? Can we make this change in a dedicated PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated but it is what triggered the mentioned failure. So, I thought we just convert to pytest and add a the necessary skip decorators.

def tearDown(self):
super().tearDown()
@require_torchcodec
class TestAutoencoderOobleckIntegration:
def teardown_method(self):
gc.collect()
backend_empty_cache(torch_device)

Expand Down Expand Up @@ -166,13 +165,14 @@ def get_generator(self, seed=0):
return torch.Generator(device=generator_device).manual_seed(seed)
return torch.manual_seed(seed)

@parameterized.expand(
@pytest.mark.parametrize(
"seed, expected_slice, expected_mean_absolute_diff",
[
# fmt: off
[33, [1.193e-4, 6.56e-05, 1.314e-4, 3.80e-05, -4.01e-06], 0.001192],
[44, [2.77e-05, -2.65e-05, 1.18e-05, -6.94e-05, -9.57e-05], 0.001196],
(33, [1.193e-4, 6.56e-05, 1.314e-4, 3.80e-05, -4.01e-06], 0.001192),
(44, [2.77e-05, -2.65e-05, 1.18e-05, -6.94e-05, -9.57e-05], 0.001196),
# fmt: on
]
],
)
def test_stable_diffusion(self, seed, expected_slice, expected_mean_absolute_diff):
model = self.get_oobleck_vae_model()
Expand All @@ -198,13 +198,14 @@ def test_stable_diffusion_mode(self):

assert sample.shape == audio.shape

@parameterized.expand(
@pytest.mark.parametrize(
"seed, expected_slice, expected_mean_absolute_diff",
[
# fmt: off
[33, [1.193e-4, 6.56e-05, 1.314e-4, 3.80e-05, -4.01e-06], 0.001192],
[44, [2.77e-05, -2.65e-05, 1.18e-05, -6.94e-05, -9.57e-05], 0.001196],
(33, [1.193e-4, 6.56e-05, 1.314e-4, 3.80e-05, -4.01e-06], 0.001192),
(44, [2.77e-05, -2.65e-05, 1.18e-05, -6.94e-05, -9.57e-05], 0.001196),
# fmt: on
]
],
)
def test_stable_diffusion_encode_decode(self, seed, expected_slice, expected_mean_absolute_diff):
model = self.get_oobleck_vae_model()
Expand Down
10 changes: 10 additions & 0 deletions tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import glob
import importlib
import importlib.metadata
import importlib.util
import inspect
import io
import logging
Expand Down Expand Up @@ -784,6 +785,15 @@ def require_flashpack(test_case):
return pytest.mark.skipif(not is_flashpack_available(), reason="test requires flashpack")(test_case)


def require_torchcodec(test_case):
"""
Decorator marking a test that requires torchcodec. These tests are skipped when torchcodec isn't installed.
"""
return pytest.mark.skipif(importlib.util.find_spec("torchcodec") is None, reason="test requires torchcodec")(
test_case
)


def require_peft_version_greater(peft_version):
"""
Decorator marking a test that requires PEFT backend with a specific version, this would require some specific
Expand Down
Loading