diffusers 0.26.3__py3-none-any.whl → 0.27.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (299) hide show
  1. diffusers/__init__.py +20 -1
  2. diffusers/commands/__init__.py +1 -1
  3. diffusers/commands/diffusers_cli.py +1 -1
  4. diffusers/commands/env.py +1 -1
  5. diffusers/commands/fp16_safetensors.py +1 -1
  6. diffusers/configuration_utils.py +7 -3
  7. diffusers/dependency_versions_check.py +1 -1
  8. diffusers/dependency_versions_table.py +2 -2
  9. diffusers/experimental/rl/value_guided_sampling.py +1 -1
  10. diffusers/image_processor.py +110 -4
  11. diffusers/loaders/autoencoder.py +7 -8
  12. diffusers/loaders/controlnet.py +17 -8
  13. diffusers/loaders/ip_adapter.py +86 -23
  14. diffusers/loaders/lora.py +105 -310
  15. diffusers/loaders/lora_conversion_utils.py +1 -1
  16. diffusers/loaders/peft.py +1 -1
  17. diffusers/loaders/single_file.py +51 -12
  18. diffusers/loaders/single_file_utils.py +274 -49
  19. diffusers/loaders/textual_inversion.py +23 -4
  20. diffusers/loaders/unet.py +195 -41
  21. diffusers/loaders/utils.py +1 -1
  22. diffusers/models/__init__.py +3 -1
  23. diffusers/models/activations.py +9 -9
  24. diffusers/models/attention.py +26 -36
  25. diffusers/models/attention_flax.py +1 -1
  26. diffusers/models/attention_processor.py +171 -114
  27. diffusers/models/autoencoders/autoencoder_asym_kl.py +1 -1
  28. diffusers/models/autoencoders/autoencoder_kl.py +3 -1
  29. diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py +1 -1
  30. diffusers/models/autoencoders/autoencoder_tiny.py +4 -2
  31. diffusers/models/autoencoders/consistency_decoder_vae.py +1 -1
  32. diffusers/models/autoencoders/vae.py +1 -1
  33. diffusers/models/controlnet.py +1 -1
  34. diffusers/models/controlnet_flax.py +1 -1
  35. diffusers/models/downsampling.py +8 -12
  36. diffusers/models/dual_transformer_2d.py +1 -1
  37. diffusers/models/embeddings.py +3 -4
  38. diffusers/models/embeddings_flax.py +1 -1
  39. diffusers/models/lora.py +33 -10
  40. diffusers/models/modeling_flax_pytorch_utils.py +1 -1
  41. diffusers/models/modeling_flax_utils.py +1 -1
  42. diffusers/models/modeling_pytorch_flax_utils.py +1 -1
  43. diffusers/models/modeling_utils.py +4 -6
  44. diffusers/models/normalization.py +1 -1
  45. diffusers/models/resnet.py +31 -58
  46. diffusers/models/resnet_flax.py +1 -1
  47. diffusers/models/t5_film_transformer.py +1 -1
  48. diffusers/models/transformer_2d.py +1 -1
  49. diffusers/models/transformer_temporal.py +1 -1
  50. diffusers/models/transformers/dual_transformer_2d.py +1 -1
  51. diffusers/models/transformers/t5_film_transformer.py +1 -1
  52. diffusers/models/transformers/transformer_2d.py +29 -31
  53. diffusers/models/transformers/transformer_temporal.py +1 -1
  54. diffusers/models/unet_1d.py +1 -1
  55. diffusers/models/unet_1d_blocks.py +1 -1
  56. diffusers/models/unet_2d.py +1 -1
  57. diffusers/models/unet_2d_blocks.py +1 -1
  58. diffusers/models/unet_2d_condition.py +1 -1
  59. diffusers/models/unets/__init__.py +1 -0
  60. diffusers/models/unets/unet_1d.py +1 -1
  61. diffusers/models/unets/unet_1d_blocks.py +1 -1
  62. diffusers/models/unets/unet_2d.py +4 -4
  63. diffusers/models/unets/unet_2d_blocks.py +238 -98
  64. diffusers/models/unets/unet_2d_blocks_flax.py +1 -1
  65. diffusers/models/unets/unet_2d_condition.py +420 -323
  66. diffusers/models/unets/unet_2d_condition_flax.py +21 -12
  67. diffusers/models/unets/unet_3d_blocks.py +50 -40
  68. diffusers/models/unets/unet_3d_condition.py +47 -8
  69. diffusers/models/unets/unet_i2vgen_xl.py +75 -30
  70. diffusers/models/unets/unet_kandinsky3.py +1 -1
  71. diffusers/models/unets/unet_motion_model.py +48 -8
  72. diffusers/models/unets/unet_spatio_temporal_condition.py +1 -1
  73. diffusers/models/unets/unet_stable_cascade.py +610 -0
  74. diffusers/models/unets/uvit_2d.py +1 -1
  75. diffusers/models/upsampling.py +10 -16
  76. diffusers/models/vae_flax.py +1 -1
  77. diffusers/models/vq_model.py +1 -1
  78. diffusers/optimization.py +1 -1
  79. diffusers/pipelines/__init__.py +26 -0
  80. diffusers/pipelines/amused/pipeline_amused.py +1 -1
  81. diffusers/pipelines/amused/pipeline_amused_img2img.py +1 -1
  82. diffusers/pipelines/amused/pipeline_amused_inpaint.py +1 -1
  83. diffusers/pipelines/animatediff/pipeline_animatediff.py +162 -417
  84. diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py +165 -137
  85. diffusers/pipelines/animatediff/pipeline_output.py +7 -6
  86. diffusers/pipelines/audioldm/pipeline_audioldm.py +3 -19
  87. diffusers/pipelines/audioldm2/modeling_audioldm2.py +1 -1
  88. diffusers/pipelines/audioldm2/pipeline_audioldm2.py +3 -3
  89. diffusers/pipelines/auto_pipeline.py +7 -16
  90. diffusers/pipelines/blip_diffusion/blip_image_processing.py +1 -1
  91. diffusers/pipelines/blip_diffusion/modeling_blip2.py +1 -1
  92. diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py +2 -2
  93. diffusers/pipelines/blip_diffusion/pipeline_blip_diffusion.py +2 -2
  94. diffusers/pipelines/consistency_models/pipeline_consistency_models.py +1 -1
  95. diffusers/pipelines/controlnet/pipeline_controlnet.py +90 -90
  96. diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py +2 -2
  97. diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +98 -90
  98. diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +92 -90
  99. diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py +145 -70
  100. diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +126 -89
  101. diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +108 -96
  102. diffusers/pipelines/controlnet/pipeline_flax_controlnet.py +2 -2
  103. diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py +1 -1
  104. diffusers/pipelines/ddim/pipeline_ddim.py +1 -1
  105. diffusers/pipelines/ddpm/pipeline_ddpm.py +1 -1
  106. diffusers/pipelines/deepfloyd_if/pipeline_if.py +4 -4
  107. diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py +4 -4
  108. diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py +5 -5
  109. diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py +4 -4
  110. diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py +5 -5
  111. diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py +5 -5
  112. diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py +10 -120
  113. diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py +10 -91
  114. diffusers/pipelines/deprecated/audio_diffusion/mel.py +1 -1
  115. diffusers/pipelines/deprecated/audio_diffusion/pipeline_audio_diffusion.py +1 -1
  116. diffusers/pipelines/deprecated/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py +1 -1
  117. diffusers/pipelines/deprecated/pndm/pipeline_pndm.py +1 -1
  118. diffusers/pipelines/deprecated/repaint/pipeline_repaint.py +1 -1
  119. diffusers/pipelines/deprecated/score_sde_ve/pipeline_score_sde_ve.py +1 -1
  120. diffusers/pipelines/deprecated/spectrogram_diffusion/continuous_encoder.py +1 -1
  121. diffusers/pipelines/deprecated/spectrogram_diffusion/midi_utils.py +1 -1
  122. diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py +1 -1
  123. diffusers/pipelines/deprecated/spectrogram_diffusion/pipeline_spectrogram_diffusion.py +1 -1
  124. diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py +5 -4
  125. diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py +5 -4
  126. diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py +7 -22
  127. diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py +5 -39
  128. diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py +5 -5
  129. diffusers/pipelines/deprecated/stochastic_karras_ve/pipeline_stochastic_karras_ve.py +1 -1
  130. diffusers/pipelines/deprecated/versatile_diffusion/modeling_text_unet.py +31 -22
  131. diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py +1 -1
  132. diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py +1 -1
  133. diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py +1 -2
  134. diffusers/pipelines/deprecated/vq_diffusion/pipeline_vq_diffusion.py +1 -1
  135. diffusers/pipelines/dit/pipeline_dit.py +1 -1
  136. diffusers/pipelines/free_init_utils.py +184 -0
  137. diffusers/pipelines/i2vgen_xl/pipeline_i2vgen_xl.py +22 -104
  138. diffusers/pipelines/kandinsky/pipeline_kandinsky.py +1 -1
  139. diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py +1 -1
  140. diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py +1 -1
  141. diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py +2 -2
  142. diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py +1 -1
  143. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py +1 -1
  144. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py +1 -1
  145. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py +1 -1
  146. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py +1 -1
  147. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py +1 -1
  148. diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py +2 -2
  149. diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +104 -93
  150. diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +112 -74
  151. diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py +1 -1
  152. diffusers/pipelines/ledits_pp/__init__.py +55 -0
  153. diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py +1505 -0
  154. diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py +1797 -0
  155. diffusers/pipelines/ledits_pp/pipeline_output.py +43 -0
  156. diffusers/pipelines/musicldm/pipeline_musicldm.py +3 -19
  157. diffusers/pipelines/onnx_utils.py +1 -1
  158. diffusers/pipelines/paint_by_example/image_encoder.py +1 -1
  159. diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py +3 -3
  160. diffusers/pipelines/pia/pipeline_pia.py +168 -327
  161. diffusers/pipelines/pipeline_flax_utils.py +1 -1
  162. diffusers/pipelines/pipeline_loading_utils.py +508 -0
  163. diffusers/pipelines/pipeline_utils.py +188 -534
  164. diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +56 -10
  165. diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py +3 -3
  166. diffusers/pipelines/shap_e/camera.py +1 -1
  167. diffusers/pipelines/shap_e/pipeline_shap_e.py +1 -1
  168. diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py +1 -1
  169. diffusers/pipelines/shap_e/renderer.py +1 -1
  170. diffusers/pipelines/stable_cascade/__init__.py +50 -0
  171. diffusers/pipelines/stable_cascade/pipeline_stable_cascade.py +482 -0
  172. diffusers/pipelines/stable_cascade/pipeline_stable_cascade_combined.py +311 -0
  173. diffusers/pipelines/stable_cascade/pipeline_stable_cascade_prior.py +638 -0
  174. diffusers/pipelines/stable_diffusion/clip_image_project_model.py +1 -1
  175. diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +4 -1
  176. diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +1 -1
  177. diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py +2 -2
  178. diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py +1 -1
  179. diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py +1 -1
  180. diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py +1 -1
  181. diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py +1 -1
  182. diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_upscale.py +1 -1
  183. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +90 -146
  184. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +5 -4
  185. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py +4 -32
  186. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +92 -119
  187. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +92 -119
  188. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +13 -59
  189. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +3 -31
  190. diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +5 -33
  191. diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +5 -21
  192. diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +7 -21
  193. diffusers/pipelines/stable_diffusion/safety_checker.py +1 -1
  194. diffusers/pipelines/stable_diffusion/safety_checker_flax.py +1 -1
  195. diffusers/pipelines/stable_diffusion/stable_unclip_image_normalizer.py +1 -1
  196. diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py +5 -21
  197. diffusers/pipelines/stable_diffusion_diffedit/pipeline_stable_diffusion_diffedit.py +9 -38
  198. diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py +5 -34
  199. diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py +6 -35
  200. diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_k_diffusion.py +7 -6
  201. diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_xl_k_diffusion.py +4 -124
  202. diffusers/pipelines/stable_diffusion_ldm3d/pipeline_stable_diffusion_ldm3d.py +282 -80
  203. diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py +94 -46
  204. diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py +3 -3
  205. diffusers/pipelines/stable_diffusion_safe/safety_checker.py +1 -1
  206. diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py +6 -22
  207. diffusers/pipelines/stable_diffusion_xl/pipeline_flax_stable_diffusion_xl.py +1 -1
  208. diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +96 -148
  209. diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +98 -154
  210. diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +98 -153
  211. diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py +25 -87
  212. diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py +89 -80
  213. diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py +5 -49
  214. diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_xl_adapter.py +80 -88
  215. diffusers/pipelines/text_to_video_synthesis/pipeline_output.py +8 -6
  216. diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +15 -86
  217. diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +20 -93
  218. diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +5 -5
  219. diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero_sdxl.py +3 -19
  220. diffusers/pipelines/unclip/pipeline_unclip.py +1 -1
  221. diffusers/pipelines/unclip/pipeline_unclip_image_variation.py +1 -1
  222. diffusers/pipelines/unclip/text_proj.py +1 -1
  223. diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py +35 -35
  224. diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py +1 -1
  225. diffusers/pipelines/wuerstchen/modeling_wuerstchen_common.py +4 -21
  226. diffusers/pipelines/wuerstchen/modeling_wuerstchen_diffnext.py +2 -2
  227. diffusers/pipelines/wuerstchen/modeling_wuerstchen_prior.py +4 -5
  228. diffusers/pipelines/wuerstchen/pipeline_wuerstchen.py +8 -8
  229. diffusers/pipelines/wuerstchen/pipeline_wuerstchen_combined.py +1 -1
  230. diffusers/pipelines/wuerstchen/pipeline_wuerstchen_prior.py +2 -2
  231. diffusers/schedulers/__init__.py +7 -1
  232. diffusers/schedulers/deprecated/scheduling_karras_ve.py +1 -1
  233. diffusers/schedulers/deprecated/scheduling_sde_vp.py +1 -1
  234. diffusers/schedulers/scheduling_consistency_models.py +42 -19
  235. diffusers/schedulers/scheduling_ddim.py +2 -4
  236. diffusers/schedulers/scheduling_ddim_flax.py +13 -5
  237. diffusers/schedulers/scheduling_ddim_inverse.py +2 -4
  238. diffusers/schedulers/scheduling_ddim_parallel.py +2 -4
  239. diffusers/schedulers/scheduling_ddpm.py +2 -4
  240. diffusers/schedulers/scheduling_ddpm_flax.py +1 -1
  241. diffusers/schedulers/scheduling_ddpm_parallel.py +2 -4
  242. diffusers/schedulers/scheduling_ddpm_wuerstchen.py +1 -1
  243. diffusers/schedulers/scheduling_deis_multistep.py +46 -19
  244. diffusers/schedulers/scheduling_dpmsolver_multistep.py +107 -21
  245. diffusers/schedulers/scheduling_dpmsolver_multistep_flax.py +1 -1
  246. diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py +9 -7
  247. diffusers/schedulers/scheduling_dpmsolver_sde.py +35 -35
  248. diffusers/schedulers/scheduling_dpmsolver_singlestep.py +49 -18
  249. diffusers/schedulers/scheduling_edm_dpmsolver_multistep.py +683 -0
  250. diffusers/schedulers/scheduling_edm_euler.py +381 -0
  251. diffusers/schedulers/scheduling_euler_ancestral_discrete.py +43 -15
  252. diffusers/schedulers/scheduling_euler_discrete.py +42 -17
  253. diffusers/schedulers/scheduling_euler_discrete_flax.py +1 -1
  254. diffusers/schedulers/scheduling_heun_discrete.py +35 -35
  255. diffusers/schedulers/scheduling_ipndm.py +37 -11
  256. diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py +44 -44
  257. diffusers/schedulers/scheduling_k_dpm_2_discrete.py +44 -44
  258. diffusers/schedulers/scheduling_karras_ve_flax.py +1 -1
  259. diffusers/schedulers/scheduling_lcm.py +38 -14
  260. diffusers/schedulers/scheduling_lms_discrete.py +43 -15
  261. diffusers/schedulers/scheduling_lms_discrete_flax.py +1 -1
  262. diffusers/schedulers/scheduling_pndm.py +2 -4
  263. diffusers/schedulers/scheduling_pndm_flax.py +2 -4
  264. diffusers/schedulers/scheduling_repaint.py +1 -1
  265. diffusers/schedulers/scheduling_sasolver.py +41 -9
  266. diffusers/schedulers/scheduling_sde_ve.py +1 -1
  267. diffusers/schedulers/scheduling_sde_ve_flax.py +1 -1
  268. diffusers/schedulers/scheduling_tcd.py +686 -0
  269. diffusers/schedulers/scheduling_unclip.py +1 -1
  270. diffusers/schedulers/scheduling_unipc_multistep.py +46 -19
  271. diffusers/schedulers/scheduling_utils.py +2 -1
  272. diffusers/schedulers/scheduling_utils_flax.py +1 -1
  273. diffusers/schedulers/scheduling_vq_diffusion.py +1 -1
  274. diffusers/training_utils.py +9 -2
  275. diffusers/utils/__init__.py +2 -1
  276. diffusers/utils/accelerate_utils.py +1 -1
  277. diffusers/utils/constants.py +1 -1
  278. diffusers/utils/doc_utils.py +1 -1
  279. diffusers/utils/dummy_pt_objects.py +60 -0
  280. diffusers/utils/dummy_torch_and_transformers_objects.py +75 -0
  281. diffusers/utils/dynamic_modules_utils.py +1 -1
  282. diffusers/utils/export_utils.py +3 -3
  283. diffusers/utils/hub_utils.py +60 -16
  284. diffusers/utils/import_utils.py +15 -1
  285. diffusers/utils/loading_utils.py +2 -0
  286. diffusers/utils/logging.py +1 -1
  287. diffusers/utils/model_card_template.md +24 -0
  288. diffusers/utils/outputs.py +14 -7
  289. diffusers/utils/peft_utils.py +1 -1
  290. diffusers/utils/state_dict_utils.py +1 -1
  291. diffusers/utils/testing_utils.py +2 -0
  292. diffusers/utils/torch_utils.py +1 -1
  293. {diffusers-0.26.3.dist-info → diffusers-0.27.0.dist-info}/METADATA +46 -46
  294. diffusers-0.27.0.dist-info/RECORD +399 -0
  295. {diffusers-0.26.3.dist-info → diffusers-0.27.0.dist-info}/WHEEL +1 -1
  296. diffusers-0.26.3.dist-info/RECORD +0 -384
  297. {diffusers-0.26.3.dist-info → diffusers-0.27.0.dist-info}/LICENSE +0 -0
  298. {diffusers-0.26.3.dist-info → diffusers-0.27.0.dist-info}/entry_points.txt +0 -0
  299. {diffusers-0.26.3.dist-info → diffusers-0.27.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The HuggingFace Team. All rights reserved.
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ from ...utils import (
54
54
  unscale_lora_layers,
55
55
  )
56
56
  from ...utils.torch_utils import is_compiled_module, randn_tensor
57
- from ..pipeline_utils import DiffusionPipeline
57
+ from ..pipeline_utils import DiffusionPipeline, StableDiffusionMixin
58
58
  from ..stable_diffusion_xl.pipeline_output import StableDiffusionXLPipelineOutput
59
59
 
60
60
 
@@ -157,7 +157,11 @@ def retrieve_latents(
157
157
 
158
158
 
159
159
  class StableDiffusionXLControlNetImg2ImgPipeline(
160
- DiffusionPipeline, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, IPAdapterMixin
160
+ DiffusionPipeline,
161
+ StableDiffusionMixin,
162
+ TextualInversionLoaderMixin,
163
+ StableDiffusionXLLoraLoaderMixin,
164
+ IPAdapterMixin,
161
165
  ):
162
166
  r"""
163
167
  Pipeline for image-to-image generation using Stable Diffusion XL with ControlNet guidance.
@@ -271,39 +275,6 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
271
275
  self.register_to_config(force_zeros_for_empty_prompt=force_zeros_for_empty_prompt)
272
276
  self.register_to_config(requires_aesthetics_score=requires_aesthetics_score)
273
277
 
274
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_vae_slicing
275
- def enable_vae_slicing(self):
276
- r"""
277
- Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
278
- compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.
279
- """
280
- self.vae.enable_slicing()
281
-
282
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_vae_slicing
283
- def disable_vae_slicing(self):
284
- r"""
285
- Disable sliced VAE decoding. If `enable_vae_slicing` was previously enabled, this method will go back to
286
- computing decoding in one step.
287
- """
288
- self.vae.disable_slicing()
289
-
290
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_vae_tiling
291
- def enable_vae_tiling(self):
292
- r"""
293
- Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
294
- compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
295
- processing larger images.
296
- """
297
- self.vae.enable_tiling()
298
-
299
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_vae_tiling
300
- def disable_vae_tiling(self):
301
- r"""
302
- Disable tiled VAE decoding. If `enable_vae_tiling` was previously enabled, this method will go back to
303
- computing decoding in one step.
304
- """
305
- self.vae.disable_tiling()
306
-
307
278
  # Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline.encode_prompt
308
279
  def encode_prompt(
309
280
  self,
@@ -400,7 +371,7 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
400
371
  prompt_2 = prompt_2 or prompt
401
372
  prompt_2 = [prompt_2] if isinstance(prompt_2, str) else prompt_2
402
373
 
403
- # textual inversion: procecss multi-vector tokens if necessary
374
+ # textual inversion: process multi-vector tokens if necessary
404
375
  prompt_embeds_list = []
405
376
  prompts = [prompt, prompt_2]
406
377
  for prompt, tokenizer, text_encoder in zip(prompts, tokenizers, text_encoders):
@@ -565,31 +536,54 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
565
536
  return image_embeds, uncond_image_embeds
566
537
 
567
538
  # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_ip_adapter_image_embeds
568
- def prepare_ip_adapter_image_embeds(self, ip_adapter_image, device, num_images_per_prompt):
569
- if not isinstance(ip_adapter_image, list):
570
- ip_adapter_image = [ip_adapter_image]
539
+ def prepare_ip_adapter_image_embeds(
540
+ self, ip_adapter_image, ip_adapter_image_embeds, device, num_images_per_prompt, do_classifier_free_guidance
541
+ ):
542
+ if ip_adapter_image_embeds is None:
543
+ if not isinstance(ip_adapter_image, list):
544
+ ip_adapter_image = [ip_adapter_image]
571
545
 
572
- if len(ip_adapter_image) != len(self.unet.encoder_hid_proj.image_projection_layers):
573
- raise ValueError(
574
- f"`ip_adapter_image` must have same length as the number of IP Adapters. Got {len(ip_adapter_image)} images and {len(self.unet.encoder_hid_proj.image_projection_layers)} IP Adapters."
575
- )
546
+ if len(ip_adapter_image) != len(self.unet.encoder_hid_proj.image_projection_layers):
547
+ raise ValueError(
548
+ f"`ip_adapter_image` must have same length as the number of IP Adapters. Got {len(ip_adapter_image)} images and {len(self.unet.encoder_hid_proj.image_projection_layers)} IP Adapters."
549
+ )
576
550
 
577
- image_embeds = []
578
- for single_ip_adapter_image, image_proj_layer in zip(
579
- ip_adapter_image, self.unet.encoder_hid_proj.image_projection_layers
580
- ):
581
- output_hidden_state = not isinstance(image_proj_layer, ImageProjection)
582
- single_image_embeds, single_negative_image_embeds = self.encode_image(
583
- single_ip_adapter_image, device, 1, output_hidden_state
584
- )
585
- single_image_embeds = torch.stack([single_image_embeds] * num_images_per_prompt, dim=0)
586
- single_negative_image_embeds = torch.stack([single_negative_image_embeds] * num_images_per_prompt, dim=0)
551
+ image_embeds = []
552
+ for single_ip_adapter_image, image_proj_layer in zip(
553
+ ip_adapter_image, self.unet.encoder_hid_proj.image_projection_layers
554
+ ):
555
+ output_hidden_state = not isinstance(image_proj_layer, ImageProjection)
556
+ single_image_embeds, single_negative_image_embeds = self.encode_image(
557
+ single_ip_adapter_image, device, 1, output_hidden_state
558
+ )
559
+ single_image_embeds = torch.stack([single_image_embeds] * num_images_per_prompt, dim=0)
560
+ single_negative_image_embeds = torch.stack(
561
+ [single_negative_image_embeds] * num_images_per_prompt, dim=0
562
+ )
587
563
 
588
- if self.do_classifier_free_guidance:
589
- single_image_embeds = torch.cat([single_negative_image_embeds, single_image_embeds])
590
- single_image_embeds = single_image_embeds.to(device)
564
+ if do_classifier_free_guidance:
565
+ single_image_embeds = torch.cat([single_negative_image_embeds, single_image_embeds])
566
+ single_image_embeds = single_image_embeds.to(device)
591
567
 
592
- image_embeds.append(single_image_embeds)
568
+ image_embeds.append(single_image_embeds)
569
+ else:
570
+ repeat_dims = [1]
571
+ image_embeds = []
572
+ for single_image_embeds in ip_adapter_image_embeds:
573
+ if do_classifier_free_guidance:
574
+ single_negative_image_embeds, single_image_embeds = single_image_embeds.chunk(2)
575
+ single_image_embeds = single_image_embeds.repeat(
576
+ num_images_per_prompt, *(repeat_dims * len(single_image_embeds.shape[1:]))
577
+ )
578
+ single_negative_image_embeds = single_negative_image_embeds.repeat(
579
+ num_images_per_prompt, *(repeat_dims * len(single_negative_image_embeds.shape[1:]))
580
+ )
581
+ single_image_embeds = torch.cat([single_negative_image_embeds, single_image_embeds])
582
+ else:
583
+ single_image_embeds = single_image_embeds.repeat(
584
+ num_images_per_prompt, *(repeat_dims * len(single_image_embeds.shape[1:]))
585
+ )
586
+ image_embeds.append(single_image_embeds)
593
587
 
594
588
  return image_embeds
595
589
 
@@ -625,6 +619,8 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
625
619
  negative_prompt_embeds=None,
626
620
  pooled_prompt_embeds=None,
627
621
  negative_pooled_prompt_embeds=None,
622
+ ip_adapter_image=None,
623
+ ip_adapter_image_embeds=None,
628
624
  controlnet_conditioning_scale=1.0,
629
625
  control_guidance_start=0.0,
630
626
  control_guidance_end=1.0,
@@ -795,6 +791,21 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
795
791
  if end > 1.0:
796
792
  raise ValueError(f"control guidance end: {end} can't be larger than 1.0.")
797
793
 
794
+ if ip_adapter_image is not None and ip_adapter_image_embeds is not None:
795
+ raise ValueError(
796
+ "Provide either `ip_adapter_image` or `ip_adapter_image_embeds`. Cannot leave both `ip_adapter_image` and `ip_adapter_image_embeds` defined."
797
+ )
798
+
799
+ if ip_adapter_image_embeds is not None:
800
+ if not isinstance(ip_adapter_image_embeds, list):
801
+ raise ValueError(
802
+ f"`ip_adapter_image_embeds` has to be of type `list` but is {type(ip_adapter_image_embeds)}"
803
+ )
804
+ elif ip_adapter_image_embeds[0].ndim not in [3, 4]:
805
+ raise ValueError(
806
+ f"`ip_adapter_image_embeds` has to be a list of 3D or 4D tensors but is {ip_adapter_image_embeds[0].ndim}D"
807
+ )
808
+
798
809
  # Copied from diffusers.pipelines.controlnet.pipeline_controlnet_sd_xl.StableDiffusionXLControlNetPipeline.check_image
799
810
  def check_image(self, image, prompt, prompt_embeds):
800
811
  image_is_pil = isinstance(image, PIL.Image.Image)
@@ -871,6 +882,8 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
871
882
 
872
883
  t_start = max(num_inference_steps - init_timestep, 0)
873
884
  timesteps = self.scheduler.timesteps[t_start * self.scheduler.order :]
885
+ if hasattr(self.scheduler, "set_begin_index"):
886
+ self.scheduler.set_begin_index(t_start * self.scheduler.order)
874
887
 
875
888
  return timesteps, num_inference_steps - t_start
876
889
 
@@ -1015,34 +1028,6 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1015
1028
  self.vae.decoder.conv_in.to(dtype)
1016
1029
  self.vae.decoder.mid_block.to(dtype)
1017
1030
 
1018
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_freeu
1019
- def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
1020
- r"""Enables the FreeU mechanism as in https://arxiv.org/abs/2309.11497.
1021
-
1022
- The suffixes after the scaling factors represent the stages where they are being applied.
1023
-
1024
- Please refer to the [official repository](https://github.com/ChenyangSi/FreeU) for combinations of the values
1025
- that are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL.
1026
-
1027
- Args:
1028
- s1 (`float`):
1029
- Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to
1030
- mitigate "oversmoothing effect" in the enhanced denoising process.
1031
- s2 (`float`):
1032
- Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to
1033
- mitigate "oversmoothing effect" in the enhanced denoising process.
1034
- b1 (`float`): Scaling factor for stage 1 to amplify the contributions of backbone features.
1035
- b2 (`float`): Scaling factor for stage 2 to amplify the contributions of backbone features.
1036
- """
1037
- if not hasattr(self, "unet"):
1038
- raise ValueError("The pipeline must have `unet` for using FreeU.")
1039
- self.unet.enable_freeu(s1=s1, s2=s2, b1=b1, b2=b2)
1040
-
1041
- # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_freeu
1042
- def disable_freeu(self):
1043
- """Disables the FreeU mechanism if enabled."""
1044
- self.unet.disable_freeu()
1045
-
1046
1031
  @property
1047
1032
  def guidance_scale(self):
1048
1033
  return self._guidance_scale
@@ -1090,6 +1075,7 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1090
1075
  pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
1091
1076
  negative_pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
1092
1077
  ip_adapter_image: Optional[PipelineImageInput] = None,
1078
+ ip_adapter_image_embeds: Optional[List[torch.FloatTensor]] = None,
1093
1079
  output_type: Optional[str] = "pil",
1094
1080
  return_dict: bool = True,
1095
1081
  cross_attention_kwargs: Optional[Dict[str, Any]] = None,
@@ -1140,15 +1126,15 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1140
1126
  The width in pixels of the generated image. Anything below 512 pixels won't work well for
1141
1127
  [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
1142
1128
  and checkpoints that are not specifically fine-tuned on low resolutions.
1129
+ strength (`float`, *optional*, defaults to 0.8):
1130
+ Indicates extent to transform the reference `image`. Must be between 0 and 1. `image` is used as a
1131
+ starting point and more noise is added the higher the `strength`. The number of denoising steps depends
1132
+ on the amount of noise initially added. When `strength` is 1, added noise is maximum and the denoising
1133
+ process runs for the full number of iterations specified in `num_inference_steps`. A value of 1
1134
+ essentially ignores `image`.
1143
1135
  num_inference_steps (`int`, *optional*, defaults to 50):
1144
1136
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1145
1137
  expense of slower inference.
1146
- strength (`float`, *optional*, defaults to 0.3):
1147
- Conceptually, indicates how much to transform the reference `image`. Must be between 0 and 1. `image`
1148
- will be used as a starting point, adding more noise to it the larger the `strength`. The number of
1149
- denoising steps depends on the amount of noise initially added. When `strength` is 1, added noise will
1150
- be maximum and the denoising process will run for the full number of iterations specified in
1151
- `num_inference_steps`.
1152
1138
  guidance_scale (`float`, *optional*, defaults to 7.5):
1153
1139
  Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1154
1140
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
@@ -1189,6 +1175,11 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1189
1175
  weighting. If not provided, pooled negative_prompt_embeds will be generated from `negative_prompt`
1190
1176
  input argument.
1191
1177
  ip_adapter_image: (`PipelineImageInput`, *optional*): Optional image input to work with IP Adapters.
1178
+ ip_adapter_image_embeds (`List[torch.FloatTensor]`, *optional*):
1179
+ Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of IP-adapters.
1180
+ Each element should be a tensor of shape `(batch_size, num_images, emb_dim)`. It should contain the negative image embedding
1181
+ if `do_classifier_free_guidance` is set to `True`.
1182
+ If not provided, embeddings are computed from the `ip_adapter_image` input argument.
1192
1183
  output_type (`str`, *optional*, defaults to `"pil"`):
1193
1184
  The output format of the generate image. Choose between
1194
1185
  [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
@@ -1312,6 +1303,8 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1312
1303
  negative_prompt_embeds,
1313
1304
  pooled_prompt_embeds,
1314
1305
  negative_pooled_prompt_embeds,
1306
+ ip_adapter_image,
1307
+ ip_adapter_image_embeds,
1315
1308
  controlnet_conditioning_scale,
1316
1309
  control_guidance_start,
1317
1310
  control_guidance_end,
@@ -1368,9 +1361,13 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1368
1361
  )
1369
1362
 
1370
1363
  # 3.2 Encode ip_adapter_image
1371
- if ip_adapter_image is not None:
1364
+ if ip_adapter_image is not None or ip_adapter_image_embeds is not None:
1372
1365
  image_embeds = self.prepare_ip_adapter_image_embeds(
1373
- ip_adapter_image, device, batch_size * num_images_per_prompt
1366
+ ip_adapter_image,
1367
+ ip_adapter_image_embeds,
1368
+ device,
1369
+ batch_size * num_images_per_prompt,
1370
+ self.do_classifier_free_guidance,
1374
1371
  )
1375
1372
 
1376
1373
  # 4. Prepare image and controlnet_conditioning_image
@@ -1535,7 +1532,7 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1535
1532
  down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples]
1536
1533
  mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample])
1537
1534
 
1538
- if ip_adapter_image is not None:
1535
+ if ip_adapter_image is not None or ip_adapter_image_embeds is not None:
1539
1536
  added_cond_kwargs["image_embeds"] = image_embeds
1540
1537
 
1541
1538
  # predict the noise residual
@@ -1590,7 +1587,22 @@ class StableDiffusionXLControlNetImg2ImgPipeline(
1590
1587
  self.upcast_vae()
1591
1588
  latents = latents.to(next(iter(self.vae.post_quant_conv.parameters())).dtype)
1592
1589
 
1593
- image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False)[0]
1590
+ # unscale/denormalize the latents
1591
+ # denormalize with the mean and std if available and not None
1592
+ has_latents_mean = hasattr(self.vae.config, "latents_mean") and self.vae.config.latents_mean is not None
1593
+ has_latents_std = hasattr(self.vae.config, "latents_std") and self.vae.config.latents_std is not None
1594
+ if has_latents_mean and has_latents_std:
1595
+ latents_mean = (
1596
+ torch.tensor(self.vae.config.latents_mean).view(1, 4, 1, 1).to(latents.device, latents.dtype)
1597
+ )
1598
+ latents_std = (
1599
+ torch.tensor(self.vae.config.latents_std).view(1, 4, 1, 1).to(latents.device, latents.dtype)
1600
+ )
1601
+ latents = latents * latents_std / self.vae.config.scaling_factor + latents_mean
1602
+ else:
1603
+ latents = latents / self.vae.config.scaling_factor
1604
+
1605
+ image = self.vae.decode(latents, return_dict=False)[0]
1594
1606
 
1595
1607
  # cast back to fp16 if needed
1596
1608
  if needs_upcasting:
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The HuggingFace Team. All rights reserved.
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -156,7 +156,7 @@ class FlaxStableDiffusionControlNetPipeline(FlaxDiffusionPipeline):
156
156
  self.dtype = dtype
157
157
 
158
158
  if safety_checker is None:
159
- logger.warn(
159
+ logger.warning(
160
160
  f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure"
161
161
  " that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered"
162
162
  " results in services or applications open to the public. Both the diffusers team and Hugging Face"
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The HuggingFace Team. All rights reserved.
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The HuggingFace Team. All rights reserved.
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2023 The HuggingFace Team. All rights reserved.
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -416,13 +416,13 @@ class IFPipeline(DiffusionPipeline, LoraLoaderMixin):
416
416
 
417
417
  def _text_preprocessing(self, text, clean_caption=False):
418
418
  if clean_caption and not is_bs4_available():
419
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
420
- logger.warn("Setting `clean_caption` to False...")
419
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
420
+ logger.warning("Setting `clean_caption` to False...")
421
421
  clean_caption = False
422
422
 
423
423
  if clean_caption and not is_ftfy_available():
424
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
425
- logger.warn("Setting `clean_caption` to False...")
424
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
425
+ logger.warning("Setting `clean_caption` to False...")
426
426
  clean_caption = False
427
427
 
428
428
  if not isinstance(text, (tuple, list)):
@@ -460,13 +460,13 @@ class IFImg2ImgPipeline(DiffusionPipeline, LoraLoaderMixin):
460
460
  # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
461
461
  def _text_preprocessing(self, text, clean_caption=False):
462
462
  if clean_caption and not is_bs4_available():
463
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
464
- logger.warn("Setting `clean_caption` to False...")
463
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
464
+ logger.warning("Setting `clean_caption` to False...")
465
465
  clean_caption = False
466
466
 
467
467
  if clean_caption and not is_ftfy_available():
468
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
469
- logger.warn("Setting `clean_caption` to False...")
468
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
469
+ logger.warning("Setting `clean_caption` to False...")
470
470
  clean_caption = False
471
471
 
472
472
  if not isinstance(text, (tuple, list)):
@@ -175,7 +175,7 @@ class IFImg2ImgSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
175
175
  )
176
176
 
177
177
  if unet.config.in_channels != 6:
178
- logger.warn(
178
+ logger.warning(
179
179
  "It seems like you have loaded a checkpoint that shall not be used for super resolution from {unet.config._name_or_path} as it accepts {unet.config.in_channels} input channels instead of 6. Please make sure to pass a super resolution checkpoint as the `'unet'`: IFSuperResolutionPipeline.from_pretrained(unet=super_resolution_unet, ...)`."
180
180
  )
181
181
 
@@ -209,13 +209,13 @@ class IFImg2ImgSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
209
209
  # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
210
210
  def _text_preprocessing(self, text, clean_caption=False):
211
211
  if clean_caption and not is_bs4_available():
212
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
213
- logger.warn("Setting `clean_caption` to False...")
212
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
213
+ logger.warning("Setting `clean_caption` to False...")
214
214
  clean_caption = False
215
215
 
216
216
  if clean_caption and not is_ftfy_available():
217
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
218
- logger.warn("Setting `clean_caption` to False...")
217
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
218
+ logger.warning("Setting `clean_caption` to False...")
219
219
  clean_caption = False
220
220
 
221
221
  if not isinstance(text, (tuple, list)):
@@ -500,13 +500,13 @@ class IFInpaintingPipeline(DiffusionPipeline, LoraLoaderMixin):
500
500
  # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
501
501
  def _text_preprocessing(self, text, clean_caption=False):
502
502
  if clean_caption and not is_bs4_available():
503
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
504
- logger.warn("Setting `clean_caption` to False...")
503
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
504
+ logger.warning("Setting `clean_caption` to False...")
505
505
  clean_caption = False
506
506
 
507
507
  if clean_caption and not is_ftfy_available():
508
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
509
- logger.warn("Setting `clean_caption` to False...")
508
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
509
+ logger.warning("Setting `clean_caption` to False...")
510
510
  clean_caption = False
511
511
 
512
512
  if not isinstance(text, (tuple, list)):
@@ -177,7 +177,7 @@ class IFInpaintingSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
177
177
  )
178
178
 
179
179
  if unet.config.in_channels != 6:
180
- logger.warn(
180
+ logger.warning(
181
181
  "It seems like you have loaded a checkpoint that shall not be used for super resolution from {unet.config._name_or_path} as it accepts {unet.config.in_channels} input channels instead of 6. Please make sure to pass a super resolution checkpoint as the `'unet'`: IFSuperResolutionPipeline.from_pretrained(unet=super_resolution_unet, ...)`."
182
182
  )
183
183
 
@@ -211,13 +211,13 @@ class IFInpaintingSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
211
211
  # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
212
212
  def _text_preprocessing(self, text, clean_caption=False):
213
213
  if clean_caption and not is_bs4_available():
214
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
215
- logger.warn("Setting `clean_caption` to False...")
214
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
215
+ logger.warning("Setting `clean_caption` to False...")
216
216
  clean_caption = False
217
217
 
218
218
  if clean_caption and not is_ftfy_available():
219
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
220
- logger.warn("Setting `clean_caption` to False...")
219
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
220
+ logger.warning("Setting `clean_caption` to False...")
221
221
  clean_caption = False
222
222
 
223
223
  if not isinstance(text, (tuple, list)):
@@ -133,7 +133,7 @@ class IFSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
133
133
  )
134
134
 
135
135
  if unet.config.in_channels != 6:
136
- logger.warn(
136
+ logger.warning(
137
137
  "It seems like you have loaded a checkpoint that shall not be used for super resolution from {unet.config._name_or_path} as it accepts {unet.config.in_channels} input channels instead of 6. Please make sure to pass a super resolution checkpoint as the `'unet'`: IFSuperResolutionPipeline.from_pretrained(unet=super_resolution_unet, ...)`."
138
138
  )
139
139
 
@@ -167,13 +167,13 @@ class IFSuperResolutionPipeline(DiffusionPipeline, LoraLoaderMixin):
167
167
  # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
168
168
  def _text_preprocessing(self, text, clean_caption=False):
169
169
  if clean_caption and not is_bs4_available():
170
- logger.warn(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
171
- logger.warn("Setting `clean_caption` to False...")
170
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
171
+ logger.warning("Setting `clean_caption` to False...")
172
172
  clean_caption = False
173
173
 
174
174
  if clean_caption and not is_ftfy_available():
175
- logger.warn(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
176
- logger.warn("Setting `clean_caption` to False...")
175
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
176
+ logger.warning("Setting `clean_caption` to False...")
177
177
  clean_caption = False
178
178
 
179
179
  if not isinstance(text, (tuple, list)):