Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
27bf7fcd
Unverified
Commit
27bf7fcd
authored
Jun 26, 2025
by
kaixuanliu
Committed by
GitHub
Jun 26, 2025
Browse files
adjust tolerance criteria for `test_float16_inference` in unit test (#11809)
Signed-off-by:
Liu, Kaixuan
<
kaixuan.liu@intel.com
>
parent
a185e1ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
tests/pipelines/amused/test_amused_inpaint.py
tests/pipelines/amused/test_amused_inpaint.py
+32
-1
tests/pipelines/test_pipelines_common.py
tests/pipelines/test_pipelines_common.py
+1
-1
No files found.
tests/pipelines/amused/test_amused_inpaint.py
View file @
27bf7fcd
...
@@ -22,6 +22,7 @@ from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokeni
...
@@ -22,6 +22,7 @@ from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokeni
from
diffusers
import
AmusedInpaintPipeline
,
AmusedScheduler
,
UVit2DModel
,
VQModel
from
diffusers
import
AmusedInpaintPipeline
,
AmusedScheduler
,
UVit2DModel
,
VQModel
from
diffusers.utils
import
load_image
from
diffusers.utils
import
load_image
from
diffusers.utils.testing_utils
import
(
from
diffusers.utils.testing_utils
import
(
Expectations
,
enable_full_determinism
,
enable_full_determinism
,
require_torch_accelerator
,
require_torch_accelerator
,
slow
,
slow
,
...
@@ -246,5 +247,35 @@ class AmusedInpaintPipelineSlowTests(unittest.TestCase):
...
@@ -246,5 +247,35 @@ class AmusedInpaintPipelineSlowTests(unittest.TestCase):
image_slice
=
image
[
0
,
-
3
:,
-
3
:,
-
1
].
flatten
()
image_slice
=
image
[
0
,
-
3
:,
-
3
:,
-
1
].
flatten
()
assert
image
.
shape
==
(
1
,
512
,
512
,
3
)
assert
image
.
shape
==
(
1
,
512
,
512
,
3
)
expected_slice
=
np
.
array
([
0.0227
,
0.0157
,
0.0098
,
0.0213
,
0.0250
,
0.0127
,
0.0280
,
0.0380
,
0.0095
])
expected_slices
=
Expectations
(
{
(
"xpu"
,
3
):
np
.
array
(
[
0.0274
,
0.0211
,
0.0154
,
0.0257
,
0.0299
,
0.0170
,
0.0326
,
0.0420
,
0.0150
,
]
),
(
"cuda"
,
7
):
np
.
array
(
[
0.0227
,
0.0157
,
0.0098
,
0.0213
,
0.0250
,
0.0127
,
0.0280
,
0.0380
,
0.0095
,
]
),
}
)
expected_slice
=
expected_slices
.
get_expectation
()
assert
np
.
abs
(
image_slice
-
expected_slice
).
max
()
<
0.003
assert
np
.
abs
(
image_slice
-
expected_slice
).
max
()
<
0.003
tests/pipelines/test_pipelines_common.py
View file @
27bf7fcd
...
@@ -1396,7 +1396,7 @@ class PipelineTesterMixin:
...
@@ -1396,7 +1396,7 @@ class PipelineTesterMixin:
output_fp16
=
pipe_fp16
(
**
fp16_inputs
)[
0
]
output_fp16
=
pipe_fp16
(
**
fp16_inputs
)[
0
]
max_diff
=
numpy_cosine_similarity_distance
(
output
.
flatten
(),
output_fp16
.
flatten
())
max_diff
=
numpy_cosine_similarity_distance
(
output
.
flatten
(),
output_fp16
.
flatten
())
assert
max_diff
<
2
e-
4
assert
max_diff
<
1
e-
2
@
unittest
.
skipIf
(
torch_device
not
in
[
"cuda"
,
"xpu"
],
reason
=
"float16 requires CUDA or XPU"
)
@
unittest
.
skipIf
(
torch_device
not
in
[
"cuda"
,
"xpu"
],
reason
=
"float16 requires CUDA or XPU"
)
@
require_accelerator
@
require_accelerator
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment