Skip to content

Commit 076f304

Browse files
committed
Use Pipelines without unet
1 parent c28db0a commit 076f304

35 files changed

+280
-141
lines changed

examples/community/adaptive_mask_inpainting.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,14 @@ def __init__(
416416
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
417417
)
418418

419-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
420-
version.parse(unet.config._diffusers_version).base_version
421-
) < version.parse("0.9.0.dev0")
422-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
419+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
420+
unet is not None
421+
and hasattr(unet.config, "_diffusers_version")
422+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
423+
)
424+
is_unet_sample_size_less_64 = (
425+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
426+
)
423427
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
424428
deprecation_message = (
425429
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/composable_stable_diffusion.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,14 @@ def __init__(
132132
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
133133
)
134134

135-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
136-
version.parse(unet.config._diffusers_version).base_version
137-
) < version.parse("0.9.0.dev0")
138-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
135+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
136+
unet is not None
137+
and hasattr(unet.config, "_diffusers_version")
138+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
139+
)
140+
is_unet_sample_size_less_64 = (
141+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
142+
)
139143
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
140144
deprecation_message = (
141145
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/instaflow_one_step.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,14 @@ def __init__(
152152
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
153153
)
154154

155-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
156-
version.parse(unet.config._diffusers_version).base_version
157-
) < version.parse("0.9.0.dev0")
158-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
155+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
156+
unet is not None
157+
and hasattr(unet.config, "_diffusers_version")
158+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
159+
)
160+
is_unet_sample_size_less_64 = (
161+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
162+
)
159163
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
160164
deprecation_message = (
161165
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/ip_adapter_face_id.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,14 @@ def __init__(
234234
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
235235
)
236236

237-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
238-
version.parse(unet.config._diffusers_version).base_version
239-
) < version.parse("0.9.0.dev0")
240-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
237+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
238+
unet is not None
239+
and hasattr(unet.config, "_diffusers_version")
240+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
241+
)
242+
is_unet_sample_size_less_64 = (
243+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
244+
)
241245
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
242246
deprecation_message = (
243247
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/llm_grounded_diffusion.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,14 @@ def __init__(
379379
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
380380
)
381381

382-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
383-
version.parse(unet.config._diffusers_version).base_version
384-
) < version.parse("0.9.0.dev0")
385-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
382+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
383+
unet is not None
384+
and hasattr(unet.config, "_diffusers_version")
385+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
386+
)
387+
is_unet_sample_size_less_64 = (
388+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
389+
)
386390
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
387391
deprecation_message = (
388392
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/lpw_stable_diffusion.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,14 @@ def __init__(
539539
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
540540
)
541541

542-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
543-
version.parse(unet.config._diffusers_version).base_version
544-
) < version.parse("0.9.0.dev0")
545-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
542+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
543+
unet is not None
544+
and hasattr(unet.config, "_diffusers_version")
545+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
546+
)
547+
is_unet_sample_size_less_64 = (
548+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
549+
)
546550
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
547551
deprecation_message = (
548552
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/matryoshka.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,10 +3793,14 @@ def __init__(
37933793
# new_config["clip_sample"] = False
37943794
# scheduler._internal_dict = FrozenDict(new_config)
37953795

3796-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
3797-
version.parse(unet.config._diffusers_version).base_version
3798-
) < version.parse("0.9.0.dev0")
3799-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
3796+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
3797+
unet is not None
3798+
and hasattr(unet.config, "_diffusers_version")
3799+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
3800+
)
3801+
is_unet_sample_size_less_64 = (
3802+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
3803+
)
38003804
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
38013805
deprecation_message = (
38023806
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/pipeline_fabric.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,14 @@ def __init__(
150150
):
151151
super().__init__()
152152

153-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
154-
version.parse(unet.config._diffusers_version).base_version
155-
) < version.parse("0.9.0.dev0")
156-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
153+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
154+
unet is not None
155+
and hasattr(unet.config, "_diffusers_version")
156+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
157+
)
158+
is_unet_sample_size_less_64 = (
159+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
160+
)
157161
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
158162
deprecation_message = (
159163
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/pipeline_prompt2prompt.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,14 @@ def __init__(
174174
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
175175
)
176176

177-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
178-
version.parse(unet.config._diffusers_version).base_version
179-
) < version.parse("0.9.0.dev0")
180-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
177+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
178+
unet is not None
179+
and hasattr(unet.config, "_diffusers_version")
180+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
181+
)
182+
is_unet_sample_size_less_64 = (
183+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
184+
)
181185
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
182186
deprecation_message = (
183187
"The configuration file of the unet has set the default `sample_size` to smaller than"

examples/community/pipeline_stable_diffusion_boxdiff.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,14 @@ def __init__(
460460
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
461461
)
462462

463-
is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
464-
version.parse(unet.config._diffusers_version).base_version
465-
) < version.parse("0.9.0.dev0")
466-
is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
463+
is_unet_version_less_0_9_0 = is_unet_version_less_0_9_0 = (
464+
unet is not None
465+
and hasattr(unet.config, "_diffusers_version")
466+
and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
467+
)
468+
is_unet_sample_size_less_64 = (
469+
unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
470+
)
467471
if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
468472
deprecation_message = (
469473
"The configuration file of the unet has set the default `sample_size` to smaller than"

0 commit comments

Comments
 (0)