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
17c2c060
Unverified
Commit
17c2c060
authored
Oct 31, 2022
by
Patrick von Platen
Committed by
GitHub
Oct 31, 2022
Browse files
[Tests] Fix slow tests (#1087)
parent
010bc4ea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
src/diffusers/configuration_utils.py
src/diffusers/configuration_utils.py
+1
-1
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py
...nes/stable_diffusion/pipeline_stable_diffusion_inpaint.py
+9
-8
tests/pipelines/stable_diffusion/test_stable_diffusion.py
tests/pipelines/stable_diffusion/test_stable_diffusion.py
+5
-4
No files found.
src/diffusers/configuration_utils.py
View file @
17c2c060
...
...
@@ -323,7 +323,7 @@ class ConfigMixin:
# remove attributes from orig class that cannot be expected
orig_cls_name
=
config_dict
.
pop
(
"_class_name"
,
cls
.
__name__
)
if
orig_cls_name
!=
cls
.
__name__
:
if
orig_cls_name
!=
cls
.
__name__
and
hasattr
(
diffusers_library
,
orig_cls_name
)
:
orig_cls
=
getattr
(
diffusers_library
,
orig_cls_name
)
unexpected_keys_from_orig
=
cls
.
_get_init_keys
(
orig_cls
)
-
expected_keys
config_dict
=
{
k
:
v
for
k
,
v
in
config_dict
.
items
()
if
k
not
in
unexpected_keys_from_orig
}
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py
View file @
17c2c060
...
...
@@ -90,17 +90,18 @@ class StableDiffusionInpaintPipeline(DiffusionPipeline):
new_config
[
"steps_offset"
]
=
1
scheduler
.
_internal_dict
=
FrozenDict
(
new_config
)
if
hasattr
(
scheduler
.
config
,
"
clip_sample
"
)
and
scheduler
.
config
.
cl
ip_
sample
is
Tru
e
:
if
hasattr
(
scheduler
.
config
,
"
skip_prk_steps
"
)
and
scheduler
.
config
.
sk
ip_
prk_steps
is
Fals
e
:
deprecation_message
=
(
f
"The configuration file of this scheduler:
{
scheduler
}
has not set the configuration `clip_sample`."
" `clip_sample` should be set to False in the configuration file. Please make sure to update the"
" config accordingly as not setting `clip_sample` in the config might lead to incorrect results in"
" future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very"
" nice if you could open a Pull request for the `scheduler/scheduler_config.json` file"
f
"The configuration file of this scheduler:
{
scheduler
}
has not set the configuration"
" `skip_prk_steps`. `skip_prk_steps` should be set to True in the configuration file. Please make"
" sure to update the config accordingly as not setting `skip_prk_steps` in the config might lead to"
" incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face"
" Hub, it would be very nice if you could open a Pull request for the"
" `scheduler/scheduler_config.json` file"
)
deprecate
(
"
clip_sample
not set"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
deprecate
(
"
skip_prk_steps
not set"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
new_config
=
dict
(
scheduler
.
config
)
new_config
[
"
cl
ip_
sample
"
]
=
Fals
e
new_config
[
"
sk
ip_
prk_steps
"
]
=
Tru
e
scheduler
.
_internal_dict
=
FrozenDict
(
new_config
)
if
safety_checker
is
None
:
...
...
tests/pipelines/stable_diffusion/test_stable_diffusion.py
View file @
17c2c060
...
...
@@ -640,13 +640,14 @@ class StableDiffusionPipelineIntegrationTests(unittest.TestCase):
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
def
test_stable_diffusion_fast_ddim
(
self
):
sd_pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-1"
,
device_map
=
"auto"
)
scheduler
=
DDIMScheduler
.
from_config
(
"CompVis/stable-diffusion-v1-1"
,
subfolder
=
"scheduler"
)
sd_pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-1"
,
scheduler
=
scheduler
,
device_map
=
"auto"
)
sd_pipe
=
sd_pipe
.
to
(
torch_device
)
sd_pipe
.
set_progress_bar_config
(
disable
=
None
)
scheduler
=
DDIMScheduler
.
from_config
(
"CompVis/stable-diffusion-v1-1"
,
subfolder
=
"scheduler"
)
sd_pipe
.
scheduler
=
scheduler
prompt
=
"A painting of a squirrel eating a burger"
generator
=
torch
.
Generator
(
device
=
torch_device
).
manual_seed
(
0
)
...
...
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