diffusers 0.18.1__tar.gz → 0.18.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. {diffusers-0.18.1/src/diffusers.egg-info → diffusers-0.18.2}/PKG-INFO +1 -1
  2. {diffusers-0.18.1 → diffusers-0.18.2}/setup.py +1 -1
  3. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/__init__.py +1 -1
  4. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/configuration_utils.py +2 -2
  5. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/loaders.py +1 -1
  6. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/pipeline_utils.py +10 -1
  7. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +84 -31
  8. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +4 -2
  9. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +11 -7
  10. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +13 -9
  11. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +10 -7
  12. {diffusers-0.18.1 → diffusers-0.18.2/src/diffusers.egg-info}/PKG-INFO +1 -1
  13. {diffusers-0.18.1 → diffusers-0.18.2}/LICENSE +0 -0
  14. {diffusers-0.18.1 → diffusers-0.18.2}/MANIFEST.in +0 -0
  15. {diffusers-0.18.1 → diffusers-0.18.2}/README.md +0 -0
  16. {diffusers-0.18.1 → diffusers-0.18.2}/pyproject.toml +0 -0
  17. {diffusers-0.18.1 → diffusers-0.18.2}/setup.cfg +0 -0
  18. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/commands/__init__.py +0 -0
  19. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/commands/diffusers_cli.py +0 -0
  20. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/commands/env.py +0 -0
  21. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/dependency_versions_check.py +0 -0
  22. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/dependency_versions_table.py +0 -0
  23. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/experimental/__init__.py +0 -0
  24. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/experimental/rl/__init__.py +0 -0
  25. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/experimental/rl/value_guided_sampling.py +0 -0
  26. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/image_processor.py +0 -0
  27. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/__init__.py +0 -0
  28. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/activations.py +0 -0
  29. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/attention.py +0 -0
  30. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/attention_flax.py +0 -0
  31. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/attention_processor.py +0 -0
  32. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/autoencoder_kl.py +0 -0
  33. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/controlnet.py +0 -0
  34. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/controlnet_flax.py +0 -0
  35. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/cross_attention.py +0 -0
  36. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/dual_transformer_2d.py +0 -0
  37. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/embeddings.py +0 -0
  38. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/embeddings_flax.py +0 -0
  39. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/modeling_flax_pytorch_utils.py +0 -0
  40. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/modeling_flax_utils.py +0 -0
  41. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/modeling_pytorch_flax_utils.py +0 -0
  42. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/modeling_utils.py +0 -0
  43. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/prior_transformer.py +0 -0
  44. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/resnet.py +0 -0
  45. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/resnet_flax.py +0 -0
  46. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/t5_film_transformer.py +0 -0
  47. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/transformer_2d.py +0 -0
  48. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/transformer_temporal.py +0 -0
  49. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_1d.py +0 -0
  50. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_1d_blocks.py +0 -0
  51. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_2d.py +0 -0
  52. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_2d_blocks.py +0 -0
  53. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_2d_blocks_flax.py +0 -0
  54. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_2d_condition.py +0 -0
  55. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_2d_condition_flax.py +0 -0
  56. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_3d_blocks.py +0 -0
  57. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/unet_3d_condition.py +0 -0
  58. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/vae.py +0 -0
  59. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/vae_flax.py +0 -0
  60. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/models/vq_model.py +0 -0
  61. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/optimization.py +0 -0
  62. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipeline_utils.py +0 -0
  63. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/__init__.py +0 -0
  64. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/alt_diffusion/__init__.py +0 -0
  65. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/alt_diffusion/modeling_roberta_series.py +0 -0
  66. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py +0 -0
  67. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py +0 -0
  68. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/audio_diffusion/__init__.py +0 -0
  69. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/audio_diffusion/mel.py +0 -0
  70. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py +0 -0
  71. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/audioldm/__init__.py +0 -0
  72. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/audioldm/pipeline_audioldm.py +0 -0
  73. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/consistency_models/__init__.py +0 -0
  74. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py +0 -0
  75. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/__init__.py +0 -0
  76. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/multicontrolnet.py +0 -0
  77. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/pipeline_controlnet.py +0 -0
  78. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +0 -0
  79. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +0 -0
  80. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/controlnet/pipeline_flax_controlnet.py +0 -0
  81. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/dance_diffusion/__init__.py +0 -0
  82. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py +0 -0
  83. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/ddim/__init__.py +0 -0
  84. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/ddim/pipeline_ddim.py +0 -0
  85. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/ddpm/__init__.py +0 -0
  86. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/ddpm/pipeline_ddpm.py +0 -0
  87. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/__init__.py +0 -0
  88. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py +0 -0
  89. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py +0 -0
  90. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py +0 -0
  91. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py +0 -0
  92. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py +0 -0
  93. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py +0 -0
  94. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/safety_checker.py +0 -0
  95. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/timesteps.py +0 -0
  96. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/deepfloyd_if/watermark.py +0 -0
  97. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/dit/__init__.py +0 -0
  98. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/dit/pipeline_dit.py +0 -0
  99. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/__init__.py +0 -0
  100. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py +0 -0
  101. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py +0 -0
  102. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py +0 -0
  103. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py +0 -0
  104. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky/text_encoder.py +0 -0
  105. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/__init__.py +0 -0
  106. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py +0 -0
  107. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py +0 -0
  108. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py +0 -0
  109. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py +0 -0
  110. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py +0 -0
  111. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py +0 -0
  112. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py +0 -0
  113. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/latent_diffusion/__init__.py +0 -0
  114. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py +0 -0
  115. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py +0 -0
  116. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/latent_diffusion_uncond/__init__.py +0 -0
  117. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py +0 -0
  118. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/onnx_utils.py +0 -0
  119. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/paint_by_example/__init__.py +0 -0
  120. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/paint_by_example/image_encoder.py +0 -0
  121. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py +0 -0
  122. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/pipeline_flax_utils.py +0 -0
  123. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/pndm/__init__.py +0 -0
  124. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/pndm/pipeline_pndm.py +0 -0
  125. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/repaint/__init__.py +0 -0
  126. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/repaint/pipeline_repaint.py +0 -0
  127. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/score_sde_ve/__init__.py +0 -0
  128. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py +0 -0
  129. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/semantic_stable_diffusion/__init__.py +0 -0
  130. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py +0 -0
  131. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/shap_e/__init__.py +0 -0
  132. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/shap_e/camera.py +0 -0
  133. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/shap_e/pipeline_shap_e.py +0 -0
  134. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py +0 -0
  135. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/shap_e/renderer.py +0 -0
  136. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/spectrogram_diffusion/__init__.py +0 -0
  137. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/spectrogram_diffusion/continous_encoder.py +0 -0
  138. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/spectrogram_diffusion/midi_utils.py +0 -0
  139. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/spectrogram_diffusion/notes_encoder.py +0 -0
  140. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/spectrogram_diffusion/pipeline_spectrogram_diffusion.py +0 -0
  141. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/__init__.py +0 -0
  142. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py +0 -0
  143. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +0 -0
  144. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_controlnet.py +0 -0
  145. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py +0 -0
  146. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py +0 -0
  147. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py +0 -0
  148. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py +0 -0
  149. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py +0 -0
  150. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint_legacy.py +0 -0
  151. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_upscale.py +0 -0
  152. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +0 -0
  153. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_attend_and_excite.py +0 -0
  154. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_controlnet.py +0 -0
  155. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +0 -0
  156. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py +0 -0
  157. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py +0 -0
  158. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +0 -0
  159. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py +0 -0
  160. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +0 -0
  161. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_k_diffusion.py +0 -0
  162. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +0 -0
  163. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py +0 -0
  164. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_model_editing.py +0 -0
  165. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py +0 -0
  166. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_paradigms.py +0 -0
  167. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py +0 -0
  168. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_sag.py +0 -0
  169. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +0 -0
  170. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +0 -0
  171. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/safety_checker.py +0 -0
  172. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/safety_checker_flax.py +0 -0
  173. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion/stable_unclip_image_normalizer.py +0 -0
  174. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_safe/__init__.py +0 -0
  175. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py +0 -0
  176. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_safe/safety_checker.py +0 -0
  177. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_xl/__init__.py +0 -0
  178. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stable_diffusion_xl/watermark.py +0 -0
  179. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stochastic_karras_ve/__init__.py +0 -0
  180. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py +0 -0
  181. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/text_to_video_synthesis/__init__.py +0 -0
  182. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +0 -0
  183. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +0 -0
  184. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +0 -0
  185. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unclip/__init__.py +0 -0
  186. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unclip/pipeline_unclip.py +0 -0
  187. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unclip/pipeline_unclip_image_variation.py +0 -0
  188. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unclip/text_proj.py +0 -0
  189. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unidiffuser/__init__.py +0 -0
  190. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py +0 -0
  191. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unidiffuser/modeling_uvit.py +0 -0
  192. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py +0 -0
  193. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/__init__.py +0 -0
  194. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/modeling_text_unet.py +0 -0
  195. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion.py +0 -0
  196. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py +0 -0
  197. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py +0 -0
  198. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py +0 -0
  199. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/vq_diffusion/__init__.py +0 -0
  200. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/pipelines/vq_diffusion/pipeline_vq_diffusion.py +0 -0
  201. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/__init__.py +0 -0
  202. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_consistency_models.py +0 -0
  203. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddim.py +0 -0
  204. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddim_flax.py +0 -0
  205. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddim_inverse.py +0 -0
  206. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddim_parallel.py +0 -0
  207. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddpm.py +0 -0
  208. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddpm_flax.py +0 -0
  209. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ddpm_parallel.py +0 -0
  210. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_deis_multistep.py +0 -0
  211. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py +0 -0
  212. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_dpmsolver_multistep_flax.py +0 -0
  213. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py +0 -0
  214. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_dpmsolver_sde.py +0 -0
  215. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py +0 -0
  216. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py +0 -0
  217. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_euler_discrete.py +0 -0
  218. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_heun_discrete.py +0 -0
  219. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_ipndm.py +0 -0
  220. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py +0 -0
  221. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py +0 -0
  222. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_karras_ve.py +0 -0
  223. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_karras_ve_flax.py +0 -0
  224. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_lms_discrete.py +0 -0
  225. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_lms_discrete_flax.py +0 -0
  226. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_pndm.py +0 -0
  227. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_pndm_flax.py +0 -0
  228. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_repaint.py +0 -0
  229. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_sde_ve.py +0 -0
  230. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_sde_ve_flax.py +0 -0
  231. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_sde_vp.py +0 -0
  232. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_unclip.py +0 -0
  233. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_unipc_multistep.py +0 -0
  234. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_utils.py +0 -0
  235. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_utils_flax.py +0 -0
  236. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/schedulers/scheduling_vq_diffusion.py +0 -0
  237. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/training_utils.py +0 -0
  238. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/__init__.py +0 -0
  239. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/accelerate_utils.py +0 -0
  240. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/constants.py +0 -0
  241. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/deprecation_utils.py +0 -0
  242. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/doc_utils.py +0 -0
  243. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_flax_and_transformers_objects.py +0 -0
  244. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_flax_objects.py +0 -0
  245. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_note_seq_objects.py +0 -0
  246. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_onnx_objects.py +0 -0
  247. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_pt_objects.py +0 -0
  248. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_librosa_objects.py +0 -0
  249. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_scipy_objects.py +0 -0
  250. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_torchsde_objects.py +0 -0
  251. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_transformers_and_invisible_watermark_objects.py +0 -0
  252. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_transformers_and_k_diffusion_objects.py +0 -0
  253. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_transformers_and_onnx_objects.py +0 -0
  254. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_torch_and_transformers_objects.py +0 -0
  255. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py +0 -0
  256. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/dynamic_modules_utils.py +0 -0
  257. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/hub_utils.py +0 -0
  258. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/import_utils.py +0 -0
  259. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/logging.py +0 -0
  260. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/model_card_template.md +0 -0
  261. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/outputs.py +0 -0
  262. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/pil_utils.py +0 -0
  263. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/testing_utils.py +0 -0
  264. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers/utils/torch_utils.py +0 -0
  265. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers.egg-info/SOURCES.txt +0 -0
  266. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers.egg-info/dependency_links.txt +0 -0
  267. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers.egg-info/entry_points.txt +0 -0
  268. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers.egg-info/requires.txt +0 -0
  269. {diffusers-0.18.1 → diffusers-0.18.2}/src/diffusers.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffusers
