Skip to content

Commit 4067d6c

Browse files
adjust criteria for marigold-intrinsics example on XPU (huggingface#12290)
adjust criteria for XPU Signed-off-by: Liu, Kaixuan <[email protected]> Co-authored-by: Aryan <[email protected]>
1 parent 28106fc commit 4067d6c

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

tests/pipelines/marigold/test_marigold_intrinsics.py

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
)
3535

3636
from ...testing_utils import (
37+
Expectations,
3738
backend_empty_cache,
3839
enable_full_determinism,
3940
floats_tensor,
@@ -416,7 +417,7 @@ def _test_marigold_intrinsics(
416417
expected_slice: np.ndarray = None,
417418
model_id: str = "prs-eth/marigold-iid-appearance-v1-1",
418419
image_url: str = "https://marigoldmonodepth.github.io/images/einstein.jpg",
419-
atol: float = 1e-4,
420+
atol: float = 1e-3,
420421
**pipe_kwargs,
421422
):
422423
from_pretrained_kwargs = {}
@@ -531,11 +532,41 @@ def test_marigold_intrinsics_einstein_f16_accelerator_G0_S1_P512_E1_B1_M1(self):
531532
)
532533

533534
def test_marigold_intrinsics_einstein_f16_accelerator_G0_S1_P768_E3_B1_M1(self):
535+
expected_slices = Expectations(
536+
{
537+
("xpu", 3): np.array(
538+
[
539+
0.62655,
540+
0.62477,
541+
0.62161,
542+
0.62452,
543+
0.62454,
544+
0.62454,
545+
0.62255,
546+
0.62647,
547+
0.63379,
548+
]
549+
),
550+
("cuda", 7): np.array(
551+
[
552+
0.61572,
553+
0.1377,
554+
0.61182,
555+
0.61426,
556+
0.61377,
557+
0.61426,
558+
0.61279,
559+
0.61572,
560+
0.62354,
561+
]
562+
),
563+
}
564+
)
534565
self._test_marigold_intrinsics(
535566
is_fp16=True,
536567
device=torch_device,
537568
generator_seed=0,
538-
expected_slice=np.array([0.61572, 0.61377, 0.61182, 0.61426, 0.61377, 0.61426, 0.61279, 0.61572, 0.62354]),
569+
expected_slice=expected_slices.get_expectation(),
539570
num_inference_steps=1,
540571
processing_resolution=768,
541572
ensemble_size=3,
@@ -545,11 +576,41 @@ def test_marigold_intrinsics_einstein_f16_accelerator_G0_S1_P768_E3_B1_M1(self):
545576
)
546577

547578
def test_marigold_intrinsics_einstein_f16_accelerator_G0_S1_P768_E4_B2_M1(self):
579+
expected_slices = Expectations(
580+
{
581+
("xpu", 3): np.array(
582+
[
583+
0.62988,
584+
0.62792,
585+
0.62548,
586+
0.62841,
587+
0.62792,
588+
0.62792,
589+
0.62646,
590+
0.62939,
591+
0.63721,
592+
]
593+
),
594+
("cuda", 7): np.array(
595+
[
596+
0.61914,
597+
0.6167,
598+
0.61475,
599+
0.61719,
600+
0.61719,
601+
0.61768,
602+
0.61572,
603+
0.61914,
604+
0.62695,
605+
]
606+
),
607+
}
608+
)
548609
self._test_marigold_intrinsics(
549610
is_fp16=True,
550611
device=torch_device,
551612
generator_seed=0,
552-
expected_slice=np.array([0.61914, 0.6167, 0.61475, 0.61719, 0.61719, 0.61768, 0.61572, 0.61914, 0.62695]),
613+
expected_slice=expected_slices.get_expectation(),
553614
num_inference_steps=1,
554615
processing_resolution=768,
555616
ensemble_size=4,

0 commit comments

Comments
 (0)