Skip to content

Commit 1d00de3

Browse files
authored
Merge branch 'main' into main
2 parents 1fb21d3 + 17c2c06 commit 1d00de3

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/diffusers/configuration_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def extract_init_dict(cls, config_dict, **kwargs):
323323

324324
# remove attributes from orig class that cannot be expected
325325
orig_cls_name = config_dict.pop("_class_name", cls.__name__)
326-
if orig_cls_name != cls.__name__:
326+
if orig_cls_name != cls.__name__ and hasattr(diffusers_library, orig_cls_name):
327327
orig_cls = getattr(diffusers_library, orig_cls_name)
328328
unexpected_keys_from_orig = cls._get_init_keys(orig_cls) - expected_keys
329329
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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,18 @@ def __init__(
9191
new_config["steps_offset"] = 1
9292
scheduler._internal_dict = FrozenDict(new_config)
9393

94-
if hasattr(scheduler.config, "clip_sample") and scheduler.config.clip_sample is True:
94+
if hasattr(scheduler.config, "skip_prk_steps") and scheduler.config.skip_prk_steps is False:
9595
deprecation_message = (
96-
f"The configuration file of this scheduler: {scheduler} has not set the configuration `clip_sample`."
97-
" `clip_sample` should be set to False in the configuration file. Please make sure to update the"
98-
" config accordingly as not setting `clip_sample` in the config might lead to incorrect results in"
99-
" future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very"
100-
" nice if you could open a Pull request for the `scheduler/scheduler_config.json` file"
96+
f"The configuration file of this scheduler: {scheduler} has not set the configuration"
97+
" `skip_prk_steps`. `skip_prk_steps` should be set to True in the configuration file. Please make"
98+
" sure to update the config accordingly as not setting `skip_prk_steps` in the config might lead to"
99+
" incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face"
100+
" Hub, it would be very nice if you could open a Pull request for the"
101+
" `scheduler/scheduler_config.json` file"
101102
)
102-
deprecate("clip_sample not set", "1.0.0", deprecation_message, standard_warn=False)
103+
deprecate("skip_prk_steps not set", "1.0.0", deprecation_message, standard_warn=False)
103104
new_config = dict(scheduler.config)
104-
new_config["clip_sample"] = False
105+
new_config["skip_prk_steps"] = True
105106
scheduler._internal_dict = FrozenDict(new_config)
106107

107108
if safety_checker is None:

tests/pipelines/stable_diffusion/test_stable_diffusion.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,14 @@ def test_stable_diffusion(self):
640640
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
641641

642642
def test_stable_diffusion_fast_ddim(self):
643-
sd_pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-1", device_map="auto")
643+
scheduler = DDIMScheduler.from_config("CompVis/stable-diffusion-v1-1", subfolder="scheduler")
644+
645+
sd_pipe = StableDiffusionPipeline.from_pretrained(
646+
"CompVis/stable-diffusion-v1-1", scheduler=scheduler, device_map="auto"
647+
)
644648
sd_pipe = sd_pipe.to(torch_device)
645649
sd_pipe.set_progress_bar_config(disable=None)
646650

647-
scheduler = DDIMScheduler.from_config("CompVis/stable-diffusion-v1-1", subfolder="scheduler")
648-
sd_pipe.scheduler = scheduler
649-
650651
prompt = "A painting of a squirrel eating a burger"
651652
generator = torch.Generator(device=torch_device).manual_seed(0)
652653

0 commit comments

Comments
 (0)