diffusers 0.23.1__py3-none-any.whl → 0.24.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- diffusers/__init__.py +16 -2
- diffusers/configuration_utils.py +1 -0
- diffusers/dependency_versions_check.py +0 -1
- diffusers/dependency_versions_table.py +4 -5
- diffusers/image_processor.py +186 -14
- diffusers/loaders/__init__.py +82 -0
- diffusers/loaders/ip_adapter.py +157 -0
- diffusers/loaders/lora.py +1415 -0
- diffusers/loaders/lora_conversion_utils.py +284 -0
- diffusers/loaders/single_file.py +631 -0
- diffusers/loaders/textual_inversion.py +459 -0
- diffusers/loaders/unet.py +735 -0
- diffusers/loaders/utils.py +59 -0
- diffusers/models/__init__.py +12 -1
- diffusers/models/attention.py +165 -14
- diffusers/models/attention_flax.py +9 -1
- diffusers/models/attention_processor.py +286 -1
- diffusers/models/autoencoder_asym_kl.py +14 -9
- diffusers/models/autoencoder_kl.py +3 -18
- diffusers/models/autoencoder_kl_temporal_decoder.py +402 -0
- diffusers/models/autoencoder_tiny.py +20 -24
- diffusers/models/consistency_decoder_vae.py +37 -30
- diffusers/models/controlnet.py +59 -39
- diffusers/models/controlnet_flax.py +19 -18
- diffusers/models/embeddings_flax.py +2 -0
- diffusers/models/lora.py +131 -1
- diffusers/models/modeling_flax_utils.py +2 -1
- diffusers/models/modeling_outputs.py +17 -0
- diffusers/models/modeling_utils.py +27 -19
- diffusers/models/normalization.py +2 -2
- diffusers/models/resnet.py +390 -59
- diffusers/models/transformer_2d.py +20 -3
- diffusers/models/transformer_temporal.py +183 -1
- diffusers/models/unet_2d_blocks_flax.py +5 -0
- diffusers/models/unet_2d_condition.py +9 -0
- diffusers/models/unet_2d_condition_flax.py +13 -13
- diffusers/models/unet_3d_blocks.py +957 -173
- diffusers/models/unet_3d_condition.py +16 -8
- diffusers/models/unet_kandi3.py +589 -0
- diffusers/models/unet_motion_model.py +48 -33
- diffusers/models/unet_spatio_temporal_condition.py +489 -0
- diffusers/models/vae.py +63 -13
- diffusers/models/vae_flax.py +7 -0
- diffusers/models/vq_model.py +3 -1
- diffusers/optimization.py +16 -9
- diffusers/pipelines/__init__.py +65 -12
- diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py +93 -23
- diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py +97 -25
- diffusers/pipelines/animatediff/pipeline_animatediff.py +34 -4
- diffusers/pipelines/audioldm/pipeline_audioldm.py +1 -0
- diffusers/pipelines/auto_pipeline.py +6 -0
- diffusers/pipelines/consistency_models/pipeline_consistency_models.py +1 -0
- diffusers/pipelines/controlnet/pipeline_controlnet.py +217 -31
- diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +101 -32
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +136 -39
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py +119 -37
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +196 -35
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +102 -31
- diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py +1 -0
- diffusers/pipelines/ddim/pipeline_ddim.py +1 -0
- diffusers/pipelines/ddpm/pipeline_ddpm.py +1 -0
- diffusers/pipelines/deepfloyd_if/pipeline_if.py +13 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py +13 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py +13 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py +13 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py +13 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py +13 -1
- diffusers/pipelines/dit/pipeline_dit.py +1 -0
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py +1 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py +3 -3
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py +1 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py +1 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py +1 -1
- diffusers/pipelines/kandinsky3/__init__.py +49 -0
- diffusers/pipelines/kandinsky3/kandinsky3_pipeline.py +452 -0
- diffusers/pipelines/kandinsky3/kandinsky3img2img_pipeline.py +460 -0
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +65 -6
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +55 -3
- diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py +1 -0
- diffusers/pipelines/musicldm/pipeline_musicldm.py +1 -1
- diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py +7 -2
- diffusers/pipelines/pipeline_flax_utils.py +4 -2
- diffusers/pipelines/pipeline_utils.py +33 -13
- diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +196 -36
- diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py +1 -0
- diffusers/pipelines/spectrogram_diffusion/pipeline_spectrogram_diffusion.py +1 -0
- diffusers/pipelines/stable_diffusion/__init__.py +64 -21
- diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +8 -3
- diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py +18 -2
- diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +2 -2
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py +2 -4
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint_legacy.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +88 -9
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_attend_and_excite.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +8 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_gligen.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_gligen_text_image.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +92 -9
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +92 -9
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +17 -13
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_k_diffusion.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_model_editing.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_paradigms.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_sag.py +1 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +1 -0
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +103 -8
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +113 -8
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +115 -9
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py +16 -12
- diffusers/pipelines/stable_video_diffusion/__init__.py +58 -0
- diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py +649 -0
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py +108 -12
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_xl_adapter.py +109 -14
- diffusers/pipelines/text_to_video_synthesis/__init__.py +2 -0
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +1 -0
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +18 -3
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +4 -2
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero_sdxl.py +872 -0
- diffusers/pipelines/versatile_diffusion/modeling_text_unet.py +29 -40
- diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py +1 -0
- diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py +1 -0
- diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py +1 -0
- diffusers/pipelines/wuerstchen/modeling_wuerstchen_common.py +14 -4
- diffusers/pipelines/wuerstchen/modeling_wuerstchen_prior.py +9 -5
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen.py +1 -1
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_combined.py +2 -2
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_prior.py +1 -1
- diffusers/schedulers/__init__.py +2 -4
- diffusers/schedulers/deprecated/__init__.py +50 -0
- diffusers/schedulers/{scheduling_karras_ve.py → deprecated/scheduling_karras_ve.py} +4 -4
- diffusers/schedulers/{scheduling_sde_vp.py → deprecated/scheduling_sde_vp.py} +4 -6
- diffusers/schedulers/scheduling_ddim.py +1 -3
- diffusers/schedulers/scheduling_ddim_inverse.py +1 -3
- diffusers/schedulers/scheduling_ddim_parallel.py +1 -3
- diffusers/schedulers/scheduling_ddpm.py +1 -3
- diffusers/schedulers/scheduling_ddpm_parallel.py +1 -3
- diffusers/schedulers/scheduling_deis_multistep.py +15 -5
- diffusers/schedulers/scheduling_dpmsolver_multistep.py +15 -5
- diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py +15 -5
- diffusers/schedulers/scheduling_dpmsolver_sde.py +1 -3
- diffusers/schedulers/scheduling_dpmsolver_singlestep.py +15 -5
- diffusers/schedulers/scheduling_euler_ancestral_discrete.py +1 -3
- diffusers/schedulers/scheduling_euler_discrete.py +40 -13
- diffusers/schedulers/scheduling_heun_discrete.py +15 -5
- diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py +15 -5
- diffusers/schedulers/scheduling_k_dpm_2_discrete.py +15 -5
- diffusers/schedulers/scheduling_lcm.py +123 -29
- diffusers/schedulers/scheduling_lms_discrete.py +1 -3
- diffusers/schedulers/scheduling_pndm.py +1 -3
- diffusers/schedulers/scheduling_repaint.py +1 -3
- diffusers/schedulers/scheduling_unipc_multistep.py +15 -5
- diffusers/utils/__init__.py +1 -0
- diffusers/utils/constants.py +8 -7
- diffusers/utils/dummy_pt_objects.py +45 -0
- diffusers/utils/dummy_torch_and_transformers_objects.py +60 -0
- diffusers/utils/dynamic_modules_utils.py +4 -4
- diffusers/utils/export_utils.py +8 -3
- diffusers/utils/logging.py +10 -10
- diffusers/utils/outputs.py +5 -5
- diffusers/utils/peft_utils.py +88 -44
- diffusers/utils/torch_utils.py +2 -2
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/METADATA +38 -22
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/RECORD +175 -157
- diffusers/loaders.py +0 -3336
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/LICENSE +0 -0
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/WHEEL +0 -0
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/entry_points.txt +0 -0
- {diffusers-0.23.1.dist-info → diffusers-0.24.0.dist-info}/top_level.txt +0 -0
@@ -55,7 +55,9 @@ try:
|
|
55
55
|
if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
|
56
56
|
raise OptionalDependencyNotAvailable()
|
57
57
|
except OptionalDependencyNotAvailable:
|
58
|
-
from ...utils.dummy_torch_and_transformers_objects import
|
58
|
+
from ...utils.dummy_torch_and_transformers_objects import (
|
59
|
+
StableDiffusionImageVariationPipeline,
|
60
|
+
)
|
59
61
|
|
60
62
|
_dummy_objects.update({"StableDiffusionImageVariationPipeline": StableDiffusionImageVariationPipeline})
|
61
63
|
else:
|
@@ -90,7 +92,9 @@ try:
|
|
90
92
|
):
|
91
93
|
raise OptionalDependencyNotAvailable()
|
92
94
|
except OptionalDependencyNotAvailable:
|
93
|
-
from ...utils import
|
95
|
+
from ...utils import (
|
96
|
+
dummy_torch_and_transformers_and_k_diffusion_objects,
|
97
|
+
)
|
94
98
|
|
95
99
|
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_k_diffusion_objects))
|
96
100
|
else:
|
@@ -137,18 +141,32 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
137
141
|
StableDiffusionPipelineOutput,
|
138
142
|
StableDiffusionSafetyChecker,
|
139
143
|
)
|
140
|
-
from .pipeline_stable_diffusion_attend_and_excite import
|
144
|
+
from .pipeline_stable_diffusion_attend_and_excite import (
|
145
|
+
StableDiffusionAttendAndExcitePipeline,
|
146
|
+
)
|
141
147
|
from .pipeline_stable_diffusion_gligen import StableDiffusionGLIGENPipeline
|
142
|
-
from .pipeline_stable_diffusion_gligen_text_image import
|
148
|
+
from .pipeline_stable_diffusion_gligen_text_image import (
|
149
|
+
StableDiffusionGLIGENTextImagePipeline,
|
150
|
+
)
|
143
151
|
from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline
|
144
152
|
from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline
|
145
|
-
from .pipeline_stable_diffusion_inpaint_legacy import
|
146
|
-
|
147
|
-
|
153
|
+
from .pipeline_stable_diffusion_inpaint_legacy import (
|
154
|
+
StableDiffusionInpaintPipelineLegacy,
|
155
|
+
)
|
156
|
+
from .pipeline_stable_diffusion_instruct_pix2pix import (
|
157
|
+
StableDiffusionInstructPix2PixPipeline,
|
158
|
+
)
|
159
|
+
from .pipeline_stable_diffusion_latent_upscale import (
|
160
|
+
StableDiffusionLatentUpscalePipeline,
|
161
|
+
)
|
148
162
|
from .pipeline_stable_diffusion_ldm3d import StableDiffusionLDM3DPipeline
|
149
|
-
from .pipeline_stable_diffusion_model_editing import
|
163
|
+
from .pipeline_stable_diffusion_model_editing import (
|
164
|
+
StableDiffusionModelEditingPipeline,
|
165
|
+
)
|
150
166
|
from .pipeline_stable_diffusion_panorama import StableDiffusionPanoramaPipeline
|
151
|
-
from .pipeline_stable_diffusion_paradigms import
|
167
|
+
from .pipeline_stable_diffusion_paradigms import (
|
168
|
+
StableDiffusionParadigmsPipeline,
|
169
|
+
)
|
152
170
|
from .pipeline_stable_diffusion_sag import StableDiffusionSAGPipeline
|
153
171
|
from .pipeline_stable_diffusion_upscale import StableDiffusionUpscalePipeline
|
154
172
|
from .pipeline_stable_unclip import StableUnCLIPPipeline
|
@@ -160,9 +178,13 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
160
178
|
if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
|
161
179
|
raise OptionalDependencyNotAvailable()
|
162
180
|
except OptionalDependencyNotAvailable:
|
163
|
-
from ...utils.dummy_torch_and_transformers_objects import
|
181
|
+
from ...utils.dummy_torch_and_transformers_objects import (
|
182
|
+
StableDiffusionImageVariationPipeline,
|
183
|
+
)
|
164
184
|
else:
|
165
|
-
from .pipeline_stable_diffusion_image_variation import
|
185
|
+
from .pipeline_stable_diffusion_image_variation import (
|
186
|
+
StableDiffusionImageVariationPipeline,
|
187
|
+
)
|
166
188
|
|
167
189
|
try:
|
168
190
|
if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.26.0")):
|
@@ -174,9 +196,13 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
174
196
|
StableDiffusionPix2PixZeroPipeline,
|
175
197
|
)
|
176
198
|
else:
|
177
|
-
from .pipeline_stable_diffusion_depth2img import
|
199
|
+
from .pipeline_stable_diffusion_depth2img import (
|
200
|
+
StableDiffusionDepth2ImgPipeline,
|
201
|
+
)
|
178
202
|
from .pipeline_stable_diffusion_diffedit import StableDiffusionDiffEditPipeline
|
179
|
-
from .pipeline_stable_diffusion_pix2pix_zero import
|
203
|
+
from .pipeline_stable_diffusion_pix2pix_zero import (
|
204
|
+
StableDiffusionPix2PixZeroPipeline,
|
205
|
+
)
|
180
206
|
|
181
207
|
try:
|
182
208
|
if not (
|
@@ -189,7 +215,9 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
189
215
|
except OptionalDependencyNotAvailable:
|
190
216
|
from ...utils.dummy_torch_and_transformers_and_k_diffusion_objects import *
|
191
217
|
else:
|
192
|
-
from .pipeline_stable_diffusion_k_diffusion import
|
218
|
+
from .pipeline_stable_diffusion_k_diffusion import (
|
219
|
+
StableDiffusionKDiffusionPipeline,
|
220
|
+
)
|
193
221
|
|
194
222
|
try:
|
195
223
|
if not (is_transformers_available() and is_onnx_available()):
|
@@ -197,11 +225,22 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
197
225
|
except OptionalDependencyNotAvailable:
|
198
226
|
from ...utils.dummy_onnx_objects import *
|
199
227
|
else:
|
200
|
-
from .pipeline_onnx_stable_diffusion import
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
from .
|
228
|
+
from .pipeline_onnx_stable_diffusion import (
|
229
|
+
OnnxStableDiffusionPipeline,
|
230
|
+
StableDiffusionOnnxPipeline,
|
231
|
+
)
|
232
|
+
from .pipeline_onnx_stable_diffusion_img2img import (
|
233
|
+
OnnxStableDiffusionImg2ImgPipeline,
|
234
|
+
)
|
235
|
+
from .pipeline_onnx_stable_diffusion_inpaint import (
|
236
|
+
OnnxStableDiffusionInpaintPipeline,
|
237
|
+
)
|
238
|
+
from .pipeline_onnx_stable_diffusion_inpaint_legacy import (
|
239
|
+
OnnxStableDiffusionInpaintPipelineLegacy,
|
240
|
+
)
|
241
|
+
from .pipeline_onnx_stable_diffusion_upscale import (
|
242
|
+
OnnxStableDiffusionUpscalePipeline,
|
243
|
+
)
|
205
244
|
|
206
245
|
try:
|
207
246
|
if not (is_transformers_available() and is_flax_available()):
|
@@ -210,8 +249,12 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
210
249
|
from ...utils.dummy_flax_objects import *
|
211
250
|
else:
|
212
251
|
from .pipeline_flax_stable_diffusion import FlaxStableDiffusionPipeline
|
213
|
-
from .pipeline_flax_stable_diffusion_img2img import
|
214
|
-
|
252
|
+
from .pipeline_flax_stable_diffusion_img2img import (
|
253
|
+
FlaxStableDiffusionImg2ImgPipeline,
|
254
|
+
)
|
255
|
+
from .pipeline_flax_stable_diffusion_inpaint import (
|
256
|
+
FlaxStableDiffusionInpaintPipeline,
|
257
|
+
)
|
215
258
|
from .pipeline_output import FlaxStableDiffusionPipelineOutput
|
216
259
|
from .safety_checker_flax import FlaxStableDiffusionSafetyChecker
|
217
260
|
|
@@ -1232,13 +1232,11 @@ def download_from_original_stable_diffusion_ckpt(
|
|
1232
1232
|
StableDiffusionPipeline,
|
1233
1233
|
StableDiffusionUpscalePipeline,
|
1234
1234
|
StableDiffusionXLImg2ImgPipeline,
|
1235
|
+
StableDiffusionXLPipeline,
|
1235
1236
|
StableUnCLIPImg2ImgPipeline,
|
1236
1237
|
StableUnCLIPPipeline,
|
1237
1238
|
)
|
1238
1239
|
|
1239
|
-
if pipeline_class is None:
|
1240
|
-
pipeline_class = StableDiffusionPipeline if not controlnet else StableDiffusionControlNetPipeline
|
1241
|
-
|
1242
1240
|
if prediction_type == "v-prediction":
|
1243
1241
|
prediction_type = "v_prediction"
|
1244
1242
|
|
@@ -1333,6 +1331,13 @@ def download_from_original_stable_diffusion_ckpt(
|
|
1333
1331
|
if image_size is None:
|
1334
1332
|
image_size = 1024
|
1335
1333
|
|
1334
|
+
if pipeline_class is None:
|
1335
|
+
# Check if we have a SDXL or SD model and initialize default pipeline
|
1336
|
+
if model_type not in ["SDXL", "SDXL-Refiner"]:
|
1337
|
+
pipeline_class = StableDiffusionPipeline if not controlnet else StableDiffusionControlNetPipeline
|
1338
|
+
else:
|
1339
|
+
pipeline_class = StableDiffusionXLPipeline if model_type == "SDXL" else StableDiffusionXLImg2ImgPipeline
|
1340
|
+
|
1336
1341
|
if num_in_channels is None and pipeline_class == StableDiffusionInpaintPipeline:
|
1337
1342
|
num_in_channels = 9
|
1338
1343
|
if num_in_channels is None and pipeline_class == StableDiffusionUpscalePipeline:
|
@@ -61,6 +61,20 @@ def preprocess(image):
|
|
61
61
|
return image
|
62
62
|
|
63
63
|
|
64
|
+
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.retrieve_latents
|
65
|
+
def retrieve_latents(
|
66
|
+
encoder_output: torch.Tensor, generator: Optional[torch.Generator] = None, sample_mode: str = "sample"
|
67
|
+
):
|
68
|
+
if hasattr(encoder_output, "latent_dist") and sample_mode == "sample":
|
69
|
+
return encoder_output.latent_dist.sample(generator)
|
70
|
+
elif hasattr(encoder_output, "latent_dist") and sample_mode == "argmax":
|
71
|
+
return encoder_output.latent_dist.mode()
|
72
|
+
elif hasattr(encoder_output, "latents"):
|
73
|
+
return encoder_output.latents
|
74
|
+
else:
|
75
|
+
raise AttributeError("Could not access latents of provided encoder_output")
|
76
|
+
|
77
|
+
|
64
78
|
def posterior_sample(scheduler, latents, timestep, clean_latents, generator, eta):
|
65
79
|
# 1. get previous step value (=t-1)
|
66
80
|
prev_timestep = timestep - scheduler.config.num_train_timesteps // scheduler.num_inference_steps
|
@@ -148,6 +162,7 @@ class CycleDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lor
|
|
148
162
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
149
163
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
150
164
|
"""
|
165
|
+
|
151
166
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
152
167
|
_optional_components = ["safety_checker", "feature_extractor"]
|
153
168
|
|
@@ -566,11 +581,12 @@ class CycleDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lor
|
|
566
581
|
|
567
582
|
if isinstance(generator, list):
|
568
583
|
init_latents = [
|
569
|
-
self.vae.encode(image[i : i + 1])
|
584
|
+
retrieve_latents(self.vae.encode(image[i : i + 1]), generator=generator[i])
|
585
|
+
for i in range(image.shape[0])
|
570
586
|
]
|
571
587
|
init_latents = torch.cat(init_latents, dim=0)
|
572
588
|
else:
|
573
|
-
init_latents = self.vae.encode(image)
|
589
|
+
init_latents = retrieve_latents(self.vae.encode(image), generator=generator)
|
574
590
|
|
575
591
|
init_latents = self.vae.config.scaling_factor * init_latents
|
576
592
|
|
@@ -410,13 +410,13 @@ class FlaxStableDiffusionPipeline(FlaxDiffusionPipeline):
|
|
410
410
|
|
411
411
|
images_uint8_casted = np.asarray(images_uint8_casted).reshape(num_devices * batch_size, height, width, 3)
|
412
412
|
images_uint8_casted, has_nsfw_concept = self._run_safety_checker(images_uint8_casted, safety_params, jit)
|
413
|
-
images = np.asarray(images)
|
413
|
+
images = np.asarray(images).copy()
|
414
414
|
|
415
415
|
# block images
|
416
416
|
if any(has_nsfw_concept):
|
417
417
|
for i, is_nsfw in enumerate(has_nsfw_concept):
|
418
418
|
if is_nsfw:
|
419
|
-
images[i] = np.asarray(images_uint8_casted[i])
|
419
|
+
images[i, 0] = np.asarray(images_uint8_casted[i])
|
420
420
|
|
421
421
|
images = images.reshape(num_devices, batch_size, height, width, 3)
|
422
422
|
else:
|
@@ -33,10 +33,7 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
|
33
33
|
|
34
34
|
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess with 8->64
|
35
35
|
def preprocess(image):
|
36
|
-
deprecation_message = (
|
37
|
-
"The preprocess method is deprecated and will be removed in diffusers 1.0.0. Please use"
|
38
|
-
" VaeImageProcessor.preprocess(...) instead"
|
39
|
-
)
|
36
|
+
deprecation_message = "The preprocess method is deprecated and will be removed in diffusers 1.0.0. Please use VaeImageProcessor.preprocess(...) instead"
|
40
37
|
deprecate("preprocess", "1.0.0", deprecation_message, standard_warn=False)
|
41
38
|
if isinstance(image, torch.Tensor):
|
42
39
|
return image
|
@@ -85,6 +82,7 @@ class OnnxStableDiffusionImg2ImgPipeline(DiffusionPipeline):
|
|
85
82
|
feature_extractor ([`CLIPImageProcessor`]):
|
86
83
|
Model that extracts features from generated images to be used as inputs for the `safety_checker`.
|
87
84
|
"""
|
85
|
+
|
88
86
|
vae_encoder: OnnxRuntimeModel
|
89
87
|
vae_decoder: OnnxRuntimeModel
|
90
88
|
text_encoder: OnnxRuntimeModel
|
@@ -80,6 +80,7 @@ class OnnxStableDiffusionInpaintPipeline(DiffusionPipeline):
|
|
80
80
|
feature_extractor ([`CLIPImageProcessor`]):
|
81
81
|
Model that extracts features from generated images to be used as inputs for the `safety_checker`.
|
82
82
|
"""
|
83
|
+
|
83
84
|
vae_encoder: OnnxRuntimeModel
|
84
85
|
vae_decoder: OnnxRuntimeModel
|
85
86
|
text_encoder: OnnxRuntimeModel
|
@@ -66,6 +66,7 @@ class OnnxStableDiffusionInpaintPipelineLegacy(DiffusionPipeline):
|
|
66
66
|
feature_extractor ([`CLIPImageProcessor`]):
|
67
67
|
Model that extracts features from generated images to be used as inputs for the `safety_checker`.
|
68
68
|
"""
|
69
|
+
|
69
70
|
_optional_components = ["safety_checker", "feature_extractor"]
|
70
71
|
_is_onnx = True
|
71
72
|
|
@@ -17,11 +17,11 @@ from typing import Any, Callable, Dict, List, Optional, Union
|
|
17
17
|
|
18
18
|
import torch
|
19
19
|
from packaging import version
|
20
|
-
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
|
20
|
+
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection
|
21
21
|
|
22
22
|
from ...configuration_utils import FrozenDict
|
23
|
-
from ...image_processor import VaeImageProcessor
|
24
|
-
from ...loaders import FromSingleFileMixin, LoraLoaderMixin, TextualInversionLoaderMixin
|
23
|
+
from ...image_processor import PipelineImageInput, VaeImageProcessor
|
24
|
+
from ...loaders import FromSingleFileMixin, IPAdapterMixin, LoraLoaderMixin, TextualInversionLoaderMixin
|
25
25
|
from ...models import AutoencoderKL, UNet2DConditionModel
|
26
26
|
from ...models.lora import adjust_lora_scale_text_encoder
|
27
27
|
from ...schedulers import KarrasDiffusionSchedulers
|
@@ -70,7 +70,53 @@ def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
|
|
70
70
|
return noise_cfg
|
71
71
|
|
72
72
|
|
73
|
-
|
73
|
+
def retrieve_timesteps(
|
74
|
+
scheduler,
|
75
|
+
num_inference_steps: Optional[int] = None,
|
76
|
+
device: Optional[Union[str, torch.device]] = None,
|
77
|
+
timesteps: Optional[List[int]] = None,
|
78
|
+
**kwargs,
|
79
|
+
):
|
80
|
+
"""
|
81
|
+
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
|
82
|
+
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
|
83
|
+
|
84
|
+
Args:
|
85
|
+
scheduler (`SchedulerMixin`):
|
86
|
+
The scheduler to get timesteps from.
|
87
|
+
num_inference_steps (`int`):
|
88
|
+
The number of diffusion steps used when generating samples with a pre-trained model. If used,
|
89
|
+
`timesteps` must be `None`.
|
90
|
+
device (`str` or `torch.device`, *optional*):
|
91
|
+
The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
|
92
|
+
timesteps (`List[int]`, *optional*):
|
93
|
+
Custom timesteps used to support arbitrary spacing between timesteps. If `None`, then the default
|
94
|
+
timestep spacing strategy of the scheduler is used. If `timesteps` is passed, `num_inference_steps`
|
95
|
+
must be `None`.
|
96
|
+
|
97
|
+
Returns:
|
98
|
+
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
|
99
|
+
second element is the number of inference steps.
|
100
|
+
"""
|
101
|
+
if timesteps is not None:
|
102
|
+
accepts_timesteps = "timesteps" in set(inspect.signature(scheduler.set_timesteps).parameters.keys())
|
103
|
+
if not accepts_timesteps:
|
104
|
+
raise ValueError(
|
105
|
+
f"The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom"
|
106
|
+
f" timestep schedules. Please check whether you are using the correct scheduler."
|
107
|
+
)
|
108
|
+
scheduler.set_timesteps(timesteps=timesteps, device=device, **kwargs)
|
109
|
+
timesteps = scheduler.timesteps
|
110
|
+
num_inference_steps = len(timesteps)
|
111
|
+
else:
|
112
|
+
scheduler.set_timesteps(num_inference_steps, device=device, **kwargs)
|
113
|
+
timesteps = scheduler.timesteps
|
114
|
+
return timesteps, num_inference_steps
|
115
|
+
|
116
|
+
|
117
|
+
class StableDiffusionPipeline(
|
118
|
+
DiffusionPipeline, TextualInversionLoaderMixin, LoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin
|
119
|
+
):
|
74
120
|
r"""
|
75
121
|
Pipeline for text-to-image generation using Stable Diffusion.
|
76
122
|
|
@@ -82,6 +128,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
82
128
|
- [`~loaders.LoraLoaderMixin.load_lora_weights`] for loading LoRA weights
|
83
129
|
- [`~loaders.LoraLoaderMixin.save_lora_weights`] for saving LoRA weights
|
84
130
|
- [`~loaders.FromSingleFileMixin.from_single_file`] for loading `.ckpt` files
|
131
|
+
- [`~loaders.IPAdapterMixin.load_ip_adapter`] for loading IP Adapters
|
85
132
|
|
86
133
|
Args:
|
87
134
|
vae ([`AutoencoderKL`]):
|
@@ -102,8 +149,9 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
102
149
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
103
150
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
104
151
|
"""
|
152
|
+
|
105
153
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
106
|
-
_optional_components = ["safety_checker", "feature_extractor"]
|
154
|
+
_optional_components = ["safety_checker", "feature_extractor", "image_encoder"]
|
107
155
|
_exclude_from_cpu_offload = ["safety_checker"]
|
108
156
|
_callback_tensor_inputs = ["latents", "prompt_embeds", "negative_prompt_embeds"]
|
109
157
|
|
@@ -116,6 +164,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
116
164
|
scheduler: KarrasDiffusionSchedulers,
|
117
165
|
safety_checker: StableDiffusionSafetyChecker,
|
118
166
|
feature_extractor: CLIPImageProcessor,
|
167
|
+
image_encoder: CLIPVisionModelWithProjection = None,
|
119
168
|
requires_safety_checker: bool = True,
|
120
169
|
):
|
121
170
|
super().__init__()
|
@@ -192,6 +241,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
192
241
|
scheduler=scheduler,
|
193
242
|
safety_checker=safety_checker,
|
194
243
|
feature_extractor=feature_extractor,
|
244
|
+
image_encoder=image_encoder,
|
195
245
|
)
|
196
246
|
self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1)
|
197
247
|
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
|
@@ -439,6 +489,19 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
439
489
|
|
440
490
|
return prompt_embeds, negative_prompt_embeds
|
441
491
|
|
492
|
+
def encode_image(self, image, device, num_images_per_prompt):
|
493
|
+
dtype = next(self.image_encoder.parameters()).dtype
|
494
|
+
|
495
|
+
if not isinstance(image, torch.Tensor):
|
496
|
+
image = self.feature_extractor(image, return_tensors="pt").pixel_values
|
497
|
+
|
498
|
+
image = image.to(device=device, dtype=dtype)
|
499
|
+
image_embeds = self.image_encoder(image).image_embeds
|
500
|
+
image_embeds = image_embeds.repeat_interleave(num_images_per_prompt, dim=0)
|
501
|
+
|
502
|
+
uncond_image_embeds = torch.zeros_like(image_embeds)
|
503
|
+
return image_embeds, uncond_image_embeds
|
504
|
+
|
442
505
|
def run_safety_checker(self, image, device, dtype):
|
443
506
|
if self.safety_checker is None:
|
444
507
|
has_nsfw_concept = None
|
@@ -640,6 +703,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
640
703
|
height: Optional[int] = None,
|
641
704
|
width: Optional[int] = None,
|
642
705
|
num_inference_steps: int = 50,
|
706
|
+
timesteps: List[int] = None,
|
643
707
|
guidance_scale: float = 7.5,
|
644
708
|
negative_prompt: Optional[Union[str, List[str]]] = None,
|
645
709
|
num_images_per_prompt: Optional[int] = 1,
|
@@ -648,6 +712,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
648
712
|
latents: Optional[torch.FloatTensor] = None,
|
649
713
|
prompt_embeds: Optional[torch.FloatTensor] = None,
|
650
714
|
negative_prompt_embeds: Optional[torch.FloatTensor] = None,
|
715
|
+
ip_adapter_image: Optional[PipelineImageInput] = None,
|
651
716
|
output_type: Optional[str] = "pil",
|
652
717
|
return_dict: bool = True,
|
653
718
|
cross_attention_kwargs: Optional[Dict[str, Any]] = None,
|
@@ -670,6 +735,10 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
670
735
|
num_inference_steps (`int`, *optional*, defaults to 50):
|
671
736
|
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
|
672
737
|
expense of slower inference.
|
738
|
+
timesteps (`List[int]`, *optional*):
|
739
|
+
Custom timesteps to use for the denoising process with schedulers which support a `timesteps` argument
|
740
|
+
in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
|
741
|
+
passed will be used. Must be in descending order.
|
673
742
|
guidance_scale (`float`, *optional*, defaults to 7.5):
|
674
743
|
A higher guidance scale value encourages the model to generate images closely linked to the text
|
675
744
|
`prompt` at the expense of lower image quality. Guidance scale is enabled when `guidance_scale > 1`.
|
@@ -694,6 +763,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
694
763
|
negative_prompt_embeds (`torch.FloatTensor`, *optional*):
|
695
764
|
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
|
696
765
|
not provided, `negative_prompt_embeds` are generated from the `negative_prompt` input argument.
|
766
|
+
ip_adapter_image: (`PipelineImageInput`, *optional*): Optional image input to work with IP Adapters.
|
697
767
|
output_type (`str`, *optional*, defaults to `"pil"`):
|
698
768
|
The output format of the generated image. Choose between `PIL.Image` or `np.array`.
|
699
769
|
return_dict (`bool`, *optional*, defaults to `True`):
|
@@ -717,7 +787,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
717
787
|
callback_on_step_end_tensor_inputs (`List`, *optional*):
|
718
788
|
The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
|
719
789
|
will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
|
720
|
-
`._callback_tensor_inputs` attribute of your
|
790
|
+
`._callback_tensor_inputs` attribute of your pipeline class.
|
721
791
|
|
722
792
|
Examples:
|
723
793
|
|
@@ -793,15 +863,20 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
793
863
|
lora_scale=lora_scale,
|
794
864
|
clip_skip=self.clip_skip,
|
795
865
|
)
|
866
|
+
|
796
867
|
# For classifier free guidance, we need to do two forward passes.
|
797
868
|
# Here we concatenate the unconditional and text embeddings into a single batch
|
798
869
|
# to avoid doing two forward passes
|
799
870
|
if self.do_classifier_free_guidance:
|
800
871
|
prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds])
|
801
872
|
|
873
|
+
if ip_adapter_image is not None:
|
874
|
+
image_embeds, negative_image_embeds = self.encode_image(ip_adapter_image, device, num_images_per_prompt)
|
875
|
+
if self.do_classifier_free_guidance:
|
876
|
+
image_embeds = torch.cat([negative_image_embeds, image_embeds])
|
877
|
+
|
802
878
|
# 4. Prepare timesteps
|
803
|
-
self.scheduler
|
804
|
-
timesteps = self.scheduler.timesteps
|
879
|
+
timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
|
805
880
|
|
806
881
|
# 5. Prepare latent variables
|
807
882
|
num_channels_latents = self.unet.config.in_channels
|
@@ -819,7 +894,10 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
819
894
|
# 6. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
|
820
895
|
extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta)
|
821
896
|
|
822
|
-
# 6.
|
897
|
+
# 6.1 Add image embeds for IP-Adapter
|
898
|
+
added_cond_kwargs = {"image_embeds": image_embeds} if ip_adapter_image is not None else None
|
899
|
+
|
900
|
+
# 6.2 Optionally get Guidance Scale Embedding
|
823
901
|
timestep_cond = None
|
824
902
|
if self.unet.config.time_cond_proj_dim is not None:
|
825
903
|
guidance_scale_tensor = torch.tensor(self.guidance_scale - 1).repeat(batch_size * num_images_per_prompt)
|
@@ -843,6 +921,7 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
|
|
843
921
|
encoder_hidden_states=prompt_embeds,
|
844
922
|
timestep_cond=timestep_cond,
|
845
923
|
cross_attention_kwargs=self.cross_attention_kwargs,
|
924
|
+
added_cond_kwargs=added_cond_kwargs,
|
846
925
|
return_dict=False,
|
847
926
|
)[0]
|
848
927
|
|
@@ -196,6 +196,7 @@ class StableDiffusionAttendAndExcitePipeline(DiffusionPipeline, TextualInversion
|
|
196
196
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
197
197
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
198
198
|
"""
|
199
|
+
|
199
200
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
200
201
|
_optional_components = ["safety_checker", "feature_extractor"]
|
201
202
|
_exclude_from_cpu_offload = ["safety_checker"]
|
@@ -37,9 +37,13 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
|
37
37
|
|
38
38
|
|
39
39
|
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.retrieve_latents
|
40
|
-
def retrieve_latents(
|
41
|
-
|
40
|
+
def retrieve_latents(
|
41
|
+
encoder_output: torch.Tensor, generator: Optional[torch.Generator] = None, sample_mode: str = "sample"
|
42
|
+
):
|
43
|
+
if hasattr(encoder_output, "latent_dist") and sample_mode == "sample":
|
42
44
|
return encoder_output.latent_dist.sample(generator)
|
45
|
+
elif hasattr(encoder_output, "latent_dist") and sample_mode == "argmax":
|
46
|
+
return encoder_output.latent_dist.mode()
|
43
47
|
elif hasattr(encoder_output, "latents"):
|
44
48
|
return encoder_output.latents
|
45
49
|
else:
|
@@ -95,6 +99,7 @@ class StableDiffusionDepth2ImgPipeline(DiffusionPipeline, TextualInversionLoader
|
|
95
99
|
A scheduler to be used in combination with `unet` to denoise the encoded image latents. Can be one of
|
96
100
|
[`DDIMScheduler`], [`LMSDiscreteScheduler`], or [`PNDMScheduler`].
|
97
101
|
"""
|
102
|
+
|
98
103
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
99
104
|
_callback_tensor_inputs = ["latents", "prompt_embeds", "negative_prompt_embeds", "depth_mask"]
|
100
105
|
|
@@ -674,7 +679,7 @@ class StableDiffusionDepth2ImgPipeline(DiffusionPipeline, TextualInversionLoader
|
|
674
679
|
callback_on_step_end_tensor_inputs (`List`, *optional*):
|
675
680
|
The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
|
676
681
|
will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
|
677
|
-
`._callback_tensor_inputs` attribute of your
|
682
|
+
`._callback_tensor_inputs` attribute of your pipeline class.
|
678
683
|
Examples:
|
679
684
|
|
680
685
|
```py
|
@@ -273,6 +273,7 @@ class StableDiffusionDiffEditPipeline(DiffusionPipeline, TextualInversionLoaderM
|
|
273
273
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
274
274
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
275
275
|
"""
|
276
|
+
|
276
277
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
277
278
|
_optional_components = ["safety_checker", "feature_extractor", "inverse_scheduler"]
|
278
279
|
_exclude_from_cpu_offload = ["safety_checker"]
|
@@ -125,6 +125,7 @@ class StableDiffusionGLIGENPipeline(DiffusionPipeline):
|
|
125
125
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
126
126
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
127
127
|
"""
|
128
|
+
|
128
129
|
_optional_components = ["safety_checker", "feature_extractor"]
|
129
130
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
130
131
|
_exclude_from_cpu_offload = ["safety_checker"]
|
@@ -177,6 +177,7 @@ class StableDiffusionGLIGENTextImagePipeline(DiffusionPipeline):
|
|
177
177
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
178
178
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
179
179
|
"""
|
180
|
+
|
180
181
|
model_cpu_offload_seq = "text_encoder->unet->vae"
|
181
182
|
_optional_components = ["safety_checker", "feature_extractor"]
|
182
183
|
_exclude_from_cpu_offload = ["safety_checker"]
|
@@ -62,6 +62,7 @@ class StableDiffusionImageVariationPipeline(DiffusionPipeline):
|
|
62
62
|
feature_extractor ([`~transformers.CLIPImageProcessor`]):
|
63
63
|
A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
|
64
64
|
"""
|
65
|
+
|
65
66
|
# TODO: feature_extractor is required to encode images (if they are in PIL format),
|
66
67
|
# we should give a descriptive message if the pipeline doesn't have one.
|
67
68
|
_optional_components = ["safety_checker"]
|