3
- Version: 0.18.1
3
+ Version: 0.18.2
4
4
  Summary: Diffusers
5
5
  Home-page: https://github.com/huggingface/diffusers
6
6
  Author: The HuggingFace team
@@ -232,7 +232,7 @@ install_requires = [
232
232
 
233
233
  setup(
234
234
  name="diffusers",
235
- version="0.18.1", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
235
+ version="0.18.2", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
236
236
  description="Diffusers",
237
237
  long_description=open("README.md", "r", encoding="utf-8").read(),
238
238
  long_description_content_type="text/markdown",
@@ -1,4 +1,4 @@
1
- __version__ = "0.18.1"
1
+ __version__ = "0.18.2"
2
2
 
3
3
  from .configuration_utils import ConfigMixin
4
4
  from .utils import (
@@ -607,7 +607,7 @@ def register_to_config(init):
607
607
 
608
608
  # Take note of the parameters that were not present in the loaded config
609
609
  if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
610
- new_kwargs["_use_default_values"] = set(new_kwargs.keys()) - set(init_kwargs)
610
+ new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))
611
611
 
612
612
  new_kwargs = {**config_init_kwargs, **new_kwargs}
613
613
  getattr(self, "register_to_config")(**new_kwargs)
@@ -655,7 +655,7 @@ def flax_register_to_config(cls):
655
655
 
656
656
  # Take note of the parameters that were not present in the loaded config
657
657
  if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
658
- new_kwargs["_use_default_values"] = set(new_kwargs.keys()) - set(init_kwargs)
658
+ new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))
659
659
 
