Datasets:

ArXiv:
diffusers-benchmarking-bot commited on
Commit
dd2ff09
·
verified ·
1 Parent(s): ced7329

Upload folder using huggingface_hub

Browse files
main/adaptive_mask_inpainting.py CHANGED
@@ -416,10 +416,14 @@ class AdaptiveMaskInpaintPipeline(
416
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
417
  )
418
 
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
 
 
 
 
423
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
424
  deprecation_message = (
425
  "The configuration file of the unet has set the default `sample_size` to smaller than"
@@ -438,7 +442,7 @@ class AdaptiveMaskInpaintPipeline(
438
  unet._internal_dict = FrozenDict(new_config)
439
 
440
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
441
- if unet.config.in_channels != 9:
442
  logger.info(f"You have loaded a UNet with {unet.config.in_channels} input channels which.")
443
 
444
  self.register_modules(
 
416
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
417
  )
418
 
419
+ 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
+ )
427
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
428
  deprecation_message = (
429
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
442
  unet._internal_dict = FrozenDict(new_config)
443
 
444
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
445
+ if unet is not None and unet.config.in_channels != 9:
446
  logger.info(f"You have loaded a UNet with {unet.config.in_channels} input channels which.")
447
 
448
  self.register_modules(
main/composable_stable_diffusion.py CHANGED
@@ -132,10 +132,14 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
132
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
133
  )
134
 
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
 
 
 
 
139
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
140
  deprecation_message = (
141
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
132
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
133
  )
134
 
135
+ 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
+ )
143
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
144
  deprecation_message = (
145
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/instaflow_one_step.py CHANGED
@@ -152,10 +152,14 @@ class InstaFlowPipeline(
152
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
153
  )
154
 
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
 
 
 
 
159
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
160
  deprecation_message = (
161
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
152
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
153
  )
154
 
155
+ 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
+ )
163
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
164
  deprecation_message = (
165
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/ip_adapter_face_id.py CHANGED
@@ -234,10 +234,14 @@ class IPAdapterFaceIDStableDiffusionPipeline(
234
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
235
  )
236
 
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
 
 
 
 
241
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
242
  deprecation_message = (
243
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
234
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
235
  )
236
 
237
+ 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
+ )
245
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
246
  deprecation_message = (
247
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/llm_grounded_diffusion.py CHANGED
@@ -379,10 +379,14 @@ class LLMGroundedDiffusionPipeline(
379
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
380
  )
381
 
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
 
 
 
 
386
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
387
  deprecation_message = (
388
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
379
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
380
  )
381
 
382
+ 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
+ )
390
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
391
  deprecation_message = (
392
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/lpw_stable_diffusion.py CHANGED
@@ -539,10 +539,14 @@ class StableDiffusionLongPromptWeightingPipeline(
539
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
540
  )
541
 
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
 
 
 
 
546
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
547
  deprecation_message = (
548
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
539
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
540
  )
541
 
542
+ 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
+ )
550
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
551
  deprecation_message = (
552
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/lpw_stable_diffusion_xl.py CHANGED
@@ -678,7 +678,11 @@ class SDXLLongPromptWeightingPipeline(
678
  self.mask_processor = VaeImageProcessor(
679
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_binarize=True, do_convert_grayscale=True
680
  )
681
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
682
 
683
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
684
 
 
678
  self.mask_processor = VaeImageProcessor(
679
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_binarize=True, do_convert_grayscale=True
680
  )
681
+ self.default_sample_size = (
682
+ self.unet.config.sample_size
683
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
684
+ else 128
685
+ )
686
 
687
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
688
 
main/matryoshka.py CHANGED
@@ -3793,10 +3793,14 @@ class MatryoshkaPipeline(
3793
  # new_config["clip_sample"] = False
3794
  # scheduler._internal_dict = FrozenDict(new_config)
3795
 
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
 
 
 
 
3800
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
3801
  deprecation_message = (
3802
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
3793
  # new_config["clip_sample"] = False
3794
  # scheduler._internal_dict = FrozenDict(new_config)
3795
 
3796
+ 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
+ )
3804
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
3805
  deprecation_message = (
3806
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/pipeline_demofusion_sdxl.py CHANGED
@@ -168,7 +168,11 @@ class DemoFusionSDXLPipeline(
168
  self.register_to_config(force_zeros_for_empty_prompt=force_zeros_for_empty_prompt)
169
  self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) if getattr(self, "vae", None) else 8
170
  self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
171
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
172
 
173
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
174
 
 
168
  self.register_to_config(force_zeros_for_empty_prompt=force_zeros_for_empty_prompt)
169
  self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) if getattr(self, "vae", None) else 8
170
  self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
171
+ self.default_sample_size = (
172
+ self.unet.config.sample_size
173
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
174
+ else 128
175
+ )
176
 
177
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
178
 
main/pipeline_fabric.py CHANGED
@@ -150,10 +150,14 @@ class FabricPipeline(DiffusionPipeline):
150
  ):
151
  super().__init__()
152
 
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
 
 
 
 
157
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
158
  deprecation_message = (
159
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
150
  ):
151
  super().__init__()
152
 
153
+ 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
+ )
161
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
162
  deprecation_message = (
163
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/pipeline_kolors_differential_img2img.py CHANGED
@@ -216,7 +216,11 @@ class KolorsDifferentialImg2ImgPipeline(
216
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_convert_grayscale=True
217
  )
218
 
219
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
220
 
221
  # Copied from diffusers.pipelines.kolors.pipeline_kolors.KolorsPipeline.encode_prompt
222
  def encode_prompt(
 
216
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_convert_grayscale=True
217
  )
218
 
219
+ self.default_sample_size = (
220
+ self.unet.config.sample_size
221
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
222
+ else 128
223
+ )
224
 
225
  # Copied from diffusers.pipelines.kolors.pipeline_kolors.KolorsPipeline.encode_prompt
226
  def encode_prompt(
main/pipeline_prompt2prompt.py CHANGED
@@ -174,10 +174,14 @@ class Prompt2PromptPipeline(
174
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
175
  )
176
 
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
 
 
 
 
181
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
182
  deprecation_message = (
183
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
174
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
175
  )
176
 
177
+ 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
+ )
185
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
186
  deprecation_message = (
187
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/pipeline_sdxl_style_aligned.py CHANGED
@@ -494,7 +494,11 @@ class StyleAlignedSDXLPipeline(
494
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_binarize=True, do_convert_grayscale=True
495
  )
496
 
497
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
498
 
499
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
500
 
 
494
  vae_scale_factor=self.vae_scale_factor, do_normalize=False, do_binarize=True, do_convert_grayscale=True
495
  )
496
 
497
+ self.default_sample_size = (
498
+ self.unet.config.sample_size
499
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
500
+ else 128
501
+ )
502
 
503
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
504
 
main/pipeline_stable_diffusion_boxdiff.py CHANGED
@@ -460,10 +460,14 @@ class StableDiffusionBoxDiffPipeline(
460
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
461
  )
462
 
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
 
 
 
 
467
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
468
  deprecation_message = (
469
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
460
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
461
  )
462
 
463
+ 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
+ )
471
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
472
  deprecation_message = (
473
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/pipeline_stable_diffusion_pag.py CHANGED
@@ -427,10 +427,14 @@ class StableDiffusionPAGPipeline(
427
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
428
  )
429
 
430
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
431
- version.parse(unet.config._diffusers_version).base_version
432
- ) < version.parse("0.9.0.dev0")
433
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
434
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
435
  deprecation_message = (
436
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
427
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
428
  )
429
 
430
+ is_unet_version_less_0_9_0 = (
431
+ unet is not None
432
+ and hasattr(unet.config, "_diffusers_version")
433
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
434
+ )
435
+ is_unet_sample_size_less_64 = (
436
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
437
+ )
438
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
439
  deprecation_message = (
440
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/pipeline_stable_diffusion_xl_controlnet_adapter.py CHANGED
@@ -231,7 +231,11 @@ class StableDiffusionXLControlNetAdapterPipeline(
231
  self.control_image_processor = VaeImageProcessor(
232
  vae_scale_factor=self.vae_scale_factor, do_convert_rgb=True, do_normalize=False
233
  )
234
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
235
 
236
  # Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline.encode_prompt
237
  def encode_prompt(
 
231
  self.control_image_processor = VaeImageProcessor(
232
  vae_scale_factor=self.vae_scale_factor, do_convert_rgb=True, do_normalize=False
233
  )
234
+ self.default_sample_size = (
235
+ self.unet.config.sample_size
236
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
237
+ else 128
238
+ )
239
 
240
  # Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline.encode_prompt
241
  def encode_prompt(
main/pipeline_stable_diffusion_xl_controlnet_adapter_inpaint.py CHANGED
@@ -379,7 +379,11 @@ class StableDiffusionXLControlNetAdapterInpaintPipeline(
379
  self.control_image_processor = VaeImageProcessor(
380
  vae_scale_factor=self.vae_scale_factor, do_convert_rgb=True, do_normalize=False
381
  )
382
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
383
 
384
  # Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline.encode_prompt
385
  def encode_prompt(
 
379
  self.control_image_processor = VaeImageProcessor(
380
  vae_scale_factor=self.vae_scale_factor, do_convert_rgb=True, do_normalize=False
381
  )
382
+ self.default_sample_size = (
383
+ self.unet.config.sample_size
384
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
385
+ else 128
386
+ )
387
 
388
  # Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline.encode_prompt
389
  def encode_prompt(
main/pipeline_stable_diffusion_xl_ipex.py CHANGED
@@ -256,7 +256,11 @@ class StableDiffusionXLPipelineIpex(
256
  self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) if getattr(self, "vae", None) else 8
257
  self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
258
 
259
- self.default_sample_size = self.unet.config.sample_size
 
 
 
 
260
 
261
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
262
 
 
256
  self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) if getattr(self, "vae", None) else 8
257
  self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
258
 
259
+ self.default_sample_size = (
260
+ self.unet.config.sample_size
261
+ if hasattr(self, "unet") and self.unet is not None and hasattr(self.unet.config, "sample_size")
262
+ else 128
263
+ )
264
 
265
  add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
266
 
main/pipeline_zero1to3.py CHANGED
@@ -151,10 +151,14 @@ class Zero1to3StableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
151
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
152
  )
153
 
154
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
155
- version.parse(unet.config._diffusers_version).base_version
156
- ) < version.parse("0.9.0.dev0")
157
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
158
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
159
  deprecation_message = (
160
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
151
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
152
  )
153
 
154
+ is_unet_version_less_0_9_0 = (
155
+ unet is not None
156
+ and hasattr(unet.config, "_diffusers_version")
157
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
158
+ )
159
+ is_unet_sample_size_less_64 = (
160
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
161
+ )
162
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
163
  deprecation_message = (
164
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/stable_diffusion_ipex.py CHANGED
@@ -148,10 +148,14 @@ class StableDiffusionIPEXPipeline(
148
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
149
  )
150
 
151
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
152
- version.parse(unet.config._diffusers_version).base_version
153
- ) < version.parse("0.9.0.dev0")
154
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
155
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
156
  deprecation_message = (
157
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
148
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
149
  )
150
 
151
+ is_unet_version_less_0_9_0 = (
152
+ unet is not None
153
+ and hasattr(unet.config, "_diffusers_version")
154
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
155
+ )
156
+ is_unet_sample_size_less_64 = (
157
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
158
+ )
159
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
160
  deprecation_message = (
161
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/stable_diffusion_reference.py CHANGED
@@ -181,10 +181,14 @@ class StableDiffusionReferencePipeline(
181
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
182
  )
183
 
184
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
185
- version.parse(unet.config._diffusers_version).base_version
186
- ) < version.parse("0.9.0.dev0")
187
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
188
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
189
  deprecation_message = (
190
  "The configuration file of the unet has set the default `sample_size` to smaller than"
@@ -202,7 +206,7 @@ class StableDiffusionReferencePipeline(
202
  new_config["sample_size"] = 64
203
  unet._internal_dict = FrozenDict(new_config)
204
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
205
- if unet.config.in_channels != 4:
206
  logger.warning(
207
  f"You have loaded a UNet with {unet.config.in_channels} input channels, whereas by default,"
208
  f" {self.__class__} assumes that `pipeline.unet` has 4 input channels: 4 for `num_channels_latents`,"
 
181
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
182
  )
183
 
184
+ is_unet_version_less_0_9_0 = (
185
+ unet is not None
186
+ and hasattr(unet.config, "_diffusers_version")
187
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
188
+ )
189
+ is_unet_sample_size_less_64 = (
190
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
191
+ )
192
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
193
  deprecation_message = (
194
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
206
  new_config["sample_size"] = 64
207
  unet._internal_dict = FrozenDict(new_config)
208
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
209
+ if unet is not None and unet.config.in_channels != 4:
210
  logger.warning(
211
  f"You have loaded a UNet with {unet.config.in_channels} input channels, whereas by default,"
212
  f" {self.__class__} assumes that `pipeline.unet` has 4 input channels: 4 for `num_channels_latents`,"
main/stable_diffusion_repaint.py CHANGED
@@ -236,10 +236,14 @@ class StableDiffusionRepaintPipeline(
236
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
237
  )
238
 
239
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
240
- version.parse(unet.config._diffusers_version).base_version
241
- ) < version.parse("0.9.0.dev0")
242
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
243
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
244
  deprecation_message = (
245
  "The configuration file of the unet has set the default `sample_size` to smaller than"
@@ -257,7 +261,7 @@ class StableDiffusionRepaintPipeline(
257
  new_config["sample_size"] = 64
258
  unet._internal_dict = FrozenDict(new_config)
259
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
260
- if unet.config.in_channels != 4:
261
  logger.warning(
262
  f"You have loaded a UNet with {unet.config.in_channels} input channels, whereas by default,"
263
  f" {self.__class__} assumes that `pipeline.unet` has 4 input channels: 4 for `num_channels_latents`,"
 
236
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
237
  )
238
 
239
+ is_unet_version_less_0_9_0 = (
240
+ unet is not None
241
+ and hasattr(unet.config, "_diffusers_version")
242
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
243
+ )
244
+ is_unet_sample_size_less_64 = (
245
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
246
+ )
247
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
248
  deprecation_message = (
249
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
261
  new_config["sample_size"] = 64
262
  unet._internal_dict = FrozenDict(new_config)
263
  # Check shapes, assume num_channels_latents == 4, num_channels_mask == 1, num_channels_masked == 4
264
+ if unet is not None and unet.config.in_channels != 4:
265
  logger.warning(
266
  f"You have loaded a UNet with {unet.config.in_channels} input channels, whereas by default,"
267
  f" {self.__class__} assumes that `pipeline.unet` has 4 input channels: 4 for `num_channels_latents`,"
main/stable_diffusion_tensorrt_img2img.py CHANGED
@@ -753,10 +753,14 @@ class TensorRTStableDiffusionImg2ImgPipeline(DiffusionPipeline):
753
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
754
  )
755
 
756
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
757
- version.parse(unet.config._diffusers_version).base_version
758
- ) < version.parse("0.9.0.dev0")
759
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
760
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
761
  deprecation_message = (
762
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
753
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
754
  )
755
 
756
+ is_unet_version_less_0_9_0 = (
757
+ unet is not None
758
+ and hasattr(unet.config, "_diffusers_version")
759
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
760
+ )
761
+ is_unet_sample_size_less_64 = (
762
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
763
+ )
764
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
765
  deprecation_message = (
766
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/stable_diffusion_tensorrt_inpaint.py CHANGED
@@ -757,10 +757,14 @@ class TensorRTStableDiffusionInpaintPipeline(DiffusionPipeline):
757
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
758
  )
759
 
760
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
761
- version.parse(unet.config._diffusers_version).base_version
762
- ) < version.parse("0.9.0.dev0")
763
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
764
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
765
  deprecation_message = (
766
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
757
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
758
  )
759
 
760
+ is_unet_version_less_0_9_0 = (
761
+ unet is not None
762
+ and hasattr(unet.config, "_diffusers_version")
763
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
764
+ )
765
+ is_unet_sample_size_less_64 = (
766
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
767
+ )
768
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
769
  deprecation_message = (
770
  "The configuration file of the unet has set the default `sample_size` to smaller than"
main/stable_diffusion_tensorrt_txt2img.py CHANGED
@@ -669,10 +669,14 @@ class TensorRTStableDiffusionPipeline(DiffusionPipeline):
669
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
670
  )
671
 
672
- is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse(
673
- version.parse(unet.config._diffusers_version).base_version
674
- ) < version.parse("0.9.0.dev0")
675
- is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
 
 
 
 
676
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
677
  deprecation_message = (
678
  "The configuration file of the unet has set the default `sample_size` to smaller than"
 
669
  " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
670
  )
671
 
672
+ is_unet_version_less_0_9_0 = (
673
+ unet is not None
674
+ and hasattr(unet.config, "_diffusers_version")
675
+ and version.parse(version.parse(unet.config._diffusers_version).base_version) < version.parse("0.9.0.dev0")
676
+ )
677
+ is_unet_sample_size_less_64 = (
678
+ unet is not None and hasattr(unet.config, "sample_size") and unet.config.sample_size < 64
679
+ )
680
  if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64:
681
  deprecation_message = (
682
  "The configuration file of the unet has set the default `sample_size` to smaller than"