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
edc154da
Unverified
Commit
edc154da
authored
Apr 09, 2025
by
Dhruv Nair
Committed by
GitHub
Apr 09, 2025
Browse files
Update Ruff to latest Version (#10919)
* update * update * update * update
parent
552cd320
Changes
200
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
148 additions
and
153 deletions
+148
-153
tests/pipelines/flux/test_pipeline_flux_control.py
tests/pipelines/flux/test_pipeline_flux_control.py
+12
-12
tests/pipelines/flux/test_pipeline_flux_control_inpaint.py
tests/pipelines/flux/test_pipeline_flux_control_inpaint.py
+12
-12
tests/pipelines/hunyuandit/test_hunyuan_dit.py
tests/pipelines/hunyuandit/test_hunyuan_dit.py
+13
-18
tests/pipelines/kandinsky/test_kandinsky.py
tests/pipelines/kandinsky/test_kandinsky.py
+6
-6
tests/pipelines/kandinsky/test_kandinsky_combined.py
tests/pipelines/kandinsky/test_kandinsky_combined.py
+18
-18
tests/pipelines/kandinsky/test_kandinsky_img2img.py
tests/pipelines/kandinsky/test_kandinsky_img2img.py
+8
-8
tests/pipelines/kandinsky/test_kandinsky_inpaint.py
tests/pipelines/kandinsky/test_kandinsky_inpaint.py
+7
-7
tests/pipelines/kandinsky2_2/test_kandinsky.py
tests/pipelines/kandinsky2_2/test_kandinsky.py
+6
-6
tests/pipelines/kandinsky2_2/test_kandinsky_combined.py
tests/pipelines/kandinsky2_2/test_kandinsky_combined.py
+18
-18
tests/pipelines/kandinsky2_2/test_kandinsky_controlnet.py
tests/pipelines/kandinsky2_2/test_kandinsky_controlnet.py
+6
-6
tests/pipelines/kandinsky2_2/test_kandinsky_controlnet_img2img.py
...pelines/kandinsky2_2/test_kandinsky_controlnet_img2img.py
+7
-7
tests/pipelines/kandinsky2_2/test_kandinsky_img2img.py
tests/pipelines/kandinsky2_2/test_kandinsky_img2img.py
+7
-7
tests/pipelines/kandinsky2_2/test_kandinsky_inpaint.py
tests/pipelines/kandinsky2_2/test_kandinsky_inpaint.py
+7
-7
tests/pipelines/kandinsky3/test_kandinsky3.py
tests/pipelines/kandinsky3/test_kandinsky3.py
+3
-3
tests/pipelines/kandinsky3/test_kandinsky3_img2img.py
tests/pipelines/kandinsky3/test_kandinsky3_img2img.py
+3
-3
tests/pipelines/pag/test_pag_animatediff.py
tests/pipelines/pag/test_pag_animatediff.py
+3
-3
tests/pipelines/pag/test_pag_controlnet_sd.py
tests/pipelines/pag/test_pag_controlnet_sd.py
+3
-3
tests/pipelines/pag/test_pag_controlnet_sd_inpaint.py
tests/pipelines/pag/test_pag_controlnet_sd_inpaint.py
+3
-3
tests/pipelines/pag/test_pag_controlnet_sdxl.py
tests/pipelines/pag/test_pag_controlnet_sdxl.py
+3
-3
tests/pipelines/pag/test_pag_controlnet_sdxl_img2img.py
tests/pipelines/pag/test_pag_controlnet_sdxl_img2img.py
+3
-3
No files found.
tests/pipelines/flux/test_pipeline_flux_control.py
View file @
edc154da
...
@@ -140,9 +140,9 @@ class FluxControlPipelineFastTests(unittest.TestCase, PipelineTesterMixin):
...
@@ -140,9 +140,9 @@ class FluxControlPipelineFastTests(unittest.TestCase, PipelineTesterMixin):
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# to the pipeline level.
# to the pipeline level.
pipe
.
transformer
.
fuse_qkv_projections
()
pipe
.
transformer
.
fuse_qkv_projections
()
assert
check_qkv_fusion_processors_exist
(
assert
check_qkv_fusion_processors_exist
(
pipe
.
transformer
),
(
pipe
.
transformer
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
,
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
assert
check_qkv_fusion_matches_attn_procs_length
(
assert
check_qkv_fusion_matches_attn_procs_length
(
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
),
"Something wrong with the attention processors concerning the fused QKV projections."
),
"Something wrong with the attention processors concerning the fused QKV projections."
...
@@ -156,15 +156,15 @@ class FluxControlPipelineFastTests(unittest.TestCase, PipelineTesterMixin):
...
@@ -156,15 +156,15 @@ class FluxControlPipelineFastTests(unittest.TestCase, PipelineTesterMixin):
image
=
pipe
(
**
inputs
).
images
image
=
pipe
(
**
inputs
).
images
image_slice_disabled
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
image_slice_disabled
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-3
,
rtol
=
1e-3
),
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-3
,
rtol
=
1e-3
"Fusion of QKV projections shouldn't affect the outputs."
)
,
"Fusion of QKV projections shouldn't affect the outputs."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-3
,
rtol
=
1e-3
),
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-3
,
rtol
=
1e-3
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
,
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
),
(
o
riginal
_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
"O
riginal
outputs should match when fused QKV projections are disabled."
)
,
"Original outputs should match when fused QKV projections are disabled."
)
def
test_flux_image_output_shape
(
self
):
def
test_flux_image_output_shape
(
self
):
pipe
=
self
.
pipeline_class
(
**
self
.
get_dummy_components
()).
to
(
torch_device
)
pipe
=
self
.
pipeline_class
(
**
self
.
get_dummy_components
()).
to
(
torch_device
)
...
...
tests/pipelines/flux/test_pipeline_flux_control_inpaint.py
View file @
edc154da
...
@@ -134,9 +134,9 @@ class FluxControlInpaintPipelineFastTests(unittest.TestCase, PipelineTesterMixin
...
@@ -134,9 +134,9 @@ class FluxControlInpaintPipelineFastTests(unittest.TestCase, PipelineTesterMixin
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# to the pipeline level.
# to the pipeline level.
pipe
.
transformer
.
fuse_qkv_projections
()
pipe
.
transformer
.
fuse_qkv_projections
()
assert
check_qkv_fusion_processors_exist
(
assert
check_qkv_fusion_processors_exist
(
pipe
.
transformer
),
(
pipe
.
transformer
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
,
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
assert
check_qkv_fusion_matches_attn_procs_length
(
assert
check_qkv_fusion_matches_attn_procs_length
(
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
),
"Something wrong with the attention processors concerning the fused QKV projections."
),
"Something wrong with the attention processors concerning the fused QKV projections."
...
@@ -150,15 +150,15 @@ class FluxControlInpaintPipelineFastTests(unittest.TestCase, PipelineTesterMixin
...
@@ -150,15 +150,15 @@ class FluxControlInpaintPipelineFastTests(unittest.TestCase, PipelineTesterMixin
image
=
pipe
(
**
inputs
).
images
image
=
pipe
(
**
inputs
).
images
image_slice_disabled
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
image_slice_disabled
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-3
,
rtol
=
1e-3
),
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-3
,
rtol
=
1e-3
"Fusion of QKV projections shouldn't affect the outputs."
)
,
"Fusion of QKV projections shouldn't affect the outputs."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-3
,
rtol
=
1e-3
),
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-3
,
rtol
=
1e-3
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
,
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
),
(
o
riginal
_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
"O
riginal
outputs should match when fused QKV projections are disabled."
)
,
"Original outputs should match when fused QKV projections are disabled."
)
def
test_flux_image_output_shape
(
self
):
def
test_flux_image_output_shape
(
self
):
pipe
=
self
.
pipeline_class
(
**
self
.
get_dummy_components
()).
to
(
torch_device
)
pipe
=
self
.
pipeline_class
(
**
self
.
get_dummy_components
()).
to
(
torch_device
)
...
...
tests/pipelines/hunyuandit/test_hunyuan_dit.py
View file @
edc154da
...
@@ -21,12 +21,7 @@ import numpy as np
...
@@ -21,12 +21,7 @@ import numpy as np
import
torch
import
torch
from
transformers
import
AutoTokenizer
,
BertModel
,
T5EncoderModel
from
transformers
import
AutoTokenizer
,
BertModel
,
T5EncoderModel
from
diffusers
import
(
from
diffusers
import
AutoencoderKL
,
DDPMScheduler
,
HunyuanDiT2DModel
,
HunyuanDiTPipeline
AutoencoderKL
,
DDPMScheduler
,
HunyuanDiT2DModel
,
HunyuanDiTPipeline
,
)
from
diffusers.utils.testing_utils
import
(
from
diffusers.utils.testing_utils
import
(
enable_full_determinism
,
enable_full_determinism
,
numpy_cosine_similarity_distance
,
numpy_cosine_similarity_distance
,
...
@@ -179,9 +174,9 @@ class HunyuanDiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -179,9 +174,9 @@ class HunyuanDiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# TODO (sayakpaul): will refactor this once `fuse_qkv_projections()` has been added
# to the pipeline level.
# to the pipeline level.
pipe
.
transformer
.
fuse_qkv_projections
()
pipe
.
transformer
.
fuse_qkv_projections
()
assert
check_qkv_fusion_processors_exist
(
assert
check_qkv_fusion_processors_exist
(
pipe
.
transformer
),
(
pipe
.
transformer
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
,
"Something wrong with the fused attention processors. Expected all the attention processors to be fused."
)
assert
check_qkv_fusion_matches_attn_procs_length
(
assert
check_qkv_fusion_matches_attn_procs_length
(
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
pipe
.
transformer
,
pipe
.
transformer
.
original_attn_processors
),
"Something wrong with the attention processors concerning the fused QKV projections."
),
"Something wrong with the attention processors concerning the fused QKV projections."
...
@@ -197,15 +192,15 @@ class HunyuanDiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -197,15 +192,15 @@ class HunyuanDiTPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
image_disabled
=
pipe
(
**
inputs
)[
0
]
image_disabled
=
pipe
(
**
inputs
)[
0
]
image_slice_disabled
=
image_disabled
[
0
,
-
3
:,
-
3
:,
-
1
]
image_slice_disabled
=
image_disabled
[
0
,
-
3
:,
-
3
:,
-
1
]
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-2
,
rtol
=
1e-2
),
(
original_image_slice
,
image_slice_fused
,
atol
=
1e-2
,
rtol
=
1e-2
"Fusion of QKV projections shouldn't affect the outputs."
)
,
"Fusion of QKV projections shouldn't affect the outputs."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
),
(
image_slice_fused
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
,
"Outputs, with QKV projection fusion enabled, shouldn't change when fused QKV projections are disabled."
)
assert
np
.
allclose
(
assert
np
.
allclose
(
original_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
),
(
o
riginal
_image_slice
,
image_slice_disabled
,
atol
=
1e-2
,
rtol
=
1e-2
"O
riginal
outputs should match when fused QKV projections are disabled."
)
,
"Original outputs should match when fused QKV projections are disabled."
)
@
unittest
.
skip
(
@
unittest
.
skip
(
"Test not supported as `encode_prompt` is called two times separately which deivates from about 99% of the pipelines we have."
"Test not supported as `encode_prompt` is called two times separately which deivates from about 99% of the pipelines we have."
...
...
tests/pipelines/kandinsky/test_kandinsky.py
View file @
edc154da
...
@@ -240,12 +240,12 @@ class KandinskyPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -240,12 +240,12 @@ class KandinskyPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
expected_slice
=
np
.
array
([
1.0000
,
1.0000
,
0.2766
,
1.0000
,
0.5447
,
0.1737
,
1.0000
,
0.4316
,
0.9024
])
expected_slice
=
np
.
array
([
1.0000
,
1.0000
,
0.2766
,
1.0000
,
0.5447
,
0.1737
,
1.0000
,
0.4316
,
0.9024
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
...
tests/pipelines/kandinsky/test_kandinsky_combined.py
View file @
edc154da
...
@@ -98,12 +98,12 @@ class KandinskyPipelineCombinedFastTests(PipelineTesterMixin, unittest.TestCase)
...
@@ -98,12 +98,12 @@ class KandinskyPipelineCombinedFastTests(PipelineTesterMixin, unittest.TestCase)
expected_slice
=
np
.
array
([
0.2893
,
0.1464
,
0.4603
,
0.3529
,
0.4612
,
0.7701
,
0.4027
,
0.3051
,
0.5155
])
expected_slice
=
np
.
array
([
0.2893
,
0.1464
,
0.4603
,
0.3529
,
0.4612
,
0.7701
,
0.4027
,
0.3051
,
0.5155
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
@@ -206,12 +206,12 @@ class KandinskyPipelineImg2ImgCombinedFastTests(PipelineTesterMixin, unittest.Te
...
@@ -206,12 +206,12 @@ class KandinskyPipelineImg2ImgCombinedFastTests(PipelineTesterMixin, unittest.Te
expected_slice
=
np
.
array
([
0.4852
,
0.4136
,
0.4539
,
0.4781
,
0.4680
,
0.5217
,
0.4973
,
0.4089
,
0.4977
])
expected_slice
=
np
.
array
([
0.4852
,
0.4136
,
0.4539
,
0.4781
,
0.4680
,
0.5217
,
0.4973
,
0.4089
,
0.4977
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
@@ -318,12 +318,12 @@ class KandinskyPipelineInpaintCombinedFastTests(PipelineTesterMixin, unittest.Te
...
@@ -318,12 +318,12 @@ class KandinskyPipelineInpaintCombinedFastTests(PipelineTesterMixin, unittest.Te
expected_slice
=
np
.
array
([
0.0320
,
0.0860
,
0.4013
,
0.0518
,
0.2484
,
0.5847
,
0.4411
,
0.2321
,
0.4593
])
expected_slice
=
np
.
array
([
0.0320
,
0.0860
,
0.4013
,
0.0518
,
0.2484
,
0.5847
,
0.4411
,
0.2321
,
0.4593
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
...
tests/pipelines/kandinsky/test_kandinsky_img2img.py
View file @
edc154da
...
@@ -261,12 +261,12 @@ class KandinskyImg2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -261,12 +261,12 @@ class KandinskyImg2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
assert
image
.
shape
==
(
1
,
64
,
64
,
3
)
assert
image
.
shape
==
(
1
,
64
,
64
,
3
)
expected_slice
=
np
.
array
([
0.5816
,
0.5872
,
0.4634
,
0.5982
,
0.4767
,
0.4710
,
0.4669
,
0.4717
,
0.4966
])
expected_slice
=
np
.
array
([
0.5816
,
0.5872
,
0.4634
,
0.5982
,
0.4767
,
0.4710
,
0.4669
,
0.4717
,
0.4966
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
@@ -321,7 +321,7 @@ class KandinskyImg2ImgPipelineIntegrationTests(unittest.TestCase):
...
@@ -321,7 +321,7 @@ class KandinskyImg2ImgPipelineIntegrationTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/cat.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"
)
)
prompt
=
"A red cartoon frog, 4k"
prompt
=
"A red cartoon frog, 4k"
...
@@ -387,7 +387,7 @@ class KandinskyImg2ImgPipelineNightlyTests(unittest.TestCase):
...
@@ -387,7 +387,7 @@ class KandinskyImg2ImgPipelineNightlyTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/frog.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/frog.png"
)
)
prompt
=
"A red cartoon frog, 4k"
prompt
=
"A red cartoon frog, 4k"
...
...
tests/pipelines/kandinsky/test_kandinsky_inpaint.py
View file @
edc154da
...
@@ -256,12 +256,12 @@ class KandinskyInpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -256,12 +256,12 @@ class KandinskyInpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
expected_slice
=
np
.
array
([
0.8222
,
0.8896
,
0.4373
,
0.8088
,
0.4905
,
0.2609
,
0.6816
,
0.4291
,
0.5129
])
expected_slice
=
np
.
array
([
0.8222
,
0.8896
,
0.4373
,
0.8088
,
0.4905
,
0.2609
,
0.6816
,
0.4291
,
0.5129
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_inference_batch_single_identical
(
self
):
def
test_inference_batch_single_identical
(
self
):
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
3e-3
)
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
3e-3
)
...
@@ -319,7 +319,7 @@ class KandinskyInpaintPipelineIntegrationTests(unittest.TestCase):
...
@@ -319,7 +319,7 @@ class KandinskyInpaintPipelineIntegrationTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/cat.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"
)
)
mask
=
np
.
zeros
((
768
,
768
),
dtype
=
np
.
float32
)
mask
=
np
.
zeros
((
768
,
768
),
dtype
=
np
.
float32
)
mask
[:
250
,
250
:
-
250
]
=
1
mask
[:
250
,
250
:
-
250
]
=
1
...
...
tests/pipelines/kandinsky2_2/test_kandinsky.py
View file @
edc154da
...
@@ -210,13 +210,13 @@ class KandinskyV22PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -210,13 +210,13 @@ class KandinskyV22PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
expected_slice
=
np
.
array
([
0.3420
,
0.9505
,
0.3919
,
1.0000
,
0.5188
,
0.3109
,
0.6139
,
0.5624
,
0.6811
])
expected_slice
=
np
.
array
([
0.3420
,
0.9505
,
0.3919
,
1.0000
,
0.5188
,
0.3109
,
0.6139
,
0.5624
,
0.6811
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_float16_inference
(
self
):
def
test_float16_inference
(
self
):
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
...
...
tests/pipelines/kandinsky2_2/test_kandinsky_combined.py
View file @
edc154da
...
@@ -103,12 +103,12 @@ class KandinskyV22PipelineCombinedFastTests(PipelineTesterMixin, unittest.TestCa
...
@@ -103,12 +103,12 @@ class KandinskyV22PipelineCombinedFastTests(PipelineTesterMixin, unittest.TestCa
expected_slice
=
np
.
array
([
0.3076
,
0.2729
,
0.5668
,
0.0522
,
0.3384
,
0.7028
,
0.4908
,
0.3659
,
0.6243
])
expected_slice
=
np
.
array
([
0.3076
,
0.2729
,
0.5668
,
0.0522
,
0.3384
,
0.7028
,
0.4908
,
0.3659
,
0.6243
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
@@ -227,12 +227,12 @@ class KandinskyV22PipelineImg2ImgCombinedFastTests(PipelineTesterMixin, unittest
...
@@ -227,12 +227,12 @@ class KandinskyV22PipelineImg2ImgCombinedFastTests(PipelineTesterMixin, unittest
expected_slice
=
np
.
array
([
0.4445
,
0.4287
,
0.4596
,
0.3919
,
0.3730
,
0.5039
,
0.4834
,
0.4269
,
0.5521
])
expected_slice
=
np
.
array
([
0.4445
,
0.4287
,
0.4596
,
0.3919
,
0.3730
,
0.5039
,
0.4834
,
0.4269
,
0.5521
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
@@ -350,12 +350,12 @@ class KandinskyV22PipelineInpaintCombinedFastTests(PipelineTesterMixin, unittest
...
@@ -350,12 +350,12 @@ class KandinskyV22PipelineInpaintCombinedFastTests(PipelineTesterMixin, unittest
expected_slice
=
np
.
array
([
0.5039
,
0.4926
,
0.4898
,
0.4978
,
0.4838
,
0.4942
,
0.4738
,
0.4702
,
0.4816
])
expected_slice
=
np
.
array
([
0.5039
,
0.4926
,
0.4898
,
0.4978
,
0.4838
,
0.4942
,
0.4738
,
0.4702
,
0.4816
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
@
require_torch_accelerator
@
require_torch_accelerator
def
test_offloads
(
self
):
def
test_offloads
(
self
):
...
...
tests/pipelines/kandinsky2_2/test_kandinsky_controlnet.py
View file @
edc154da
...
@@ -210,13 +210,13 @@ class KandinskyV22ControlnetPipelineFastTests(PipelineTesterMixin, unittest.Test
...
@@ -210,13 +210,13 @@ class KandinskyV22ControlnetPipelineFastTests(PipelineTesterMixin, unittest.Test
[
0.6959826
,
0.868279
,
0.7558092
,
0.68769467
,
0.85805804
,
0.65977496
,
0.44885302
,
0.5959111
,
0.4251595
]
[
0.6959826
,
0.868279
,
0.7558092
,
0.68769467
,
0.85805804
,
0.65977496
,
0.44885302
,
0.5959111
,
0.4251595
]
)
)
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_float16_inference
(
self
):
def
test_float16_inference
(
self
):
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
...
...
tests/pipelines/kandinsky2_2/test_kandinsky_controlnet_img2img.py
View file @
edc154da
...
@@ -218,12 +218,12 @@ class KandinskyV22ControlnetImg2ImgPipelineFastTests(PipelineTesterMixin, unitte
...
@@ -218,12 +218,12 @@ class KandinskyV22ControlnetImg2ImgPipelineFastTests(PipelineTesterMixin, unitte
expected_slice
=
np
.
array
(
expected_slice
=
np
.
array
(
[
0.54985034
,
0.55509365
,
0.52561504
,
0.5570494
,
0.5593818
,
0.5263979
,
0.50285643
,
0.5069846
,
0.51196736
]
[
0.54985034
,
0.55509365
,
0.52561504
,
0.5570494
,
0.5593818
,
0.5263979
,
0.50285643
,
0.5069846
,
0.51196736
]
)
)
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_inference_batch_single_identical
(
self
):
def
test_inference_batch_single_identical
(
self
):
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
1.75e-3
)
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
1.75e-3
)
...
@@ -254,7 +254,7 @@ class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
...
@@ -254,7 +254,7 @@ class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/cat.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"
)
)
init_image
=
init_image
.
resize
((
512
,
512
))
init_image
=
init_image
.
resize
((
512
,
512
))
...
...
tests/pipelines/kandinsky2_2/test_kandinsky_img2img.py
View file @
edc154da
...
@@ -228,12 +228,12 @@ class KandinskyV22Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCas
...
@@ -228,12 +228,12 @@ class KandinskyV22Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCas
assert
image
.
shape
==
(
1
,
64
,
64
,
3
)
assert
image
.
shape
==
(
1
,
64
,
64
,
3
)
expected_slice
=
np
.
array
([
0.5712
,
0.5443
,
0.4725
,
0.6195
,
0.5184
,
0.4651
,
0.4473
,
0.4590
,
0.5016
])
expected_slice
=
np
.
array
([
0.5712
,
0.5443
,
0.4725
,
0.6195
,
0.5184
,
0.4651
,
0.4473
,
0.4590
,
0.5016
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_float16_inference
(
self
):
def
test_float16_inference
(
self
):
super
().
test_float16_inference
(
expected_max_diff
=
2e-1
)
super
().
test_float16_inference
(
expected_max_diff
=
2e-1
)
...
@@ -261,7 +261,7 @@ class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
...
@@ -261,7 +261,7 @@ class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/cat.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"
)
)
prompt
=
"A red cartoon frog, 4k"
prompt
=
"A red cartoon frog, 4k"
...
...
tests/pipelines/kandinsky2_2/test_kandinsky_inpaint.py
View file @
edc154da
...
@@ -234,12 +234,12 @@ class KandinskyV22InpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCas
...
@@ -234,12 +234,12 @@ class KandinskyV22InpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCas
[
0.50775903
,
0.49527195
,
0.48824543
,
0.50192237
,
0.48644906
,
0.49373814
,
0.4780598
,
0.47234827
,
0.48327848
]
[
0.50775903
,
0.49527195
,
0.48824543
,
0.50192237
,
0.48644906
,
0.49373814
,
0.4780598
,
0.47234827
,
0.48327848
]
)
)
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
assert
(
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_from_tuple_slice
.
flatten
()
}
"
)
def
test_inference_batch_single_identical
(
self
):
def
test_inference_batch_single_identical
(
self
):
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
3e-3
)
super
().
test_inference_batch_single_identical
(
expected_max_diff
=
3e-3
)
...
@@ -314,7 +314,7 @@ class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
...
@@ -314,7 +314,7 @@ class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
)
)
init_image
=
load_image
(
init_image
=
load_image
(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main
"
"
/kandinsky/cat.png"
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"
)
)
mask
=
np
.
zeros
((
768
,
768
),
dtype
=
np
.
float32
)
mask
=
np
.
zeros
((
768
,
768
),
dtype
=
np
.
float32
)
mask
[:
250
,
250
:
-
250
]
=
1
mask
[:
250
,
250
:
-
250
]
=
1
...
...
tests/pipelines/kandinsky3/test_kandinsky3.py
View file @
edc154da
...
@@ -157,9 +157,9 @@ class Kandinsky3PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
...
@@ -157,9 +157,9 @@ class Kandinsky3PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
expected_slice
=
np
.
array
([
0.3768
,
0.4373
,
0.4865
,
0.4890
,
0.4299
,
0.5122
,
0.4921
,
0.4924
,
0.5599
])
expected_slice
=
np
.
array
([
0.3768
,
0.4373
,
0.4865
,
0.4890
,
0.4299
,
0.5122
,
0.4921
,
0.4924
,
0.5599
])
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
def
test_float16_inference
(
self
):
def
test_float16_inference
(
self
):
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
...
...
tests/pipelines/kandinsky3/test_kandinsky3_img2img.py
View file @
edc154da
...
@@ -181,9 +181,9 @@ class Kandinsky3Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase)
...
@@ -181,9 +181,9 @@ class Kandinsky3Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase)
[
0.576259
,
0.6132097
,
0.41703486
,
0.603196
,
0.62062526
,
0.4655338
,
0.5434324
,
0.5660727
,
0.65433365
]
[
0.576259
,
0.6132097
,
0.41703486
,
0.603196
,
0.62062526
,
0.4655338
,
0.5434324
,
0.5660727
,
0.65433365
]
)
)
assert
(
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
,
(
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
,
f
" expected_slice
{
expected_slice
}
, but got
{
image_slice
.
flatten
()
}
"
)
def
test_float16_inference
(
self
):
def
test_float16_inference
(
self
):
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
super
().
test_float16_inference
(
expected_max_diff
=
1e-1
)
...
...
tests/pipelines/pag/test_pag_animatediff.py
View file @
edc154da
...
@@ -450,9 +450,9 @@ class AnimateDiffPAGPipelineFastTests(
...
@@ -450,9 +450,9 @@ class AnimateDiffPAGPipelineFastTests(
inputs
=
self
.
get_dummy_inputs
(
device
)
inputs
=
self
.
get_dummy_inputs
(
device
)
del
inputs
[
"pag_scale"
]
del
inputs
[
"pag_scale"
]
assert
(
assert
"pag_scale"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
,
(
"
pag_scale
"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
f
"`
pag_scale
` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
,
f
"`pag_scale` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
out
=
pipe_sd
(
**
inputs
).
frames
[
0
,
-
3
:,
-
3
:,
-
1
]
out
=
pipe_sd
(
**
inputs
).
frames
[
0
,
-
3
:,
-
3
:,
-
1
]
components
=
self
.
get_dummy_components
()
components
=
self
.
get_dummy_components
()
...
...
tests/pipelines/pag/test_pag_controlnet_sd.py
View file @
edc154da
...
@@ -169,9 +169,9 @@ class StableDiffusionControlNetPAGPipelineFastTests(
...
@@ -169,9 +169,9 @@ class StableDiffusionControlNetPAGPipelineFastTests(
inputs
=
self
.
get_dummy_inputs
(
device
)
inputs
=
self
.
get_dummy_inputs
(
device
)
del
inputs
[
"pag_scale"
]
del
inputs
[
"pag_scale"
]
assert
(
assert
"pag_scale"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
,
(
"
pag_scale
"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
f
"`
pag_scale
` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
,
f
"`pag_scale` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
# pag disabled with pag_scale=0.0
# pag disabled with pag_scale=0.0
...
...
tests/pipelines/pag/test_pag_controlnet_sd_inpaint.py
View file @
edc154da
...
@@ -165,9 +165,9 @@ class StableDiffusionControlNetPAGInpaintPipelineFastTests(
...
@@ -165,9 +165,9 @@ class StableDiffusionControlNetPAGInpaintPipelineFastTests(
inputs
=
self
.
get_dummy_inputs
(
device
)
inputs
=
self
.
get_dummy_inputs
(
device
)
del
inputs
[
"pag_scale"
]
del
inputs
[
"pag_scale"
]
assert
(
assert
"pag_scale"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
,
(
"
pag_scale
"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
f
"`
pag_scale
` should not be a call parameter of the base pipeline
{
pipe_sd
.
__calss__
.
__name__
}
."
)
,
f
"`pag_scale` should not be a call parameter of the base pipeline
{
pipe_sd
.
__calss__
.
__name__
}
."
)
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
# pag disabled with pag_scale=0.0
# pag disabled with pag_scale=0.0
...
...
tests/pipelines/pag/test_pag_controlnet_sdxl.py
View file @
edc154da
...
@@ -187,9 +187,9 @@ class StableDiffusionXLControlNetPAGPipelineFastTests(
...
@@ -187,9 +187,9 @@ class StableDiffusionXLControlNetPAGPipelineFastTests(
inputs
=
self
.
get_dummy_inputs
(
device
)
inputs
=
self
.
get_dummy_inputs
(
device
)
del
inputs
[
"pag_scale"
]
del
inputs
[
"pag_scale"
]
assert
(
assert
"pag_scale"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
,
(
"
pag_scale
"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
f
"`
pag_scale
` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
,
f
"`pag_scale` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
# pag disabled with pag_scale=0.0
# pag disabled with pag_scale=0.0
...
...
tests/pipelines/pag/test_pag_controlnet_sdxl_img2img.py
View file @
edc154da
...
@@ -189,9 +189,9 @@ class StableDiffusionXLControlNetPAGImg2ImgPipelineFastTests(
...
@@ -189,9 +189,9 @@ class StableDiffusionXLControlNetPAGImg2ImgPipelineFastTests(
inputs
=
self
.
get_dummy_inputs
(
device
)
inputs
=
self
.
get_dummy_inputs
(
device
)
del
inputs
[
"pag_scale"
]
del
inputs
[
"pag_scale"
]
assert
(
assert
"pag_scale"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
,
(
"
pag_scale
"
not
in
inspect
.
signature
(
pipe_sd
.
__call__
).
parameters
f
"`
pag_scale
` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
,
f
"`pag_scale` should not be a call parameter of the base pipeline
{
pipe_sd
.
__class__
.
__name__
}
."
)
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
out
=
pipe_sd
(
**
inputs
).
images
[
0
,
-
3
:,
-
3
:,
-
1
]
# pag disabled with pag_scale=0.0
# pag disabled with pag_scale=0.0
...
...
Prev
1
…
4
5
6
7
8
9
10
Next
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