660
660
  getattr(self, "register_to_config")(**new_kwargs)
661
661
  original_init(self, *args, **kwargs)
@@ -1394,7 +1394,7 @@ class FromSingleFileMixin:
1394
1394
  use_auth_token = kwargs.pop("use_auth_token", None)
1395
1395
  revision = kwargs.pop("revision", None)
1396
1396
  extract_ema = kwargs.pop("extract_ema", False)
1397
- image_size = kwargs.pop("image_size", 512)
1397
+ image_size = kwargs.pop("image_size", None)
1398
1398
  scheduler_type = kwargs.pop("scheduler_type", "pndm")
1399
1399
  num_in_channels = kwargs.pop("num_in_channels", None)
1400
1400
  upcast_attention = kwargs.pop("upcast_attention", None)
@@ -1213,6 +1213,15 @@ class DiffusionPipeline(ConfigMixin):
1213
1213
  filenames = {sibling.rfilename for sibling in info.siblings}
1214
1214
  model_filenames, variant_filenames = variant_compatible_siblings(filenames, variant=variant)
1215
1215
 
1216
+ if len(variant_filenames) == 0 and variant is not None:
1217
+ deprecation_message = (
1218
+ f"You are trying to load the model files of the `variant={variant}`, but no such modeling files are available."
1219
+ f"The default model files: {model_filenames} will be loaded instead. Make sure to not load from `variant={variant}`"
1220
+ "if such variant modeling files are not available. Doing so will lead to an error in v0.22.0 as defaulting to non-variant"
1221
+ "modeling files is deprecated."
1222
+ )
1223
+ deprecate("no variant default", "0.22.0", deprecation_message, standard_warn=False)
1224
+
1216
1225
  # remove ignored filenames
