Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: huggingface/diffusers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5df02fc
Choose a base ref
...
head repository: huggingface/diffusers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dd28509
Choose a head ref
  • 3 commits
  • 7 files changed
  • 4 contributors

Commits on Jun 24, 2025

  1. guard omnigen processor. (#11799)

    sayakpaul authored Jun 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d3e27e0 View commit details

Commits on Jun 25, 2025

  1. [tests] skip instead of returning. (#11793)

    skip instead of returning.
    sayakpaul authored Jun 25, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    80f27d7 View commit details
  2. adjust to get CI test cases passed on XPU (#11759)

    * adjust to get CI test cases passed on XPU
    
    Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
    
    * fix format issue
    
    Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
    
    * Apply style fixes
    
    ---------
    
    Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    Co-authored-by: Aryan <aryan@huggingface.co>
    3 people authored Jun 25, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dd28509 View commit details
6 changes: 4 additions & 2 deletions src/diffusers/pipelines/omnigen/pipeline_omnigen.py
Original file line number Diff line number Diff line change
@@ -23,12 +23,14 @@
from ...models.autoencoders import AutoencoderKL
from ...models.transformers import OmniGenTransformer2DModel
from ...schedulers import FlowMatchEulerDiscreteScheduler
from ...utils import is_torch_xla_available, logging, replace_example_docstring
from ...utils import is_torch_xla_available, is_torchvision_available, logging, replace_example_docstring
from ...utils.torch_utils import randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
from .processor_omnigen import OmniGenMultiModalProcessor


if is_torchvision_available():
from .processor_omnigen import OmniGenMultiModalProcessor

if is_torch_xla_available():
XLA_AVAILABLE = True
else:
7 changes: 6 additions & 1 deletion src/diffusers/pipelines/omnigen/processor_omnigen.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,12 @@
import numpy as np
import torch
from PIL import Image
from torchvision import transforms

from ...utils import is_torchvision_available


if is_torchvision_available():
from torchvision import transforms


def crop_image(pil_image, max_image_size):
4 changes: 2 additions & 2 deletions tests/models/test_modeling_common.py
Original file line number Diff line number Diff line change
@@ -2107,7 +2107,7 @@ def test_hotswapping_compiled_model_linear(self, rank0, rank1):
@parameterized.expand([(11, 11), (7, 13), (13, 7)]) # important to test small to large and vice versa
def test_hotswapping_compiled_model_conv2d(self, rank0, rank1):
if "unet" not in self.model_class.__name__.lower():
return
pytest.skip("Test only applies to UNet.")

# It's important to add this context to raise an error on recompilation
target_modules = ["conv", "conv1", "conv2"]
@@ -2117,7 +2117,7 @@ def test_hotswapping_compiled_model_conv2d(self, rank0, rank1):
@parameterized.expand([(11, 11), (7, 13), (13, 7)]) # important to test small to large and vice versa
def test_hotswapping_compiled_model_both_linear_and_conv2d(self, rank0, rank1):
if "unet" not in self.model_class.__name__.lower():
return
pytest.skip("Test only applies to UNet.")

# It's important to add this context to raise an error on recompilation
target_modules = ["to_q", "conv"]
3 changes: 1 addition & 2 deletions tests/pipelines/kandinsky2_2/test_kandinsky_controlnet.py
Original file line number Diff line number Diff line change
@@ -289,6 +289,5 @@ def test_kandinsky_controlnet(self):
image = output.images[0]

assert image.shape == (512, 512, 3)

max_diff = numpy_cosine_similarity_distance(expected_image.flatten(), image.flatten())
assert max_diff < 1e-4
assert max_diff < 2e-4
33 changes: 31 additions & 2 deletions tests/pipelines/ledits_pp/test_ledits_pp_stable_diffusion.py
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
UNet2DConditionModel,
)
from diffusers.utils.testing_utils import (
Expectations,
backend_empty_cache,
enable_full_determinism,
floats_tensor,
@@ -244,7 +245,35 @@ def test_ledits_pp_editing(self):

output_slice = reconstruction[150:153, 140:143, -1]
output_slice = output_slice.flatten()
expected_slice = np.array(
[0.9453125, 0.93310547, 0.84521484, 0.94628906, 0.9111328, 0.80859375, 0.93847656, 0.9042969, 0.8144531]
expected_slices = Expectations(
{
("xpu", 3): np.array(
[
0.9511719,
0.94140625,
0.87597656,
0.9472656,
0.9296875,
0.8378906,
0.94433594,
0.91503906,
0.8491211,
]
),
("cuda", 7): np.array(
[
0.9453125,
0.93310547,
0.84521484,
0.94628906,
0.9111328,
0.80859375,
0.93847656,
0.9042969,
0.8144531,
]
),
}
)
expected_slice = expected_slices.get_expectation()
assert np.abs(output_slice - expected_slice).max() < 1e-2
6 changes: 3 additions & 3 deletions tests/pipelines/test_pipelines_common.py
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
from diffusers.utils.testing_utils import (
CaptureLogger,
backend_empty_cache,
numpy_cosine_similarity_distance,
require_accelerate_version_greater,
require_accelerator,
require_hf_hub_version_greater,
@@ -1394,9 +1395,8 @@ def test_float16_inference(self, expected_max_diff=5e-2):
fp16_inputs["generator"] = self.get_generator(0)

output_fp16 = pipe_fp16(**fp16_inputs)[0]

max_diff = np.abs(to_np(output) - to_np(output_fp16)).max()
self.assertLess(max_diff, expected_max_diff, "The outputs of the fp16 and fp32 pipelines are too different.")
max_diff = numpy_cosine_similarity_distance(output.flatten(), output_fp16.flatten())
assert max_diff < 2e-4

@unittest.skipIf(torch_device not in ["cuda", "xpu"], reason="float16 requires CUDA or XPU")
@require_accelerator
50 changes: 25 additions & 25 deletions tests/quantization/gguf/test_gguf.py
Original file line number Diff line number Diff line change
@@ -286,33 +286,33 @@ def test_pipeline_inference(self):
{
("xpu", 3): np.array(
[
0.19335938,
0.3125,
0.3203125,
0.1328125,
0.3046875,
0.296875,
0.11914062,
0.2890625,
0.2890625,
0.16796875,
0.30273438,
0.33203125,
0.14648438,
0.31640625,
0.33007812,
0.16210938,
0.2734375,
0.27734375,
0.109375,
0.27148438,
0.2578125,
0.1015625,
0.2578125,
0.2578125,
0.14453125,
0.26953125,
0.29492188,
0.12890625,
0.3046875,
0.30859375,
0.17773438,
0.33789062,
0.33203125,
0.16796875,
0.34570312,
0.32421875,
0.28710938,
0.30078125,
0.11132812,
0.27734375,
0.27929688,
0.15625,
0.33203125,
0.31445312,
0.31054688,
0.296875,
0.15234375,
0.3203125,
0.29492188,
0.140625,
0.3046875,
0.28515625,
]
),
("cuda", 7): np.array(