1217
1226
  model_filenames = set(model_filenames) - set(ignore_filenames)
1218
1227
  variant_filenames = set(variant_filenames) - set(ignore_filenames)
@@ -1302,7 +1311,7 @@ class DiffusionPipeline(ConfigMixin):
1302
1311
  snapshot_folder = Path(config_file).parent
1303
1312
  pipeline_is_cached = all((snapshot_folder / f).is_file() for f in expected_files)
1304
1313
 
1305
- if pipeline_is_cached:
1314
+ if pipeline_is_cached and not force_download:
1306
1315
  # if the pipeline is cached, we can directly return it
1307
1316
  # else call snapshot_download
1308
1317
  return snapshot_folder
@@ -24,6 +24,7 @@ from transformers import (
24
24
  AutoFeatureExtractor,
25
25
  BertTokenizerFast,
26
26
  CLIPImageProcessor,
27
+ CLIPTextConfig,
27
28
  CLIPTextModel,
28
29
  CLIPTextModelWithProjection,
29
30
  CLIPTokenizer,
@@ -48,7 +49,7 @@ from ...schedulers import (
48
49
  PNDMScheduler,
49
50
  UnCLIPScheduler,
50
51
  )
51
- from ...utils import is_omegaconf_available, is_safetensors_available, logging
52
+ from ...utils import is_accelerate_available, is_omegaconf_available, is_safetensors_available, logging
52
53
  from ...utils.import_utils import BACKENDS_MAPPING
53
54
  from ..latent_diffusion.pipeline_latent_diffusion import LDMBertConfig, LDMBertModel
54
55
  from ..paint_by_example import PaintByExampleImageEncoder
@@ -57,6 +58,10 @@ from .safety_checker import StableDiffusionSafetyChecker
57
58
  from .stable_unclip_image_normalizer import StableUnCLIPImageNormalizer
58
59
 
59
60
 
61
+ if is_accelerate_available():
62
+ from accelerate import init_empty_weights
63
+ from accelerate.utils import set_module_tensor_to_device
64
+
60
65
  logger = logging.get_logger(__name__) # pylint: disable=invalid-name
61
66
 
62
67
 
@@ -770,11 +775,12 @@ def convert_ldm_bert_checkpoint(checkpoint, config):
770
775
 
771
776
 
772
777
  def convert_ldm_clip_checkpoint(checkpoint, local_files_only=False, text_encoder=None):
773
- text_model = (
774
- CLIPTextModel.from_pretrained("openai/clip-vit-large-patch14", local_files_only=local_files_only)
775
- if text_encoder is None
776
- else text_encoder
777
- )
778
+ if text_encoder is None:
779
+ config_name = "openai/clip-vit-large-patch14"
780
+ config = CLIPTextConfig.from_pretrained(config_name)
781
+
782
+ with init_empty_weights():
783
+ text_model = CLIPTextModel(config)
778
784
 
779
785
  keys = list(checkpoint.keys())
780
786
 
@@ -787,7 +793,8 @@ def convert_ldm_clip_checkpoint(checkpoint, local_files_only=False, text_encoder
787
793
  if key.startswith(prefix):
788
794
  text_model_dict[key[len(prefix + ".") :]] = checkpoint[key]
789
795
 
790
- text_model.load_state_dict(text_model_dict)
796
+ for param_name, param in text_model_dict.items():
797
+ set_module_tensor_to_device(text_model, param_name, "cpu", value=param)
791
798
 
792
799
  return text_model
793
800
 
@@ -884,14 +891,26 @@ def convert_paint_by_example_checkpoint(checkpoint):
884
891
  return model
885
892
 
886
893
 
887
- def convert_open_clip_checkpoint(checkpoint, prefix="cond_stage_model.model."):
894
+ def convert_open_clip_checkpoint(
895
+ checkpoint, config_name, prefix="cond_stage_model.model.", has_projection=False, **config_kwargs
896
+ ):
888
897
  # text_model = CLIPTextModel.from_pretrained("stabilityai/stable-diffusion-2", subfolder="text_encoder")
889
- text_model = CLIPTextModelWithProjection.from_pretrained(
890
- "laion/CLIP-ViT-bigG-14-laion2B-39B-b160k", projection_dim=1280
891
- )
898
+ # text_model = CLIPTextModelWithProjection.from_pretrained(
899
+ # "laion/CLIP-ViT-bigG-14-laion2B-39B-b160k", projection_dim=1280
900
+ # )
901
+ config = CLIPTextConfig.from_pretrained(config_name, **config_kwargs)
902
+
903
+ with init_empty_weights():
904
+ text_model = CLIPTextModelWithProjection(config) if has_projection else CLIPTextModel(config)
892
905
 
893
906
  keys = list(checkpoint.keys())
894
907
 
908
+ keys_to_ignore = []
909
+ if config_name == "stabilityai/stable-diffusion-2" and config.num_hidden_layers == 23:
910
+ # make sure to remove all keys > 22
911
+ keys_to_ignore += [k for k in keys if k.startswith("cond_stage_model.model.transformer.resblocks.23")]
912
+ keys_to_ignore += ["cond_stage_model.model.text_projection"]
913
+
895
914
  text_model_dict = {}
896
915
 
897
916
  if prefix + "text_projection" in checkpoint:
@@ -902,8 +921,8 @@ def convert_open_clip_checkpoint(checkpoint, prefix="cond_stage_model.model."):
902
921
  text_model_dict["text_model.embeddings.position_ids"] = text_model.text_model.embeddings.get_buffer("position_ids")
903
922
 
904
923
  for key in keys:
905
- # if "resblocks.23" in key: # Diffusers drops the final layer and only uses the penultimate layer
906
- # continue
924
+ if key in keys_to_ignore:
925
+ continue
907
926
  if key[len(prefix) :] in textenc_conversion_map:
908
927
  if key.endswith("text_projection"):
909
928
  value = checkpoint[key].T
@@ -931,7 +950,8 @@ def convert_open_clip_checkpoint(checkpoint, prefix="cond_stage_model.model."):
931
950
 
932
951
  text_model_dict[new_key] = checkpoint[key]
933
952
 
934
- text_model.load_state_dict(text_model_dict)
953
+ for param_name, param in text_model_dict.items():
954
+ set_module_tensor_to_device(text_model, param_name, "cpu", value=param)
935
955
 
936
956
  return text_model
937
957
 
@@ -1061,7 +1081,7 @@ def convert_controlnet_checkpoint(
1061
1081
  def download_from_original_stable_diffusion_ckpt(
1062
1082
  checkpoint_path: str,
1063
1083
  original_config_file: str = None,
1064
- image_size: int = 512,
1084
+ image_size: Optional[int] = None,
1065
1085
  prediction_type: str = None,
1066
1086
  model_type: str = None,
1067
1087
  extract_ema: bool = False,
@@ -1144,6 +1164,7 @@ def download_from_original_stable_diffusion_ckpt(
1144
1164
  LDMTextToImagePipeline,
1145
1165
  PaintByExamplePipeline,
1146
1166
  StableDiffusionControlNetPipeline,
1167
+ StableDiffusionInpaintPipeline,
1147
1168
  StableDiffusionPipeline,
1148
1169
  StableDiffusionXLImg2ImgPipeline,
1149
1170
  StableDiffusionXLPipeline,
@@ -1166,12 +1187,9 @@ def download_from_original_stable_diffusion_ckpt(
1166
1187
  if not is_safetensors_available():
1167
1188
  raise ValueError(BACKENDS_MAPPING["safetensors"][1])
1168
1189
 
1169
- from safetensors import safe_open
1190
+ from safetensors.torch import load_file as safe_load
1170
1191
 
1171
- checkpoint = {}
1172
- with safe_open(checkpoint_path, framework="pt", device="cpu") as f:
1173
- for key in f.keys():
1174
- checkpoint[key] = f.get_tensor(key)
1192
+ checkpoint = safe_load(checkpoint_path, device="cpu")
1175
1193
  else:
1176
1194
  if device is None:
1177
1195
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -1183,7 +1201,7 @@ def download_from_original_stable_diffusion_ckpt(
1183
1201
  if "global_step" in checkpoint:
1184
1202
  global_step = checkpoint["global_step"]
1185
1203
  else:
1186
- logger.warning("global_step key not found in model")
1204
+ logger.debug("global_step key not found in model")
1187
1205
  global_step = None
1188
1206
 
1189
1207
  # NOTE: this while loop isn't great but this controlnet checkpoint has one additional
@@ -1230,8 +1248,15 @@ def download_from_original_stable_diffusion_ckpt(
1230
1248
  model_type = "SDXL"
1231
1249
  else:
1232
1250
  model_type = "SDXL-Refiner"
1251
+ if image_size is None:
1252
+ image_size = 1024
1233
1253
 
1234
- if num_in_channels is not None:
1254
+ if num_in_channels is None and pipeline_class == StableDiffusionInpaintPipeline:
1255
+ num_in_channels = 9
1256
+ elif num_in_channels is None:
1257
+ num_in_channels = 4
1258
+
1259
+ if "unet_config" in original_config.model.params:
1235
1260
  original_config["model"]["params"]["unet_config"]["params"]["in_channels"] = num_in_channels
1236
1261
 
1237
1262
  if (
@@ -1263,7 +1288,6 @@ def download_from_original_stable_diffusion_ckpt(
1263
1288
  num_train_timesteps = getattr(original_config.model.params, "timesteps", None) or 1000
1264
1289
 
1265
1290
  if model_type in ["SDXL", "SDXL-Refiner"]:
1266
- image_size = 1024
1267
1291
  scheduler_dict = {
1268
1292
  "beta_schedule": "scaled_linear",
1269
1293
  "beta_start": 0.00085,
@@ -1279,7 +1303,6 @@ def download_from_original_stable_diffusion_ckpt(
1279
1303
  }
1280
1304
  scheduler = EulerDiscreteScheduler.from_config(scheduler_dict)
1281
1305
  scheduler_type = "euler"
1282
- vae_path = "stabilityai/sdxl-vae"
1283
1306
  else:
1284
1307
  beta_start = getattr(original_config.model.params, "linear_start", None) or 0.02
1285
1308
  beta_end = getattr(original_config.model.params, "linear_end", None) or 0.085
@@ -1318,25 +1341,45 @@ def download_from_original_stable_diffusion_ckpt(
1318
1341
  # Convert the UNet2DConditionModel model.
1319
1342
  unet_config = create_unet_diffusers_config(original_config, image_size=image_size)
1320
1343
  unet_config["upcast_attention"] = upcast_attention
1321
- unet = UNet2DConditionModel(**unet_config)
1344
+ with init_empty_weights():
1345
+ unet = UNet2DConditionModel(**unet_config)
1322
1346
 
1323
1347
  converted_unet_checkpoint = convert_ldm_unet_checkpoint(
1324
1348
  checkpoint, unet_config, path=checkpoint_path, extract_ema=extract_ema
1325
1349
  )
1326
- unet.load_state_dict(converted_unet_checkpoint)
1350
+
1351
+ for param_name, param in converted_unet_checkpoint.items():
1352
+ set_module_tensor_to_device(unet, param_name, "cpu", value=param)
1327
1353
 
1328
1354
  # Convert the VAE model.
1329
1355
  if vae_path is None:
1330
1356
  vae_config = create_vae_diffusers_config(original_config, image_size=image_size)
1331
1357
  converted_vae_checkpoint = convert_ldm_vae_checkpoint(checkpoint, vae_config)
1332
1358
 
1333
- vae = AutoencoderKL(**vae_config)
1334
- vae.load_state_dict(converted_vae_checkpoint)
1359
+ if (
1360
+ "model" in original_config
1361
+ and "params" in original_config.model
1362
+ and "scale_factor" in original_config.model.params
1363
+ ):
1364
+ vae_scaling_factor = original_config.model.params.scale_factor
1365
+ else:
1366
+ vae_scaling_factor = 0.18215 # default SD scaling factor
1367
+
1368
+ vae_config["scaling_factor"] = vae_scaling_factor
1369
+
1370
+ with init_empty_weights():
1371
+ vae = AutoencoderKL(**vae_config)
1372
+
1373
+ for param_name, param in converted_vae_checkpoint.items():
1374
+ set_module_tensor_to_device(vae, param_name, "cpu", value=param)
1335
1375
  else:
1336
1376
  vae = AutoencoderKL.from_pretrained(vae_path)
1337
1377
 
1338
1378
  if model_type == "FrozenOpenCLIPEmbedder":
1339
- text_model = convert_open_clip_checkpoint(checkpoint)
1379
+ config_name = "stabilityai/stable-diffusion-2"
1380
+ config_kwargs = {"subfolder": "text_encoder"}
1381
+
1382
+ text_model = convert_open_clip_checkpoint(checkpoint, config_name, **config_kwargs)
1340
1383
  tokenizer = CLIPTokenizer.from_pretrained("stabilityai/stable-diffusion-2", subfolder="tokenizer")
1341
1384
 
1342
1385
  if stable_unclip is None:
@@ -1469,7 +1512,12 @@ def download_from_original_stable_diffusion_ckpt(
1469
1512
  tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
1470
1513
  text_encoder = convert_ldm_clip_checkpoint(checkpoint, local_files_only=local_files_only)
1471
1514
  tokenizer_2 = CLIPTokenizer.from_pretrained("laion/CLIP-ViT-bigG-14-laion2B-39B-b160k", pad_token="!")
1472
- text_encoder_2 = convert_open_clip_checkpoint(checkpoint, prefix="conditioner.embedders.1.model.")
1515
+
1516
+ config_name = "laion/CLIP-ViT-bigG-14-laion2B-39B-b160k"
1517
+ config_kwargs = {"projection_dim": 1280}
1518
+ text_encoder_2 = convert_open_clip_checkpoint(
1519
+ checkpoint, config_name, prefix="conditioner.embedders.1.model.", has_projection=True, **config_kwargs
1520
+ )
1473
1521
 
1474
1522
  pipe = StableDiffusionXLPipeline(
1475
1523
  vae=vae,
@@ -1485,7 +1533,12 @@ def download_from_original_stable_diffusion_ckpt(
1485
1533
  tokenizer = None
1486
1534
  text_encoder = None
1487
1535
  tokenizer_2 = CLIPTokenizer.from_pretrained("laion/CLIP-ViT-bigG-14-laion2B-39B-b160k", pad_token="!")
1488
- text_encoder_2 = convert_open_clip_checkpoint(checkpoint, prefix="conditioner.embedders.0.model.")
1536
+
1537
+ config_name = "laion/CLIP-ViT-bigG-14-laion2B-39B-b160k"
1538
+ config_kwargs = {"projection_dim": 1280}
1539
+ text_encoder_2 = convert_open_clip_checkpoint(
1540
+ checkpoint, config_name, prefix="conditioner.embedders.0.model.", has_projection=True, **config_kwargs
1541
+ )
1489
1542
 
1490
1543
  pipe = StableDiffusionXLImg2ImgPipeline(
1491
1544
  vae=vae,
@@ -24,7 +24,7 @@ from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
24
24
 
25
25
  from ...configuration_utils import FrozenDict
26
26
  from ...image_processor import VaeImageProcessor
27
- from ...loaders import LoraLoaderMixin, TextualInversionLoaderMixin
27
+ from ...loaders import FromSingleFileMixin, LoraLoaderMixin, TextualInversionLoaderMixin
28
28
  from ...models import AutoencoderKL, UNet2DConditionModel
29
29
  from ...schedulers import KarrasDiffusionSchedulers
30
30
  from ...utils import deprecate, is_accelerate_available, is_accelerate_version, logging, randn_tensor
@@ -153,7 +153,9 @@ def prepare_mask_and_masked_image(image, mask, height, width, return_image: bool
153
153
  return mask, masked_image
154
154
 
155
155
 
156
- class StableDiffusionInpaintPipeline(DiffusionPipeline, TextualInversionLoaderMixin, LoraLoaderMixin):
156
+ class StableDiffusionInpaintPipeline(
157
+ DiffusionPipeline, TextualInversionLoaderMixin, LoraLoaderMixin, FromSingleFileMixin
158
+ ):
157
159
  r"""
158
160
  Pipeline for text-guided image inpainting using Stable Diffusion.
159
161
 
@@ -748,15 +748,19 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
748
748
  # make sure the VAE is in float32 mode, as it overflows in float16
749
749
  self.vae.to(dtype=torch.float32)
750
750
 
751
- use_torch_2_0_or_xformers = self.vae.decoder.mid_block.attentions[0].processor in [
752
- AttnProcessor2_0,
753
- XFormersAttnProcessor,
754
- LoRAXFormersAttnProcessor,
755
- LoRAAttnProcessor2_0,
756
- ]
751
+ use_torch_2_0_or_xformers = isinstance(
752
+ self.vae.decoder.mid_block.attentions[0].processor,
753
+ (
754
+ AttnProcessor2_0,
755
+ XFormersAttnProcessor,
756
+ LoRAXFormersAttnProcessor,
757
+ LoRAAttnProcessor2_0,
758
+ ),
759
+ )
760
+
757
761
  # if xformers or torch_2_0 is used attention block does not need
758
762
  # to be in float32 which can save lots of memory
759
- if not use_torch_2_0_or_xformers:
763
+ if use_torch_2_0_or_xformers:
760
764
  self.vae.post_quant_conv.to(latents.dtype)
761
765
  self.vae.decoder.conv_in.to(latents.dtype)
762
766
  self.vae.decoder.mid_block.to(latents.dtype)
@@ -129,6 +129,7 @@ class StableDiffusionXLPipeline(DiffusionPipeline, FromSingleFileMixin):
129
129
  self.register_to_config(force_zeros_for_empty_prompt=force_zeros_for_empty_prompt)
130
130
  self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1)
131
131
  self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
132
+ self.default_sample_size = self.unet.config.sample_size
132
133
 
133
134
  self.watermark = StableDiffusionXLWatermarker()
134
135
 
@@ -652,8 +653,8 @@ class StableDiffusionXLPipeline(DiffusionPipeline, FromSingleFileMixin):
652
653
  "not-safe-for-work" (nsfw) content, according to the `safety_checker`.
653
654
  """
654
655
  # 0. Default height and width to unet
655
- height = height or self.unet.config.sample_size * self.vae_scale_factor
656
- width = width or self.unet.config.sample_size * self.vae_scale_factor
656
+ height = height or self.default_sample_size * self.vae_scale_factor
657
+ width = width or self.default_sample_size * self.vae_scale_factor
657
658
 
658
659
  original_size = original_size or (height, width)
659
660
  target_size = target_size or (height, width)
@@ -785,15 +786,18 @@ class StableDiffusionXLPipeline(DiffusionPipeline, FromSingleFileMixin):
785
786
  # make sure the VAE is in float32 mode, as it overflows in float16
786
787
  self.vae.to(dtype=torch.float32)
787
788
 
788
- use_torch_2_0_or_xformers = self.vae.decoder.mid_block.attentions[0].processor in [
789
- AttnProcessor2_0,
790
- XFormersAttnProcessor,
791
- LoRAXFormersAttnProcessor,
792
- LoRAAttnProcessor2_0,
793
- ]
789
+ use_torch_2_0_or_xformers = isinstance(
790
+ self.vae.decoder.mid_block.attentions[0].processor,
791
+ (
792
+ AttnProcessor2_0,
793
+ XFormersAttnProcessor,
794
+ LoRAXFormersAttnProcessor,
795
+ LoRAAttnProcessor2_0,
796
+ ),
797
+ )
794
798
  # if xformers or torch_2_0 is used attention block does not need
795
799
  # to be in float32 which can save lots of memory
796
- if not use_torch_2_0_or_xformers:
800
+ if use_torch_2_0_or_xformers:
797
801
  self.vae.post_quant_conv.to(latents.dtype)
798
802
  self.vae.decoder.conv_in.to(latents.dtype)
799
803
  self.vae.decoder.mid_block.to(latents.dtype)
@@ -859,15 +859,18 @@ class StableDiffusionXLImg2ImgPipeline(DiffusionPipeline, FromSingleFileMixin):
859
859
  # make sure the VAE is in float32 mode, as it overflows in float16
860
860
  self.vae.to(dtype=torch.float32)
861
861
 
862
- use_torch_2_0_or_xformers = self.vae.decoder.mid_block.attentions[0].processor in [
863
- AttnProcessor2_0,
864
- XFormersAttnProcessor,
865
- LoRAXFormersAttnProcessor,
866
- LoRAAttnProcessor2_0,
867
- ]
862
+ use_torch_2_0_or_xformers = isinstance(
863
+ self.vae.decoder.mid_block.attentions[0].processor,
864
+ (
865
+ AttnProcessor2_0,
866
+ XFormersAttnProcessor,
867
+ LoRAXFormersAttnProcessor,
868
+ LoRAAttnProcessor2_0,
869
+ ),
870
+ )
868
871
  # if xformers or torch_2_0 is used attention block does not need
869
872
  # to be in float32 which can save lots of memory
870
- if not use_torch_2_0_or_xformers:
873
+ if use_torch_2_0_or_xformers:
871
874
  self.vae.post_quant_conv.to(latents.dtype)
872
875
  self.vae.decoder.conv_in.to(latents.dtype)
873
876
  self.vae.decoder.mid_block.to(latents.dtype)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffusers
3
- Version: 0.18.1
3
+ Version: 0.18.2
4
4
  Summary: Diffusers
5
5
  Home-page: https://github.com/huggingface/diffusers
6
6
  Author: The HuggingFace team
File without changes
File without changes
File without changes
File without changes
File without changes