JOY-Huang commited on
Commit
f369784
1 Parent(s): 62c110b

fix diffusers

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. diffusers/__init__.py +797 -0
  2. diffusers/commands/__init__.py +27 -0
  3. diffusers/experimental/__init__.py +1 -0
  4. diffusers/experimental/rl/__init__.py +1 -0
  5. diffusers/loaders/__init__.py +88 -0
  6. diffusers/models/__init__.py +105 -0
  7. diffusers/models/autoencoders/__init__.py +5 -0
  8. diffusers/models/transformers/__init__.py +9 -0
  9. diffusers/models/unets/__init__.py +18 -0
  10. diffusers/pipelines/__init__.py +591 -0
  11. diffusers/pipelines/amused/__init__.py +62 -0
  12. diffusers/pipelines/animatediff/__init__.py +49 -0
  13. diffusers/pipelines/audioldm/__init__.py +51 -0
  14. diffusers/pipelines/audioldm2/__init__.py +50 -0
  15. diffusers/pipelines/blip_diffusion/__init__.py +20 -0
  16. diffusers/pipelines/consistency_models/__init__.py +24 -0
  17. diffusers/pipelines/controlnet/__init__.py +80 -0
  18. diffusers/pipelines/controlnet_xs/__init__.py +68 -0
  19. diffusers/pipelines/dance_diffusion/__init__.py +18 -0
  20. diffusers/pipelines/ddim/__init__.py +18 -0
  21. diffusers/pipelines/ddpm/__init__.py +22 -0
  22. diffusers/pipelines/deepfloyd_if/__init__.py +85 -0
  23. diffusers/pipelines/deprecated/__init__.py +153 -0
  24. diffusers/pipelines/deprecated/alt_diffusion/__init__.py +53 -0
  25. diffusers/pipelines/deprecated/audio_diffusion/__init__.py +23 -0
  26. diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py +18 -0
  27. diffusers/pipelines/deprecated/pndm/__init__.py +18 -0
  28. diffusers/pipelines/deprecated/repaint/__init__.py +19 -0
  29. diffusers/pipelines/deprecated/score_sde_ve/__init__.py +19 -0
  30. diffusers/pipelines/deprecated/spectrogram_diffusion/__init__.py +75 -0
  31. diffusers/pipelines/deprecated/stable_diffusion_variants/__init__.py +55 -0
  32. diffusers/pipelines/deprecated/stochastic_karras_ve/__init__.py +19 -0
  33. diffusers/pipelines/deprecated/versatile_diffusion/__init__.py +71 -0
  34. diffusers/pipelines/deprecated/vq_diffusion/__init__.py +57 -0
  35. diffusers/pipelines/dit/__init__.py +19 -0
  36. diffusers/pipelines/i2vgen_xl/__init__.py +46 -0
  37. diffusers/pipelines/kandinsky/__init__.py +66 -0
  38. diffusers/pipelines/kandinsky2_2/__init__.py +70 -0
  39. diffusers/pipelines/kandinsky3/__init__.py +49 -0
  40. diffusers/pipelines/latent_consistency_models/__init__.py +50 -0
  41. diffusers/pipelines/latent_diffusion/__init__.py +50 -0
  42. diffusers/pipelines/ledits_pp/__init__.py +55 -0
  43. diffusers/pipelines/musicldm/__init__.py +49 -0
  44. diffusers/pipelines/paint_by_example/__init__.py +55 -0
  45. diffusers/pipelines/pia/__init__.py +46 -0
  46. diffusers/pipelines/pixart_alpha/__init__.py +55 -0
  47. diffusers/pipelines/semantic_stable_diffusion/__init__.py +49 -0
  48. diffusers/pipelines/shap_e/__init__.py +71 -0
  49. diffusers/pipelines/stable_cascade/__init__.py +50 -0
  50. diffusers/pipelines/stable_diffusion/__init__.py +203 -0
diffusers/__init__.py ADDED
@@ -0,0 +1,797 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "0.28.0.dev0"
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from .utils import (
6
+ DIFFUSERS_SLOW_IMPORT,
7
+ OptionalDependencyNotAvailable,
8
+ _LazyModule,
9
+ is_flax_available,
10
+ is_k_diffusion_available,
11
+ is_librosa_available,
12
+ is_note_seq_available,
13
+ is_onnx_available,
14
+ is_scipy_available,
15
+ is_torch_available,
16
+ is_torchsde_available,
17
+ is_transformers_available,
18
+ )
19
+
20
+
21
+ # Lazy Import based on
22
+ # https://github.com/huggingface/transformers/blob/main/src/transformers/__init__.py
23
+
24
+ # When adding a new object to this init, please add it to `_import_structure`. The `_import_structure` is a dictionary submodule to list of object names,
25
+ # and is used to defer the actual importing for when the objects are requested.
26
+ # This way `import diffusers` provides the names in the namespace without actually importing anything (and especially none of the backends).
27
+
28
+ _import_structure = {
29
+ "configuration_utils": ["ConfigMixin"],
30
+ "models": [],
31
+ "pipelines": [],
32
+ "schedulers": [],
33
+ "utils": [
34
+ "OptionalDependencyNotAvailable",
35
+ "is_flax_available",
36
+ "is_inflect_available",
37
+ "is_invisible_watermark_available",
38
+ "is_k_diffusion_available",
39
+ "is_k_diffusion_version",
40
+ "is_librosa_available",
41
+ "is_note_seq_available",
42
+ "is_onnx_available",
43
+ "is_scipy_available",
44
+ "is_torch_available",
45
+ "is_torchsde_available",
46
+ "is_transformers_available",
47
+ "is_transformers_version",
48
+ "is_unidecode_available",
49
+ "logging",
50
+ ],
51
+ }
52
+
53
+ try:
54
+ if not is_onnx_available():
55
+ raise OptionalDependencyNotAvailable()
56
+ except OptionalDependencyNotAvailable:
57
+ from .utils import dummy_onnx_objects # noqa F403
58
+
59
+ _import_structure["utils.dummy_onnx_objects"] = [
60
+ name for name in dir(dummy_onnx_objects) if not name.startswith("_")
61
+ ]
62
+
63
+ else:
64
+ _import_structure["pipelines"].extend(["OnnxRuntimeModel"])
65
+
66
+ try:
67
+ if not is_torch_available():
68
+ raise OptionalDependencyNotAvailable()
69
+ except OptionalDependencyNotAvailable:
70
+ from .utils import dummy_pt_objects # noqa F403
71
+
72
+ _import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")]
73
+
74
+ else:
75
+ _import_structure["models"].extend(
76
+ [
77
+ "AsymmetricAutoencoderKL",
78
+ "AutoencoderKL",
79
+ "AutoencoderKLTemporalDecoder",
80
+ "AutoencoderTiny",
81
+ "ConsistencyDecoderVAE",
82
+ "ControlNetModel",
83
+ "ControlNetXSAdapter",
84
+ "I2VGenXLUNet",
85
+ "Kandinsky3UNet",
86
+ "ModelMixin",
87
+ "MotionAdapter",
88
+ "MultiAdapter",
89
+ "PriorTransformer",
90
+ "StableCascadeUNet",
91
+ "T2IAdapter",
92
+ "T5FilmDecoder",
93
+ "Transformer2DModel",
94
+ "UNet1DModel",
95
+ "UNet2DConditionModel",
96
+ "UNet2DModel",
97
+ "UNet3DConditionModel",
98
+ "UNetControlNetXSModel",
99
+ "UNetMotionModel",
100
+ "UNetSpatioTemporalConditionModel",
101
+ "UVit2DModel",
102
+ "VQModel",
103
+ ]
104
+ )
105
+
106
+ _import_structure["optimization"] = [
107
+ "get_constant_schedule",
108
+ "get_constant_schedule_with_warmup",
109
+ "get_cosine_schedule_with_warmup",
110
+ "get_cosine_with_hard_restarts_schedule_with_warmup",
111
+ "get_linear_schedule_with_warmup",
112
+ "get_polynomial_decay_schedule_with_warmup",
113
+ "get_scheduler",
114
+ ]
115
+ _import_structure["pipelines"].extend(
116
+ [
117
+ "AudioPipelineOutput",
118
+ "AutoPipelineForImage2Image",
119
+ "AutoPipelineForInpainting",
120
+ "AutoPipelineForText2Image",
121
+ "ConsistencyModelPipeline",
122
+ "DanceDiffusionPipeline",
123
+ "DDIMPipeline",
124
+ "DDPMPipeline",
125
+ "DiffusionPipeline",
126
+ "DiTPipeline",
127
+ "ImagePipelineOutput",
128
+ "KarrasVePipeline",
129
+ "LDMPipeline",
130
+ "LDMSuperResolutionPipeline",
131
+ "PNDMPipeline",
132
+ "RePaintPipeline",
133
+ "ScoreSdeVePipeline",
134
+ "StableDiffusionMixin",
135
+ ]
136
+ )
137
+ _import_structure["schedulers"].extend(
138
+ [
139
+ "AmusedScheduler",
140
+ "CMStochasticIterativeScheduler",
141
+ "DDIMInverseScheduler",
142
+ "DDIMParallelScheduler",
143
+ "DDIMScheduler",
144
+ "DDPMParallelScheduler",
145
+ "DDPMScheduler",
146
+ "DDPMWuerstchenScheduler",
147
+ "DEISMultistepScheduler",
148
+ "DPMSolverMultistepInverseScheduler",
149
+ "DPMSolverMultistepScheduler",
150
+ "DPMSolverSinglestepScheduler",
151
+ "EDMDPMSolverMultistepScheduler",
152
+ "EDMEulerScheduler",
153
+ "EulerAncestralDiscreteScheduler",
154
+ "EulerDiscreteScheduler",
155
+ "HeunDiscreteScheduler",
156
+ "IPNDMScheduler",
157
+ "KarrasVeScheduler",
158
+ "KDPM2AncestralDiscreteScheduler",
159
+ "KDPM2DiscreteScheduler",
160
+ "LCMScheduler",
161
+ "PNDMScheduler",
162
+ "RePaintScheduler",
163
+ "SASolverScheduler",
164
+ "SchedulerMixin",
165
+ "ScoreSdeVeScheduler",
166
+ "TCDScheduler",
167
+ "UnCLIPScheduler",
168
+ "UniPCMultistepScheduler",
169
+ "VQDiffusionScheduler",
170
+ ]
171
+ )
172
+ _import_structure["training_utils"] = ["EMAModel"]
173
+
174
+ try:
175
+ if not (is_torch_available() and is_scipy_available()):
176
+ raise OptionalDependencyNotAvailable()
177
+ except OptionalDependencyNotAvailable:
178
+ from .utils import dummy_torch_and_scipy_objects # noqa F403
179
+
180
+ _import_structure["utils.dummy_torch_and_scipy_objects"] = [
181
+ name for name in dir(dummy_torch_and_scipy_objects) if not name.startswith("_")
182
+ ]
183
+
184
+ else:
185
+ _import_structure["schedulers"].extend(["LMSDiscreteScheduler"])
186
+
187
+ try:
188
+ if not (is_torch_available() and is_torchsde_available()):
189
+ raise OptionalDependencyNotAvailable()
190
+ except OptionalDependencyNotAvailable:
191
+ from .utils import dummy_torch_and_torchsde_objects # noqa F403
192
+
193
+ _import_structure["utils.dummy_torch_and_torchsde_objects"] = [
194
+ name for name in dir(dummy_torch_and_torchsde_objects) if not name.startswith("_")
195
+ ]
196
+
197
+ else:
198
+ _import_structure["schedulers"].extend(["DPMSolverSDEScheduler"])
199
+
200
+ try:
201
+ if not (is_torch_available() and is_transformers_available()):
202
+ raise OptionalDependencyNotAvailable()
203
+ except OptionalDependencyNotAvailable:
204
+ from .utils import dummy_torch_and_transformers_objects # noqa F403
205
+
206
+ _import_structure["utils.dummy_torch_and_transformers_objects"] = [
207
+ name for name in dir(dummy_torch_and_transformers_objects) if not name.startswith("_")
208
+ ]
209
+
210
+ else:
211
+ _import_structure["pipelines"].extend(
212
+ [
213
+ "AltDiffusionImg2ImgPipeline",
214
+ "AltDiffusionPipeline",
215
+ "AmusedImg2ImgPipeline",
216
+ "AmusedInpaintPipeline",
217
+ "AmusedPipeline",
218
+ "AnimateDiffPipeline",
219
+ "AnimateDiffVideoToVideoPipeline",
220
+ "AudioLDM2Pipeline",
221
+ "AudioLDM2ProjectionModel",
222
+ "AudioLDM2UNet2DConditionModel",
223
+ "AudioLDMPipeline",
224
+ "BlipDiffusionControlNetPipeline",
225
+ "BlipDiffusionPipeline",
226
+ "CLIPImageProjection",
227
+ "CycleDiffusionPipeline",
228
+ "I2VGenXLPipeline",
229
+ "IFImg2ImgPipeline",
230
+ "IFImg2ImgSuperResolutionPipeline",
231
+ "IFInpaintingPipeline",
232
+ "IFInpaintingSuperResolutionPipeline",
233
+ "IFPipeline",
234
+ "IFSuperResolutionPipeline",
235
+ "ImageTextPipelineOutput",
236
+ "Kandinsky3Img2ImgPipeline",
237
+ "Kandinsky3Pipeline",
238
+ "KandinskyCombinedPipeline",
239
+ "KandinskyImg2ImgCombinedPipeline",
240
+ "KandinskyImg2ImgPipeline",
241
+ "KandinskyInpaintCombinedPipeline",
242
+ "KandinskyInpaintPipeline",
243
+ "KandinskyPipeline",
244
+ "KandinskyPriorPipeline",
245
+ "KandinskyV22CombinedPipeline",
246
+ "KandinskyV22ControlnetImg2ImgPipeline",
247
+ "KandinskyV22ControlnetPipeline",
248
+ "KandinskyV22Img2ImgCombinedPipeline",
249
+ "KandinskyV22Img2ImgPipeline",
250
+ "KandinskyV22InpaintCombinedPipeline",
251
+ "KandinskyV22InpaintPipeline",
252
+ "KandinskyV22Pipeline",
253
+ "KandinskyV22PriorEmb2EmbPipeline",
254
+ "KandinskyV22PriorPipeline",
255
+ "LatentConsistencyModelImg2ImgPipeline",
256
+ "LatentConsistencyModelPipeline",
257
+ "LDMTextToImagePipeline",
258
+ "LEditsPPPipelineStableDiffusion",
259
+ "LEditsPPPipelineStableDiffusionXL",
260
+ "MusicLDMPipeline",
261
+ "PaintByExamplePipeline",
262
+ "PIAPipeline",
263
+ "PixArtAlphaPipeline",
264
+ "PixArtSigmaPipeline",
265
+ "SemanticStableDiffusionPipeline",
266
+ "ShapEImg2ImgPipeline",
267
+ "ShapEPipeline",
268
+ "StableCascadeCombinedPipeline",
269
+ "StableCascadeDecoderPipeline",
270
+ "StableCascadePriorPipeline",
271
+ "StableDiffusionAdapterPipeline",
272
+ "StableDiffusionAttendAndExcitePipeline",
273
+ "StableDiffusionControlNetImg2ImgPipeline",
274
+ "StableDiffusionControlNetInpaintPipeline",
275
+ "StableDiffusionControlNetPipeline",
276
+ "StableDiffusionControlNetXSPipeline",
277
+ "StableDiffusionDepth2ImgPipeline",
278
+ "StableDiffusionDiffEditPipeline",
279
+ "StableDiffusionGLIGENPipeline",
280
+ "StableDiffusionGLIGENTextImagePipeline",
281
+ "StableDiffusionImageVariationPipeline",
282
+ "StableDiffusionImg2ImgPipeline",
283
+ "StableDiffusionInpaintPipeline",
284
+ "StableDiffusionInpaintPipelineLegacy",
285
+ "StableDiffusionInstructPix2PixPipeline",
286
+ "StableDiffusionLatentUpscalePipeline",
287
+ "StableDiffusionLDM3DPipeline",
288
+ "StableDiffusionModelEditingPipeline",
289
+ "StableDiffusionPanoramaPipeline",
290
+ "StableDiffusionParadigmsPipeline",
291
+ "StableDiffusionPipeline",
292
+ "StableDiffusionPipelineSafe",
293
+ "StableDiffusionPix2PixZeroPipeline",
294
+ "StableDiffusionSAGPipeline",
295
+ "StableDiffusionUpscalePipeline",
296
+ "StableDiffusionXLAdapterPipeline",
297
+ "StableDiffusionXLControlNetImg2ImgPipeline",
298
+ "StableDiffusionXLControlNetInpaintPipeline",
299
+ "StableDiffusionXLControlNetPipeline",
300
+ "StableDiffusionXLControlNetXSPipeline",
301
+ "StableDiffusionXLImg2ImgPipeline",
302
+ "StableDiffusionXLInpaintPipeline",
303
+ "StableDiffusionXLInstructPix2PixPipeline",
304
+ "StableDiffusionXLPipeline",
305
+ "StableUnCLIPImg2ImgPipeline",
306
+ "StableUnCLIPPipeline",
307
+ "StableVideoDiffusionPipeline",
308
+ "TextToVideoSDPipeline",
309
+ "TextToVideoZeroPipeline",
310
+ "TextToVideoZeroSDXLPipeline",
311
+ "UnCLIPImageVariationPipeline",
312
+ "UnCLIPPipeline",
313
+ "UniDiffuserModel",
314
+ "UniDiffuserPipeline",
315
+ "UniDiffuserTextDecoder",
316
+ "VersatileDiffusionDualGuidedPipeline",
317
+ "VersatileDiffusionImageVariationPipeline",
318
+ "VersatileDiffusionPipeline",
319
+ "VersatileDiffusionTextToImagePipeline",
320
+ "VideoToVideoSDPipeline",
321
+ "VQDiffusionPipeline",
322
+ "WuerstchenCombinedPipeline",
323
+ "WuerstchenDecoderPipeline",
324
+ "WuerstchenPriorPipeline",
325
+ ]
326
+ )
327
+
328
+ try:
329
+ if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
330
+ raise OptionalDependencyNotAvailable()
331
+ except OptionalDependencyNotAvailable:
332
+ from .utils import dummy_torch_and_transformers_and_k_diffusion_objects # noqa F403
333
+
334
+ _import_structure["utils.dummy_torch_and_transformers_and_k_diffusion_objects"] = [
335
+ name for name in dir(dummy_torch_and_transformers_and_k_diffusion_objects) if not name.startswith("_")
336
+ ]
337
+
338
+ else:
339
+ _import_structure["pipelines"].extend(["StableDiffusionKDiffusionPipeline", "StableDiffusionXLKDiffusionPipeline"])
340
+
341
+ try:
342
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
343
+ raise OptionalDependencyNotAvailable()
344
+ except OptionalDependencyNotAvailable:
345
+ from .utils import dummy_torch_and_transformers_and_onnx_objects # noqa F403
346
+
347
+ _import_structure["utils.dummy_torch_and_transformers_and_onnx_objects"] = [
348
+ name for name in dir(dummy_torch_and_transformers_and_onnx_objects) if not name.startswith("_")
349
+ ]
350
+
351
+ else:
352
+ _import_structure["pipelines"].extend(
353
+ [
354
+ "OnnxStableDiffusionImg2ImgPipeline",
355
+ "OnnxStableDiffusionInpaintPipeline",
356
+ "OnnxStableDiffusionInpaintPipelineLegacy",
357
+ "OnnxStableDiffusionPipeline",
358
+ "OnnxStableDiffusionUpscalePipeline",
359
+ "StableDiffusionOnnxPipeline",
360
+ ]
361
+ )
362
+
363
+ try:
364
+ if not (is_torch_available() and is_librosa_available()):
365
+ raise OptionalDependencyNotAvailable()
366
+ except OptionalDependencyNotAvailable:
367
+ from .utils import dummy_torch_and_librosa_objects # noqa F403
368
+
369
+ _import_structure["utils.dummy_torch_and_librosa_objects"] = [
370
+ name for name in dir(dummy_torch_and_librosa_objects) if not name.startswith("_")
371
+ ]
372
+
373
+ else:
374
+ _import_structure["pipelines"].extend(["AudioDiffusionPipeline", "Mel"])
375
+
376
+ try:
377
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
378
+ raise OptionalDependencyNotAvailable()
379
+ except OptionalDependencyNotAvailable:
380
+ from .utils import dummy_transformers_and_torch_and_note_seq_objects # noqa F403
381
+
382
+ _import_structure["utils.dummy_transformers_and_torch_and_note_seq_objects"] = [
383
+ name for name in dir(dummy_transformers_and_torch_and_note_seq_objects) if not name.startswith("_")
384
+ ]
385
+
386
+
387
+ else:
388
+ _import_structure["pipelines"].extend(["SpectrogramDiffusionPipeline"])
389
+
390
+ try:
391
+ if not is_flax_available():
392
+ raise OptionalDependencyNotAvailable()
393
+ except OptionalDependencyNotAvailable:
394
+ from .utils import dummy_flax_objects # noqa F403
395
+
396
+ _import_structure["utils.dummy_flax_objects"] = [
397
+ name for name in dir(dummy_flax_objects) if not name.startswith("_")
398
+ ]
399
+
400
+
401
+ else:
402
+ _import_structure["models.controlnet_flax"] = ["FlaxControlNetModel"]
403
+ _import_structure["models.modeling_flax_utils"] = ["FlaxModelMixin"]
404
+ _import_structure["models.unets.unet_2d_condition_flax"] = ["FlaxUNet2DConditionModel"]
405
+ _import_structure["models.vae_flax"] = ["FlaxAutoencoderKL"]
406
+ _import_structure["pipelines"].extend(["FlaxDiffusionPipeline"])
407
+ _import_structure["schedulers"].extend(
408
+ [
409
+ "FlaxDDIMScheduler",
410
+ "FlaxDDPMScheduler",
411
+ "FlaxDPMSolverMultistepScheduler",
412
+ "FlaxEulerDiscreteScheduler",
413
+ "FlaxKarrasVeScheduler",
414
+ "FlaxLMSDiscreteScheduler",
415
+ "FlaxPNDMScheduler",
416
+ "FlaxSchedulerMixin",
417
+ "FlaxScoreSdeVeScheduler",
418
+ ]
419
+ )
420
+
421
+
422
+ try:
423
+ if not (is_flax_available() and is_transformers_available()):
424
+ raise OptionalDependencyNotAvailable()
425
+ except OptionalDependencyNotAvailable:
426
+ from .utils import dummy_flax_and_transformers_objects # noqa F403
427
+
428
+ _import_structure["utils.dummy_flax_and_transformers_objects"] = [
429
+ name for name in dir(dummy_flax_and_transformers_objects) if not name.startswith("_")
430
+ ]
431
+
432
+
433
+ else:
434
+ _import_structure["pipelines"].extend(
435
+ [
436
+ "FlaxStableDiffusionControlNetPipeline",
437
+ "FlaxStableDiffusionImg2ImgPipeline",
438
+ "FlaxStableDiffusionInpaintPipeline",
439
+ "FlaxStableDiffusionPipeline",
440
+ "FlaxStableDiffusionXLPipeline",
441
+ ]
442
+ )
443
+
444
+ try:
445
+ if not (is_note_seq_available()):
446
+ raise OptionalDependencyNotAvailable()
447
+ except OptionalDependencyNotAvailable:
448
+ from .utils import dummy_note_seq_objects # noqa F403
449
+
450
+ _import_structure["utils.dummy_note_seq_objects"] = [
451
+ name for name in dir(dummy_note_seq_objects) if not name.startswith("_")
452
+ ]
453
+
454
+
455
+ else:
456
+ _import_structure["pipelines"].extend(["MidiProcessor"])
457
+
458
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
459
+ from .configuration_utils import ConfigMixin
460
+
461
+ try:
462
+ if not is_onnx_available():
463
+ raise OptionalDependencyNotAvailable()
464
+ except OptionalDependencyNotAvailable:
465
+ from .utils.dummy_onnx_objects import * # noqa F403
466
+ else:
467
+ from .pipelines import OnnxRuntimeModel
468
+
469
+ try:
470
+ if not is_torch_available():
471
+ raise OptionalDependencyNotAvailable()
472
+ except OptionalDependencyNotAvailable:
473
+ from .utils.dummy_pt_objects import * # noqa F403
474
+ else:
475
+ from .models import (
476
+ AsymmetricAutoencoderKL,
477
+ AutoencoderKL,
478
+ AutoencoderKLTemporalDecoder,
479
+ AutoencoderTiny,
480
+ ConsistencyDecoderVAE,
481
+ ControlNetModel,
482
+ ControlNetXSAdapter,
483
+ I2VGenXLUNet,
484
+ Kandinsky3UNet,
485
+ ModelMixin,
486
+ MotionAdapter,
487
+ MultiAdapter,
488
+ PriorTransformer,
489
+ T2IAdapter,
490
+ T5FilmDecoder,
491
+ Transformer2DModel,
492
+ UNet1DModel,
493
+ UNet2DConditionModel,
494
+ UNet2DModel,
495
+ UNet3DConditionModel,
496
+ UNetControlNetXSModel,
497
+ UNetMotionModel,
498
+ UNetSpatioTemporalConditionModel,
499
+ UVit2DModel,
500
+ VQModel,
501
+ )
502
+ from .optimization import (
503
+ get_constant_schedule,
504
+ get_constant_schedule_with_warmup,
505
+ get_cosine_schedule_with_warmup,
506
+ get_cosine_with_hard_restarts_schedule_with_warmup,
507
+ get_linear_schedule_with_warmup,
508
+ get_polynomial_decay_schedule_with_warmup,
509
+ get_scheduler,
510
+ )
511
+ from .pipelines import (
512
+ AudioPipelineOutput,
513
+ AutoPipelineForImage2Image,
514
+ AutoPipelineForInpainting,
515
+ AutoPipelineForText2Image,
516
+ BlipDiffusionControlNetPipeline,
517
+ BlipDiffusionPipeline,
518
+ CLIPImageProjection,
519
+ ConsistencyModelPipeline,
520
+ DanceDiffusionPipeline,
521
+ DDIMPipeline,
522
+ DDPMPipeline,
523
+ DiffusionPipeline,
524
+ DiTPipeline,
525
+ ImagePipelineOutput,
526
+ KarrasVePipeline,
527
+ LDMPipeline,
528
+ LDMSuperResolutionPipeline,
529
+ PNDMPipeline,
530
+ RePaintPipeline,
531
+ ScoreSdeVePipeline,
532
+ StableDiffusionMixin,
533
+ )
534
+ from .schedulers import (
535
+ AmusedScheduler,
536
+ CMStochasticIterativeScheduler,
537
+ DDIMInverseScheduler,
538
+ DDIMParallelScheduler,
539
+ DDIMScheduler,
540
+ DDPMParallelScheduler,
541
+ DDPMScheduler,
542
+ DDPMWuerstchenScheduler,
543
+ DEISMultistepScheduler,
544
+ DPMSolverMultistepInverseScheduler,
545
+ DPMSolverMultistepScheduler,
546
+ DPMSolverSinglestepScheduler,
547
+ EDMDPMSolverMultistepScheduler,
548
+ EDMEulerScheduler,
549
+ EulerAncestralDiscreteScheduler,
550
+ EulerDiscreteScheduler,
551
+ HeunDiscreteScheduler,
552
+ IPNDMScheduler,
553
+ KarrasVeScheduler,
554
+ KDPM2AncestralDiscreteScheduler,
555
+ KDPM2DiscreteScheduler,
556
+ LCMScheduler,
557
+ PNDMScheduler,
558
+ RePaintScheduler,
559
+ SASolverScheduler,
560
+ SchedulerMixin,
561
+ ScoreSdeVeScheduler,
562
+ TCDScheduler,
563
+ UnCLIPScheduler,
564
+ UniPCMultistepScheduler,
565
+ VQDiffusionScheduler,
566
+ )
567
+ from .training_utils import EMAModel
568
+
569
+ try:
570
+ if not (is_torch_available() and is_scipy_available()):
571
+ raise OptionalDependencyNotAvailable()
572
+ except OptionalDependencyNotAvailable:
573
+ from .utils.dummy_torch_and_scipy_objects import * # noqa F403
574
+ else:
575
+ from .schedulers import LMSDiscreteScheduler
576
+
577
+ try:
578
+ if not (is_torch_available() and is_torchsde_available()):
579
+ raise OptionalDependencyNotAvailable()
580
+ except OptionalDependencyNotAvailable:
581
+ from .utils.dummy_torch_and_torchsde_objects import * # noqa F403
582
+ else:
583
+ from .schedulers import DPMSolverSDEScheduler
584
+
585
+ try:
586
+ if not (is_torch_available() and is_transformers_available()):
587
+ raise OptionalDependencyNotAvailable()
588
+ except OptionalDependencyNotAvailable:
589
+ from .utils.dummy_torch_and_transformers_objects import * # noqa F403
590
+ else:
591
+ from .pipelines import (
592
+ AltDiffusionImg2ImgPipeline,
593
+ AltDiffusionPipeline,
594
+ AmusedImg2ImgPipeline,
595
+ AmusedInpaintPipeline,
596
+ AmusedPipeline,
597
+ AnimateDiffPipeline,
598
+ AnimateDiffVideoToVideoPipeline,
599
+ AudioLDM2Pipeline,
600
+ AudioLDM2ProjectionModel,
601
+ AudioLDM2UNet2DConditionModel,
602
+ AudioLDMPipeline,
603
+ CLIPImageProjection,
604
+ CycleDiffusionPipeline,
605
+ I2VGenXLPipeline,
606
+ IFImg2ImgPipeline,
607
+ IFImg2ImgSuperResolutionPipeline,
608
+ IFInpaintingPipeline,
609
+ IFInpaintingSuperResolutionPipeline,
610
+ IFPipeline,
611
+ IFSuperResolutionPipeline,
612
+ ImageTextPipelineOutput,
613
+ Kandinsky3Img2ImgPipeline,
614
+ Kandinsky3Pipeline,
615
+ KandinskyCombinedPipeline,
616
+ KandinskyImg2ImgCombinedPipeline,
617
+ KandinskyImg2ImgPipeline,
618
+ KandinskyInpaintCombinedPipeline,
619
+ KandinskyInpaintPipeline,
620
+ KandinskyPipeline,
621
+ KandinskyPriorPipeline,
622
+ KandinskyV22CombinedPipeline,
623
+ KandinskyV22ControlnetImg2ImgPipeline,
624
+ KandinskyV22ControlnetPipeline,
625
+ KandinskyV22Img2ImgCombinedPipeline,
626
+ KandinskyV22Img2ImgPipeline,
627
+ KandinskyV22InpaintCombinedPipeline,
628
+ KandinskyV22InpaintPipeline,
629
+ KandinskyV22Pipeline,
630
+ KandinskyV22PriorEmb2EmbPipeline,
631
+ KandinskyV22PriorPipeline,
632
+ LatentConsistencyModelImg2ImgPipeline,
633
+ LatentConsistencyModelPipeline,
634
+ LDMTextToImagePipeline,
635
+ LEditsPPPipelineStableDiffusion,
636
+ LEditsPPPipelineStableDiffusionXL,
637
+ MusicLDMPipeline,
638
+ PaintByExamplePipeline,
639
+ PIAPipeline,
640
+ PixArtAlphaPipeline,
641
+ PixArtSigmaPipeline,
642
+ SemanticStableDiffusionPipeline,
643
+ ShapEImg2ImgPipeline,
644
+ ShapEPipeline,
645
+ StableCascadeCombinedPipeline,
646
+ StableCascadeDecoderPipeline,
647
+ StableCascadePriorPipeline,
648
+ StableDiffusionAdapterPipeline,
649
+ StableDiffusionAttendAndExcitePipeline,
650
+ StableDiffusionControlNetImg2ImgPipeline,
651
+ StableDiffusionControlNetInpaintPipeline,
652
+ StableDiffusionControlNetPipeline,
653
+ StableDiffusionControlNetXSPipeline,
654
+ StableDiffusionDepth2ImgPipeline,
655
+ StableDiffusionDiffEditPipeline,
656
+ StableDiffusionGLIGENPipeline,
657
+ StableDiffusionGLIGENTextImagePipeline,
658
+ StableDiffusionImageVariationPipeline,
659
+ StableDiffusionImg2ImgPipeline,
660
+ StableDiffusionInpaintPipeline,
661
+ StableDiffusionInpaintPipelineLegacy,
662
+ StableDiffusionInstructPix2PixPipeline,
663
+ StableDiffusionLatentUpscalePipeline,
664
+ StableDiffusionLDM3DPipeline,
665
+ StableDiffusionModelEditingPipeline,
666
+ StableDiffusionPanoramaPipeline,
667
+ StableDiffusionParadigmsPipeline,
668
+ StableDiffusionPipeline,
669
+ StableDiffusionPipelineSafe,
670
+ StableDiffusionPix2PixZeroPipeline,
671
+ StableDiffusionSAGPipeline,
672
+ StableDiffusionUpscalePipeline,
673
+ StableDiffusionXLAdapterPipeline,
674
+ StableDiffusionXLControlNetImg2ImgPipeline,
675
+ StableDiffusionXLControlNetInpaintPipeline,
676
+ StableDiffusionXLControlNetPipeline,
677
+ StableDiffusionXLControlNetXSPipeline,
678
+ StableDiffusionXLImg2ImgPipeline,
679
+ StableDiffusionXLInpaintPipeline,
680
+ StableDiffusionXLInstructPix2PixPipeline,
681
+ StableDiffusionXLPipeline,
682
+ StableUnCLIPImg2ImgPipeline,
683
+ StableUnCLIPPipeline,
684
+ StableVideoDiffusionPipeline,
685
+ TextToVideoSDPipeline,
686
+ TextToVideoZeroPipeline,
687
+ TextToVideoZeroSDXLPipeline,
688
+ UnCLIPImageVariationPipeline,
689
+ UnCLIPPipeline,
690
+ UniDiffuserModel,
691
+ UniDiffuserPipeline,
692
+ UniDiffuserTextDecoder,
693
+ VersatileDiffusionDualGuidedPipeline,
694
+ VersatileDiffusionImageVariationPipeline,
695
+ VersatileDiffusionPipeline,
696
+ VersatileDiffusionTextToImagePipeline,
697
+ VideoToVideoSDPipeline,
698
+ VQDiffusionPipeline,
699
+ WuerstchenCombinedPipeline,
700
+ WuerstchenDecoderPipeline,
701
+ WuerstchenPriorPipeline,
702
+ )
703
+
704
+ try:
705
+ if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
706
+ raise OptionalDependencyNotAvailable()
707
+ except OptionalDependencyNotAvailable:
708
+ from .utils.dummy_torch_and_transformers_and_k_diffusion_objects import * # noqa F403
709
+ else:
710
+ from .pipelines import StableDiffusionKDiffusionPipeline, StableDiffusionXLKDiffusionPipeline
711
+
712
+ try:
713
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
714
+ raise OptionalDependencyNotAvailable()
715
+ except OptionalDependencyNotAvailable:
716
+ from .utils.dummy_torch_and_transformers_and_onnx_objects import * # noqa F403
717
+ else:
718
+ from .pipelines import (
719
+ OnnxStableDiffusionImg2ImgPipeline,
720
+ OnnxStableDiffusionInpaintPipeline,
721
+ OnnxStableDiffusionInpaintPipelineLegacy,
722
+ OnnxStableDiffusionPipeline,
723
+ OnnxStableDiffusionUpscalePipeline,
724
+ StableDiffusionOnnxPipeline,
725
+ )
726
+
727
+ try:
728
+ if not (is_torch_available() and is_librosa_available()):
729
+ raise OptionalDependencyNotAvailable()
730
+ except OptionalDependencyNotAvailable:
731
+ from .utils.dummy_torch_and_librosa_objects import * # noqa F403
732
+ else:
733
+ from .pipelines import AudioDiffusionPipeline, Mel
734
+
735
+ try:
736
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
737
+ raise OptionalDependencyNotAvailable()
738
+ except OptionalDependencyNotAvailable:
739
+ from .utils.dummy_transformers_and_torch_and_note_seq_objects import * # noqa F403
740
+ else:
741
+ from .pipelines import SpectrogramDiffusionPipeline
742
+
743
+ try:
744
+ if not is_flax_available():
745
+ raise OptionalDependencyNotAvailable()
746
+ except OptionalDependencyNotAvailable:
747
+ from .utils.dummy_flax_objects import * # noqa F403
748
+ else:
749
+ from .models.controlnet_flax import FlaxControlNetModel
750
+ from .models.modeling_flax_utils import FlaxModelMixin
751
+ from .models.unets.unet_2d_condition_flax import FlaxUNet2DConditionModel
752
+ from .models.vae_flax import FlaxAutoencoderKL
753
+ from .pipelines import FlaxDiffusionPipeline
754
+ from .schedulers import (
755
+ FlaxDDIMScheduler,
756
+ FlaxDDPMScheduler,
757
+ FlaxDPMSolverMultistepScheduler,
758
+ FlaxEulerDiscreteScheduler,
759
+ FlaxKarrasVeScheduler,
760
+ FlaxLMSDiscreteScheduler,
761
+ FlaxPNDMScheduler,
762
+ FlaxSchedulerMixin,
763
+ FlaxScoreSdeVeScheduler,
764
+ )
765
+
766
+ try:
767
+ if not (is_flax_available() and is_transformers_available()):
768
+ raise OptionalDependencyNotAvailable()
769
+ except OptionalDependencyNotAvailable:
770
+ from .utils.dummy_flax_and_transformers_objects import * # noqa F403
771
+ else:
772
+ from .pipelines import (
773
+ FlaxStableDiffusionControlNetPipeline,
774
+ FlaxStableDiffusionImg2ImgPipeline,
775
+ FlaxStableDiffusionInpaintPipeline,
776
+ FlaxStableDiffusionPipeline,
777
+ FlaxStableDiffusionXLPipeline,
778
+ )
779
+
780
+ try:
781
+ if not (is_note_seq_available()):
782
+ raise OptionalDependencyNotAvailable()
783
+ except OptionalDependencyNotAvailable:
784
+ from .utils.dummy_note_seq_objects import * # noqa F403
785
+ else:
786
+ from .pipelines import MidiProcessor
787
+
788
+ else:
789
+ import sys
790
+
791
+ sys.modules[__name__] = _LazyModule(
792
+ __name__,
793
+ globals()["__file__"],
794
+ _import_structure,
795
+ module_spec=__spec__,
796
+ extra_objects={"__version__": __version__},
797
+ )
diffusers/commands/__init__.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from abc import ABC, abstractmethod
16
+ from argparse import ArgumentParser
17
+
18
+
19
+ class BaseDiffusersCLICommand(ABC):
20
+ @staticmethod
21
+ @abstractmethod
22
+ def register_subcommand(parser: ArgumentParser):
23
+ raise NotImplementedError()
24
+
25
+ @abstractmethod
26
+ def run(self):
27
+ raise NotImplementedError()
diffusers/experimental/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .rl import ValueGuidedRLPipeline
diffusers/experimental/rl/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .value_guided_sampling import ValueGuidedRLPipeline
diffusers/loaders/__init__.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ..utils import DIFFUSERS_SLOW_IMPORT, _LazyModule, deprecate
4
+ from ..utils.import_utils import is_peft_available, is_torch_available, is_transformers_available
5
+
6
+
7
+ def text_encoder_lora_state_dict(text_encoder):
8
+ deprecate(
9
+ "text_encoder_load_state_dict in `models`",
10
+ "0.27.0",
11
+ "`text_encoder_lora_state_dict` is deprecated and will be removed in 0.27.0. Make sure to retrieve the weights using `get_peft_model`. See https://huggingface.co/docs/peft/v0.6.2/en/quicktour#peftmodel for more information.",
12
+ )
13
+ state_dict = {}
14
+
15
+ for name, module in text_encoder_attn_modules(text_encoder):
16
+ for k, v in module.q_proj.lora_linear_layer.state_dict().items():
17
+ state_dict[f"{name}.q_proj.lora_linear_layer.{k}"] = v
18
+
19
+ for k, v in module.k_proj.lora_linear_layer.state_dict().items():
20
+ state_dict[f"{name}.k_proj.lora_linear_layer.{k}"] = v
21
+
22
+ for k, v in module.v_proj.lora_linear_layer.state_dict().items():
23
+ state_dict[f"{name}.v_proj.lora_linear_layer.{k}"] = v
24
+
25
+ for k, v in module.out_proj.lora_linear_layer.state_dict().items():
26
+ state_dict[f"{name}.out_proj.lora_linear_layer.{k}"] = v
27
+
28
+ return state_dict
29
+
30
+
31
+ if is_transformers_available():
32
+
33
+ def text_encoder_attn_modules(text_encoder):
34
+ deprecate(
35
+ "text_encoder_attn_modules in `models`",
36
+ "0.27.0",
37
+ "`text_encoder_lora_state_dict` is deprecated and will be removed in 0.27.0. Make sure to retrieve the weights using `get_peft_model`. See https://huggingface.co/docs/peft/v0.6.2/en/quicktour#peftmodel for more information.",
38
+ )
39
+ from transformers import CLIPTextModel, CLIPTextModelWithProjection
40
+
41
+ attn_modules = []
42
+
43
+ if isinstance(text_encoder, (CLIPTextModel, CLIPTextModelWithProjection)):
44
+ for i, layer in enumerate(text_encoder.text_model.encoder.layers):
45
+ name = f"text_model.encoder.layers.{i}.self_attn"
46
+ mod = layer.self_attn
47
+ attn_modules.append((name, mod))
48
+ else:
49
+ raise ValueError(f"do not know how to get attention modules for: {text_encoder.__class__.__name__}")
50
+
51
+ return attn_modules
52
+
53
+
54
+ _import_structure = {}
55
+
56
+ if is_torch_available():
57
+ _import_structure["autoencoder"] = ["FromOriginalVAEMixin"]
58
+
59
+ _import_structure["controlnet"] = ["FromOriginalControlNetMixin"]
60
+ _import_structure["unet"] = ["UNet2DConditionLoadersMixin"]
61
+ _import_structure["utils"] = ["AttnProcsLayers"]
62
+ if is_transformers_available():
63
+ _import_structure["single_file"] = ["FromSingleFileMixin"]
64
+ _import_structure["lora"] = ["LoraLoaderMixin", "StableDiffusionXLLoraLoaderMixin"]
65
+ _import_structure["textual_inversion"] = ["TextualInversionLoaderMixin"]
66
+ _import_structure["ip_adapter"] = ["IPAdapterMixin"]
67
+
68
+ _import_structure["peft"] = ["PeftAdapterMixin"]
69
+
70
+
71
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
72
+ if is_torch_available():
73
+ from .autoencoder import FromOriginalVAEMixin
74
+ from .controlnet import FromOriginalControlNetMixin
75
+ from .unet import UNet2DConditionLoadersMixin
76
+ from .utils import AttnProcsLayers
77
+
78
+ if is_transformers_available():
79
+ from .ip_adapter import IPAdapterMixin
80
+ from .lora import LoraLoaderMixin, StableDiffusionXLLoraLoaderMixin
81
+ from .single_file import FromSingleFileMixin
82
+ from .textual_inversion import TextualInversionLoaderMixin
83
+
84
+ from .peft import PeftAdapterMixin
85
+ else:
86
+ import sys
87
+
88
+ sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
diffusers/models/__init__.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from typing import TYPE_CHECKING
16
+
17
+ from ..utils import (
18
+ DIFFUSERS_SLOW_IMPORT,
19
+ _LazyModule,
20
+ is_flax_available,
21
+ is_torch_available,
22
+ )
23
+
24
+
25
+ _import_structure = {}
26
+
27
+ if is_torch_available():
28
+ _import_structure["adapter"] = ["MultiAdapter", "T2IAdapter"]
29
+ _import_structure["autoencoders.autoencoder_asym_kl"] = ["AsymmetricAutoencoderKL"]
30
+ _import_structure["autoencoders.autoencoder_kl"] = ["AutoencoderKL"]
31
+ _import_structure["autoencoders.autoencoder_kl_temporal_decoder"] = ["AutoencoderKLTemporalDecoder"]
32
+ _import_structure["autoencoders.autoencoder_tiny"] = ["AutoencoderTiny"]
33
+ _import_structure["autoencoders.consistency_decoder_vae"] = ["ConsistencyDecoderVAE"]
34
+ _import_structure["controlnet"] = ["ControlNetModel"]
35
+ _import_structure["controlnet_xs"] = ["ControlNetXSAdapter", "UNetControlNetXSModel"]
36
+ _import_structure["dual_transformer_2d"] = ["DualTransformer2DModel"]
37
+ _import_structure["embeddings"] = ["ImageProjection"]
38
+ _import_structure["modeling_utils"] = ["ModelMixin"]
39
+ _import_structure["transformers.prior_transformer"] = ["PriorTransformer"]
40
+ _import_structure["transformers.t5_film_transformer"] = ["T5FilmDecoder"]
41
+ _import_structure["transformers.transformer_2d"] = ["Transformer2DModel"]
42
+ _import_structure["transformers.transformer_temporal"] = ["TransformerTemporalModel"]
43
+ _import_structure["unets.unet_1d"] = ["UNet1DModel"]
44
+ _import_structure["unets.unet_2d"] = ["UNet2DModel"]
45
+ _import_structure["unets.unet_2d_condition"] = ["UNet2DConditionModel"]
46
+ _import_structure["unets.unet_3d_condition"] = ["UNet3DConditionModel"]
47
+ _import_structure["unets.unet_i2vgen_xl"] = ["I2VGenXLUNet"]
48
+ _import_structure["unets.unet_kandinsky3"] = ["Kandinsky3UNet"]
49
+ _import_structure["unets.unet_motion_model"] = ["MotionAdapter", "UNetMotionModel"]
50
+ _import_structure["unets.unet_spatio_temporal_condition"] = ["UNetSpatioTemporalConditionModel"]
51
+ _import_structure["unets.unet_stable_cascade"] = ["StableCascadeUNet"]
52
+ _import_structure["unets.uvit_2d"] = ["UVit2DModel"]
53
+ _import_structure["vq_model"] = ["VQModel"]
54
+
55
+ if is_flax_available():
56
+ _import_structure["controlnet_flax"] = ["FlaxControlNetModel"]
57
+ _import_structure["unets.unet_2d_condition_flax"] = ["FlaxUNet2DConditionModel"]
58
+ _import_structure["vae_flax"] = ["FlaxAutoencoderKL"]
59
+
60
+
61
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
62
+ if is_torch_available():
63
+ from .adapter import MultiAdapter, T2IAdapter
64
+ from .autoencoders import (
65
+ AsymmetricAutoencoderKL,
66
+ AutoencoderKL,
67
+ AutoencoderKLTemporalDecoder,
68
+ AutoencoderTiny,
69
+ ConsistencyDecoderVAE,
70
+ )
71
+ from .controlnet import ControlNetModel
72
+ from .controlnet_xs import ControlNetXSAdapter, UNetControlNetXSModel
73
+ from .embeddings import ImageProjection
74
+ from .modeling_utils import ModelMixin
75
+ from .transformers import (
76
+ DualTransformer2DModel,
77
+ PriorTransformer,
78
+ T5FilmDecoder,
79
+ Transformer2DModel,
80
+ TransformerTemporalModel,
81
+ )
82
+ from .unets import (
83
+ I2VGenXLUNet,
84
+ Kandinsky3UNet,
85
+ MotionAdapter,
86
+ StableCascadeUNet,
87
+ UNet1DModel,
88
+ UNet2DConditionModel,
89
+ UNet2DModel,
90
+ UNet3DConditionModel,
91
+ UNetMotionModel,
92
+ UNetSpatioTemporalConditionModel,
93
+ UVit2DModel,
94
+ )
95
+ from .vq_model import VQModel
96
+
97
+ if is_flax_available():
98
+ from .controlnet_flax import FlaxControlNetModel
99
+ from .unets import FlaxUNet2DConditionModel
100
+ from .vae_flax import FlaxAutoencoderKL
101
+
102
+ else:
103
+ import sys
104
+
105
+ sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
diffusers/models/autoencoders/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from .autoencoder_asym_kl import AsymmetricAutoencoderKL
2
+ from .autoencoder_kl import AutoencoderKL
3
+ from .autoencoder_kl_temporal_decoder import AutoencoderKLTemporalDecoder
4
+ from .autoencoder_tiny import AutoencoderTiny
5
+ from .consistency_decoder_vae import ConsistencyDecoderVAE
diffusers/models/transformers/__init__.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from ...utils import is_torch_available
2
+
3
+
4
+ if is_torch_available():
5
+ from .dual_transformer_2d import DualTransformer2DModel
6
+ from .prior_transformer import PriorTransformer
7
+ from .t5_film_transformer import T5FilmDecoder
8
+ from .transformer_2d import Transformer2DModel
9
+ from .transformer_temporal import TransformerTemporalModel
diffusers/models/unets/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ...utils import is_flax_available, is_torch_available
2
+
3
+
4
+ if is_torch_available():
5
+ from .unet_1d import UNet1DModel
6
+ from .unet_2d import UNet2DModel
7
+ from .unet_2d_condition import UNet2DConditionModel
8
+ from .unet_3d_condition import UNet3DConditionModel
9
+ from .unet_i2vgen_xl import I2VGenXLUNet
10
+ from .unet_kandinsky3 import Kandinsky3UNet
11
+ from .unet_motion_model import MotionAdapter, UNetMotionModel
12
+ from .unet_spatio_temporal_condition import UNetSpatioTemporalConditionModel
13
+ from .unet_stable_cascade import StableCascadeUNet
14
+ from .uvit_2d import UVit2DModel
15
+
16
+
17
+ if is_flax_available():
18
+ from .unet_2d_condition_flax import FlaxUNet2DConditionModel
diffusers/pipelines/__init__.py ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ..utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_flax_available,
9
+ is_k_diffusion_available,
10
+ is_librosa_available,
11
+ is_note_seq_available,
12
+ is_onnx_available,
13
+ is_torch_available,
14
+ is_torch_npu_available,
15
+ is_transformers_available,
16
+ )
17
+
18
+
19
+ # These modules contain pipelines from multiple libraries/frameworks
20
+ _dummy_objects = {}
21
+ _import_structure = {
22
+ "controlnet": [],
23
+ "controlnet_xs": [],
24
+ "deprecated": [],
25
+ "latent_diffusion": [],
26
+ "ledits_pp": [],
27
+ "stable_diffusion": [],
28
+ "stable_diffusion_xl": [],
29
+ }
30
+
31
+ try:
32
+ if not is_torch_available():
33
+ raise OptionalDependencyNotAvailable()
34
+ except OptionalDependencyNotAvailable:
35
+ from ..utils import dummy_pt_objects # noqa F403
36
+
37
+ _dummy_objects.update(get_objects_from_module(dummy_pt_objects))
38
+ else:
39
+ _import_structure["auto_pipeline"] = [
40
+ "AutoPipelineForImage2Image",
41
+ "AutoPipelineForInpainting",
42
+ "AutoPipelineForText2Image",
43
+ ]
44
+ _import_structure["consistency_models"] = ["ConsistencyModelPipeline"]
45
+ _import_structure["dance_diffusion"] = ["DanceDiffusionPipeline"]
46
+ _import_structure["ddim"] = ["DDIMPipeline"]
47
+ _import_structure["ddpm"] = ["DDPMPipeline"]
48
+ _import_structure["dit"] = ["DiTPipeline"]
49
+ _import_structure["latent_diffusion"].extend(["LDMSuperResolutionPipeline"])
50
+ _import_structure["pipeline_utils"] = [
51
+ "AudioPipelineOutput",
52
+ "DiffusionPipeline",
53
+ "StableDiffusionMixin",
54
+ "ImagePipelineOutput",
55
+ ]
56
+ _import_structure["deprecated"].extend(
57
+ [
58
+ "PNDMPipeline",
59
+ "LDMPipeline",
60
+ "RePaintPipeline",
61
+ "ScoreSdeVePipeline",
62
+ "KarrasVePipeline",
63
+ ]
64
+ )
65
+ try:
66
+ if not (is_torch_available() and is_librosa_available()):
67
+ raise OptionalDependencyNotAvailable()
68
+ except OptionalDependencyNotAvailable:
69
+ from ..utils import dummy_torch_and_librosa_objects # noqa F403
70
+
71
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_librosa_objects))
72
+ else:
73
+ _import_structure["deprecated"].extend(["AudioDiffusionPipeline", "Mel"])
74
+
75
+ try:
76
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
77
+ raise OptionalDependencyNotAvailable()
78
+ except OptionalDependencyNotAvailable:
79
+ from ..utils import dummy_transformers_and_torch_and_note_seq_objects # noqa F403
80
+
81
+ _dummy_objects.update(get_objects_from_module(dummy_transformers_and_torch_and_note_seq_objects))
82
+ else:
83
+ _import_structure["deprecated"].extend(
84
+ [
85
+ "MidiProcessor",
86
+ "SpectrogramDiffusionPipeline",
87
+ ]
88
+ )
89
+
90
+ try:
91
+ if not (is_torch_available() and is_transformers_available()):
92
+ raise OptionalDependencyNotAvailable()
93
+ except OptionalDependencyNotAvailable:
94
+ from ..utils import dummy_torch_and_transformers_objects # noqa F403
95
+
96
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
97
+ else:
98
+ _import_structure["deprecated"].extend(
99
+ [
100
+ "VQDiffusionPipeline",
101
+ "AltDiffusionPipeline",
102
+ "AltDiffusionImg2ImgPipeline",
103
+ "CycleDiffusionPipeline",
104
+ "StableDiffusionInpaintPipelineLegacy",
105
+ "StableDiffusionPix2PixZeroPipeline",
106
+ "StableDiffusionParadigmsPipeline",
107
+ "StableDiffusionModelEditingPipeline",
108
+ "VersatileDiffusionDualGuidedPipeline",
109
+ "VersatileDiffusionImageVariationPipeline",
110
+ "VersatileDiffusionPipeline",
111
+ "VersatileDiffusionTextToImagePipeline",
112
+ ]
113
+ )
114
+ _import_structure["amused"] = ["AmusedImg2ImgPipeline", "AmusedInpaintPipeline", "AmusedPipeline"]
115
+ _import_structure["animatediff"] = [
116
+ "AnimateDiffPipeline",
117
+ "AnimateDiffVideoToVideoPipeline",
118
+ ]
119
+ _import_structure["audioldm"] = ["AudioLDMPipeline"]
120
+ _import_structure["audioldm2"] = [
121
+ "AudioLDM2Pipeline",
122
+ "AudioLDM2ProjectionModel",
123
+ "AudioLDM2UNet2DConditionModel",
124
+ ]
125
+ _import_structure["blip_diffusion"] = ["BlipDiffusionPipeline"]
126
+ _import_structure["controlnet"].extend(
127
+ [
128
+ "BlipDiffusionControlNetPipeline",
129
+ "StableDiffusionControlNetImg2ImgPipeline",
130
+ "StableDiffusionControlNetInpaintPipeline",
131
+ "StableDiffusionControlNetPipeline",
132
+ "StableDiffusionXLControlNetImg2ImgPipeline",
133
+ "StableDiffusionXLControlNetInpaintPipeline",
134
+ "StableDiffusionXLControlNetPipeline",
135
+ ]
136
+ )
137
+ _import_structure["controlnet_xs"].extend(
138
+ [
139
+ "StableDiffusionControlNetXSPipeline",
140
+ "StableDiffusionXLControlNetXSPipeline",
141
+ ]
142
+ )
143
+ _import_structure["deepfloyd_if"] = [
144
+ "IFImg2ImgPipeline",
145
+ "IFImg2ImgSuperResolutionPipeline",
146
+ "IFInpaintingPipeline",
147
+ "IFInpaintingSuperResolutionPipeline",
148
+ "IFPipeline",
149
+ "IFSuperResolutionPipeline",
150
+ ]
151
+ _import_structure["kandinsky"] = [
152
+ "KandinskyCombinedPipeline",
153
+ "KandinskyImg2ImgCombinedPipeline",
154
+ "KandinskyImg2ImgPipeline",
155
+ "KandinskyInpaintCombinedPipeline",
156
+ "KandinskyInpaintPipeline",
157
+ "KandinskyPipeline",
158
+ "KandinskyPriorPipeline",
159
+ ]
160
+ _import_structure["kandinsky2_2"] = [
161
+ "KandinskyV22CombinedPipeline",
162
+ "KandinskyV22ControlnetImg2ImgPipeline",
163
+ "KandinskyV22ControlnetPipeline",
164
+ "KandinskyV22Img2ImgCombinedPipeline",
165
+ "KandinskyV22Img2ImgPipeline",
166
+ "KandinskyV22InpaintCombinedPipeline",
167
+ "KandinskyV22InpaintPipeline",
168
+ "KandinskyV22Pipeline",
169
+ "KandinskyV22PriorEmb2EmbPipeline",
170
+ "KandinskyV22PriorPipeline",
171
+ ]
172
+ _import_structure["kandinsky3"] = [
173
+ "Kandinsky3Img2ImgPipeline",
174
+ "Kandinsky3Pipeline",
175
+ ]
176
+ _import_structure["latent_consistency_models"] = [
177
+ "LatentConsistencyModelImg2ImgPipeline",
178
+ "LatentConsistencyModelPipeline",
179
+ ]
180
+ _import_structure["latent_diffusion"].extend(["LDMTextToImagePipeline"])
181
+ _import_structure["ledits_pp"].extend(
182
+ [
183
+ "LEditsPPPipelineStableDiffusion",
184
+ "LEditsPPPipelineStableDiffusionXL",
185
+ ]
186
+ )
187
+ _import_structure["musicldm"] = ["MusicLDMPipeline"]
188
+ _import_structure["paint_by_example"] = ["PaintByExamplePipeline"]
189
+ _import_structure["pia"] = ["PIAPipeline"]
190
+ _import_structure["pixart_alpha"] = ["PixArtAlphaPipeline", "PixArtSigmaPipeline"]
191
+ _import_structure["semantic_stable_diffusion"] = ["SemanticStableDiffusionPipeline"]
192
+ _import_structure["shap_e"] = ["ShapEImg2ImgPipeline", "ShapEPipeline"]
193
+ _import_structure["stable_cascade"] = [
194
+ "StableCascadeCombinedPipeline",
195
+ "StableCascadeDecoderPipeline",
196
+ "StableCascadePriorPipeline",
197
+ ]
198
+ _import_structure["stable_diffusion"].extend(
199
+ [
200
+ "CLIPImageProjection",
201
+ "StableDiffusionDepth2ImgPipeline",
202
+ "StableDiffusionImageVariationPipeline",
203
+ "StableDiffusionImg2ImgPipeline",
204
+ "StableDiffusionInpaintPipeline",
205
+ "StableDiffusionInstructPix2PixPipeline",
206
+ "StableDiffusionLatentUpscalePipeline",
207
+ "StableDiffusionPipeline",
208
+ "StableDiffusionUpscalePipeline",
209
+ "StableUnCLIPImg2ImgPipeline",
210
+ "StableUnCLIPPipeline",
211
+ "StableDiffusionLDM3DPipeline",
212
+ ]
213
+ )
214
+ _import_structure["stable_diffusion_attend_and_excite"] = ["StableDiffusionAttendAndExcitePipeline"]
215
+ _import_structure["stable_diffusion_safe"] = ["StableDiffusionPipelineSafe"]
216
+ _import_structure["stable_diffusion_sag"] = ["StableDiffusionSAGPipeline"]
217
+ _import_structure["stable_diffusion_gligen"] = [
218
+ "StableDiffusionGLIGENPipeline",
219
+ "StableDiffusionGLIGENTextImagePipeline",
220
+ ]
221
+ _import_structure["stable_video_diffusion"] = ["StableVideoDiffusionPipeline"]
222
+ _import_structure["stable_diffusion_xl"].extend(
223
+ [
224
+ "StableDiffusionXLImg2ImgPipeline",
225
+ "StableDiffusionXLInpaintPipeline",
226
+ "StableDiffusionXLInstructPix2PixPipeline",
227
+ "StableDiffusionXLPipeline",
228
+ ]
229
+ )
230
+ _import_structure["stable_diffusion_diffedit"] = ["StableDiffusionDiffEditPipeline"]
231
+ _import_structure["stable_diffusion_ldm3d"] = ["StableDiffusionLDM3DPipeline"]
232
+ _import_structure["stable_diffusion_panorama"] = ["StableDiffusionPanoramaPipeline"]
233
+ _import_structure["t2i_adapter"] = [
234
+ "StableDiffusionAdapterPipeline",
235
+ "StableDiffusionXLAdapterPipeline",
236
+ ]
237
+ _import_structure["text_to_video_synthesis"] = [
238
+ "TextToVideoSDPipeline",
239
+ "TextToVideoZeroPipeline",
240
+ "TextToVideoZeroSDXLPipeline",
241
+ "VideoToVideoSDPipeline",
242
+ ]
243
+ _import_structure["i2vgen_xl"] = ["I2VGenXLPipeline"]
244
+ _import_structure["unclip"] = ["UnCLIPImageVariationPipeline", "UnCLIPPipeline"]
245
+ _import_structure["unidiffuser"] = [
246
+ "ImageTextPipelineOutput",
247
+ "UniDiffuserModel",
248
+ "UniDiffuserPipeline",
249
+ "UniDiffuserTextDecoder",
250
+ ]
251
+ _import_structure["wuerstchen"] = [
252
+ "WuerstchenCombinedPipeline",
253
+ "WuerstchenDecoderPipeline",
254
+ "WuerstchenPriorPipeline",
255
+ ]
256
+ try:
257
+ if not is_onnx_available():
258
+ raise OptionalDependencyNotAvailable()
259
+ except OptionalDependencyNotAvailable:
260
+ from ..utils import dummy_onnx_objects # noqa F403
261
+
262
+ _dummy_objects.update(get_objects_from_module(dummy_onnx_objects))
263
+ else:
264
+ _import_structure["onnx_utils"] = ["OnnxRuntimeModel"]
265
+ try:
266
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
267
+ raise OptionalDependencyNotAvailable()
268
+ except OptionalDependencyNotAvailable:
269
+ from ..utils import dummy_torch_and_transformers_and_onnx_objects # noqa F403
270
+
271
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_onnx_objects))
272
+ else:
273
+ _import_structure["stable_diffusion"].extend(
274
+ [
275
+ "OnnxStableDiffusionImg2ImgPipeline",
276
+ "OnnxStableDiffusionInpaintPipeline",
277
+ "OnnxStableDiffusionPipeline",
278
+ "OnnxStableDiffusionUpscalePipeline",
279
+ "StableDiffusionOnnxPipeline",
280
+ ]
281
+ )
282
+
283
+ try:
284
+ if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
285
+ raise OptionalDependencyNotAvailable()
286
+ except OptionalDependencyNotAvailable:
287
+ from ..utils import (
288
+ dummy_torch_and_transformers_and_k_diffusion_objects,
289
+ )
290
+
291
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_k_diffusion_objects))
292
+ else:
293
+ _import_structure["stable_diffusion_k_diffusion"] = [
294
+ "StableDiffusionKDiffusionPipeline",
295
+ "StableDiffusionXLKDiffusionPipeline",
296
+ ]
297
+ try:
298
+ if not is_flax_available():
299
+ raise OptionalDependencyNotAvailable()
300
+ except OptionalDependencyNotAvailable:
301
+ from ..utils import dummy_flax_objects # noqa F403
302
+
303
+ _dummy_objects.update(get_objects_from_module(dummy_flax_objects))
304
+ else:
305
+ _import_structure["pipeline_flax_utils"] = ["FlaxDiffusionPipeline"]
306
+ try:
307
+ if not (is_flax_available() and is_transformers_available()):
308
+ raise OptionalDependencyNotAvailable()
309
+ except OptionalDependencyNotAvailable:
310
+ from ..utils import dummy_flax_and_transformers_objects # noqa F403
311
+
312
+ _dummy_objects.update(get_objects_from_module(dummy_flax_and_transformers_objects))
313
+ else:
314
+ _import_structure["controlnet"].extend(["FlaxStableDiffusionControlNetPipeline"])
315
+ _import_structure["stable_diffusion"].extend(
316
+ [
317
+ "FlaxStableDiffusionImg2ImgPipeline",
318
+ "FlaxStableDiffusionInpaintPipeline",
319
+ "FlaxStableDiffusionPipeline",
320
+ ]
321
+ )
322
+ _import_structure["stable_diffusion_xl"].extend(
323
+ [
324
+ "FlaxStableDiffusionXLPipeline",
325
+ ]
326
+ )
327
+
328
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
329
+ try:
330
+ if not is_torch_available():
331
+ raise OptionalDependencyNotAvailable()
332
+ except OptionalDependencyNotAvailable:
333
+ from ..utils.dummy_pt_objects import * # noqa F403
334
+
335
+ else:
336
+ from .auto_pipeline import (
337
+ AutoPipelineForImage2Image,
338
+ AutoPipelineForInpainting,
339
+ AutoPipelineForText2Image,
340
+ )
341
+ from .consistency_models import ConsistencyModelPipeline
342
+ from .dance_diffusion import DanceDiffusionPipeline
343
+ from .ddim import DDIMPipeline
344
+ from .ddpm import DDPMPipeline
345
+ from .deprecated import KarrasVePipeline, LDMPipeline, PNDMPipeline, RePaintPipeline, ScoreSdeVePipeline
346
+ from .dit import DiTPipeline
347
+ from .latent_diffusion import LDMSuperResolutionPipeline
348
+ from .pipeline_utils import (
349
+ AudioPipelineOutput,
350
+ DiffusionPipeline,
351
+ ImagePipelineOutput,
352
+ StableDiffusionMixin,
353
+ )
354
+
355
+ try:
356
+ if not (is_torch_available() and is_librosa_available()):
357
+ raise OptionalDependencyNotAvailable()
358
+ except OptionalDependencyNotAvailable:
359
+ from ..utils.dummy_torch_and_librosa_objects import *
360
+ else:
361
+ from .deprecated import AudioDiffusionPipeline, Mel
362
+
363
+ try:
364
+ if not (is_torch_available() and is_transformers_available()):
365
+ raise OptionalDependencyNotAvailable()
366
+ except OptionalDependencyNotAvailable:
367
+ from ..utils.dummy_torch_and_transformers_objects import *
368
+ else:
369
+ from .amused import AmusedImg2ImgPipeline, AmusedInpaintPipeline, AmusedPipeline
370
+ from .animatediff import AnimateDiffPipeline, AnimateDiffVideoToVideoPipeline
371
+ from .audioldm import AudioLDMPipeline
372
+ from .audioldm2 import (
373
+ AudioLDM2Pipeline,
374
+ AudioLDM2ProjectionModel,
375
+ AudioLDM2UNet2DConditionModel,
376
+ )
377
+ from .blip_diffusion import BlipDiffusionPipeline
378
+ from .controlnet import (
379
+ BlipDiffusionControlNetPipeline,
380
+ StableDiffusionControlNetImg2ImgPipeline,
381
+ StableDiffusionControlNetInpaintPipeline,
382
+ StableDiffusionControlNetPipeline,
383
+ StableDiffusionXLControlNetImg2ImgPipeline,
384
+ StableDiffusionXLControlNetInpaintPipeline,
385
+ StableDiffusionXLControlNetPipeline,
386
+ )
387
+ from .controlnet_xs import (
388
+ StableDiffusionControlNetXSPipeline,
389
+ StableDiffusionXLControlNetXSPipeline,
390
+ )
391
+ from .deepfloyd_if import (
392
+ IFImg2ImgPipeline,
393
+ IFImg2ImgSuperResolutionPipeline,
394
+ IFInpaintingPipeline,
395
+ IFInpaintingSuperResolutionPipeline,
396
+ IFPipeline,
397
+ IFSuperResolutionPipeline,
398
+ )
399
+ from .deprecated import (
400
+ AltDiffusionImg2ImgPipeline,
401
+ AltDiffusionPipeline,
402
+ CycleDiffusionPipeline,
403
+ StableDiffusionInpaintPipelineLegacy,
404
+ StableDiffusionModelEditingPipeline,
405
+ StableDiffusionParadigmsPipeline,
406
+ StableDiffusionPix2PixZeroPipeline,
407
+ VersatileDiffusionDualGuidedPipeline,
408
+ VersatileDiffusionImageVariationPipeline,
409
+ VersatileDiffusionPipeline,
410
+ VersatileDiffusionTextToImagePipeline,
411
+ VQDiffusionPipeline,
412
+ )
413
+ from .i2vgen_xl import I2VGenXLPipeline
414
+ from .kandinsky import (
415
+ KandinskyCombinedPipeline,
416
+ KandinskyImg2ImgCombinedPipeline,
417
+ KandinskyImg2ImgPipeline,
418
+ KandinskyInpaintCombinedPipeline,
419
+ KandinskyInpaintPipeline,
420
+ KandinskyPipeline,
421
+ KandinskyPriorPipeline,
422
+ )
423
+ from .kandinsky2_2 import (
424
+ KandinskyV22CombinedPipeline,
425
+ KandinskyV22ControlnetImg2ImgPipeline,
426
+ KandinskyV22ControlnetPipeline,
427
+ KandinskyV22Img2ImgCombinedPipeline,
428
+ KandinskyV22Img2ImgPipeline,
429
+ KandinskyV22InpaintCombinedPipeline,
430
+ KandinskyV22InpaintPipeline,
431
+ KandinskyV22Pipeline,
432
+ KandinskyV22PriorEmb2EmbPipeline,
433
+ KandinskyV22PriorPipeline,
434
+ )
435
+ from .kandinsky3 import (
436
+ Kandinsky3Img2ImgPipeline,
437
+ Kandinsky3Pipeline,
438
+ )
439
+ from .latent_consistency_models import (
440
+ LatentConsistencyModelImg2ImgPipeline,
441
+ LatentConsistencyModelPipeline,
442
+ )
443
+ from .latent_diffusion import LDMTextToImagePipeline
444
+ from .ledits_pp import (
445
+ LEditsPPDiffusionPipelineOutput,
446
+ LEditsPPInversionPipelineOutput,
447
+ LEditsPPPipelineStableDiffusion,
448
+ LEditsPPPipelineStableDiffusionXL,
449
+ )
450
+ from .musicldm import MusicLDMPipeline
451
+ from .paint_by_example import PaintByExamplePipeline
452
+ from .pia import PIAPipeline
453
+ from .pixart_alpha import PixArtAlphaPipeline, PixArtSigmaPipeline
454
+ from .semantic_stable_diffusion import SemanticStableDiffusionPipeline
455
+ from .shap_e import ShapEImg2ImgPipeline, ShapEPipeline
456
+ from .stable_cascade import (
457
+ StableCascadeCombinedPipeline,
458
+ StableCascadeDecoderPipeline,
459
+ StableCascadePriorPipeline,
460
+ )
461
+ from .stable_diffusion import (
462
+ CLIPImageProjection,
463
+ StableDiffusionDepth2ImgPipeline,
464
+ StableDiffusionImageVariationPipeline,
465
+ StableDiffusionImg2ImgPipeline,
466
+ StableDiffusionInpaintPipeline,
467
+ StableDiffusionInstructPix2PixPipeline,
468
+ StableDiffusionLatentUpscalePipeline,
469
+ StableDiffusionPipeline,
470
+ StableDiffusionUpscalePipeline,
471
+ StableUnCLIPImg2ImgPipeline,
472
+ StableUnCLIPPipeline,
473
+ )
474
+ from .stable_diffusion_attend_and_excite import StableDiffusionAttendAndExcitePipeline
475
+ from .stable_diffusion_diffedit import StableDiffusionDiffEditPipeline
476
+ from .stable_diffusion_gligen import StableDiffusionGLIGENPipeline, StableDiffusionGLIGENTextImagePipeline
477
+ from .stable_diffusion_ldm3d import StableDiffusionLDM3DPipeline
478
+ from .stable_diffusion_panorama import StableDiffusionPanoramaPipeline
479
+ from .stable_diffusion_safe import StableDiffusionPipelineSafe
480
+ from .stable_diffusion_sag import StableDiffusionSAGPipeline
481
+ from .stable_diffusion_xl import (
482
+ StableDiffusionXLImg2ImgPipeline,
483
+ StableDiffusionXLInpaintPipeline,
484
+ StableDiffusionXLInstructPix2PixPipeline,
485
+ StableDiffusionXLPipeline,
486
+ )
487
+ from .stable_video_diffusion import StableVideoDiffusionPipeline
488
+ from .t2i_adapter import (
489
+ StableDiffusionAdapterPipeline,
490
+ StableDiffusionXLAdapterPipeline,
491
+ )
492
+ from .text_to_video_synthesis import (
493
+ TextToVideoSDPipeline,
494
+ TextToVideoZeroPipeline,
495
+ TextToVideoZeroSDXLPipeline,
496
+ VideoToVideoSDPipeline,
497
+ )
498
+ from .unclip import UnCLIPImageVariationPipeline, UnCLIPPipeline
499
+ from .unidiffuser import (
500
+ ImageTextPipelineOutput,
501
+ UniDiffuserModel,
502
+ UniDiffuserPipeline,
503
+ UniDiffuserTextDecoder,
504
+ )
505
+ from .wuerstchen import (
506
+ WuerstchenCombinedPipeline,
507
+ WuerstchenDecoderPipeline,
508
+ WuerstchenPriorPipeline,
509
+ )
510
+
511
+ try:
512
+ if not is_onnx_available():
513
+ raise OptionalDependencyNotAvailable()
514
+ except OptionalDependencyNotAvailable:
515
+ from ..utils.dummy_onnx_objects import * # noqa F403
516
+
517
+ else:
518
+ from .onnx_utils import OnnxRuntimeModel
519
+
520
+ try:
521
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
522
+ raise OptionalDependencyNotAvailable()
523
+ except OptionalDependencyNotAvailable:
524
+ from ..utils.dummy_torch_and_transformers_and_onnx_objects import *
525
+ else:
526
+ from .stable_diffusion import (
527
+ OnnxStableDiffusionImg2ImgPipeline,
528
+ OnnxStableDiffusionInpaintPipeline,
529
+ OnnxStableDiffusionPipeline,
530
+ OnnxStableDiffusionUpscalePipeline,
531
+ StableDiffusionOnnxPipeline,
532
+ )
533
+
534
+ try:
535
+ if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
536
+ raise OptionalDependencyNotAvailable()
537
+ except OptionalDependencyNotAvailable:
538
+ from ..utils.dummy_torch_and_transformers_and_k_diffusion_objects import *
539
+ else:
540
+ from .stable_diffusion_k_diffusion import (
541
+ StableDiffusionKDiffusionPipeline,
542
+ StableDiffusionXLKDiffusionPipeline,
543
+ )
544
+
545
+ try:
546
+ if not is_flax_available():
547
+ raise OptionalDependencyNotAvailable()
548
+ except OptionalDependencyNotAvailable:
549
+ from ..utils.dummy_flax_objects import * # noqa F403
550
+ else:
551
+ from .pipeline_flax_utils import FlaxDiffusionPipeline
552
+
553
+ try:
554
+ if not (is_flax_available() and is_transformers_available()):
555
+ raise OptionalDependencyNotAvailable()
556
+ except OptionalDependencyNotAvailable:
557
+ from ..utils.dummy_flax_and_transformers_objects import *
558
+ else:
559
+ from .controlnet import FlaxStableDiffusionControlNetPipeline
560
+ from .stable_diffusion import (
561
+ FlaxStableDiffusionImg2ImgPipeline,
562
+ FlaxStableDiffusionInpaintPipeline,
563
+ FlaxStableDiffusionPipeline,
564
+ )
565
+ from .stable_diffusion_xl import (
566
+ FlaxStableDiffusionXLPipeline,
567
+ )
568
+
569
+ try:
570
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
571
+ raise OptionalDependencyNotAvailable()
572
+ except OptionalDependencyNotAvailable:
573
+ from ..utils.dummy_transformers_and_torch_and_note_seq_objects import * # noqa F403
574
+
575
+ else:
576
+ from .deprecated import (
577
+ MidiProcessor,
578
+ SpectrogramDiffusionPipeline,
579
+ )
580
+
581
+ else:
582
+ import sys
583
+
584
+ sys.modules[__name__] = _LazyModule(
585
+ __name__,
586
+ globals()["__file__"],
587
+ _import_structure,
588
+ module_spec=__spec__,
589
+ )
590
+ for name, value in _dummy_objects.items():
591
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/amused/__init__.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ is_torch_available,
8
+ is_transformers_available,
9
+ )
10
+
11
+
12
+ _dummy_objects = {}
13
+ _import_structure = {}
14
+
15
+ try:
16
+ if not (is_transformers_available() and is_torch_available()):
17
+ raise OptionalDependencyNotAvailable()
18
+ except OptionalDependencyNotAvailable:
19
+ from ...utils.dummy_torch_and_transformers_objects import (
20
+ AmusedImg2ImgPipeline,
21
+ AmusedInpaintPipeline,
22
+ AmusedPipeline,
23
+ )
24
+
25
+ _dummy_objects.update(
26
+ {
27
+ "AmusedPipeline": AmusedPipeline,
28
+ "AmusedImg2ImgPipeline": AmusedImg2ImgPipeline,
29
+ "AmusedInpaintPipeline": AmusedInpaintPipeline,
30
+ }
31
+ )
32
+ else:
33
+ _import_structure["pipeline_amused"] = ["AmusedPipeline"]
34
+ _import_structure["pipeline_amused_img2img"] = ["AmusedImg2ImgPipeline"]
35
+ _import_structure["pipeline_amused_inpaint"] = ["AmusedInpaintPipeline"]
36
+
37
+
38
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
39
+ try:
40
+ if not (is_transformers_available() and is_torch_available()):
41
+ raise OptionalDependencyNotAvailable()
42
+ except OptionalDependencyNotAvailable:
43
+ from ...utils.dummy_torch_and_transformers_objects import (
44
+ AmusedPipeline,
45
+ )
46
+ else:
47
+ from .pipeline_amused import AmusedPipeline
48
+ from .pipeline_amused_img2img import AmusedImg2ImgPipeline
49
+ from .pipeline_amused_inpaint import AmusedInpaintPipeline
50
+
51
+ else:
52
+ import sys
53
+
54
+ sys.modules[__name__] = _LazyModule(
55
+ __name__,
56
+ globals()["__file__"],
57
+ _import_structure,
58
+ module_spec=__spec__,
59
+ )
60
+
61
+ for name, value in _dummy_objects.items():
62
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/animatediff/__init__.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {"pipeline_output": ["AnimateDiffPipelineOutput"]}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_animatediff"] = ["AnimateDiffPipeline"]
25
+ _import_structure["pipeline_animatediff_video2video"] = ["AnimateDiffVideoToVideoPipeline"]
26
+
27
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
28
+ try:
29
+ if not (is_transformers_available() and is_torch_available()):
30
+ raise OptionalDependencyNotAvailable()
31
+ except OptionalDependencyNotAvailable:
32
+ from ...utils.dummy_torch_and_transformers_objects import *
33
+
34
+ else:
35
+ from .pipeline_animatediff import AnimateDiffPipeline
36
+ from .pipeline_animatediff_video2video import AnimateDiffVideoToVideoPipeline
37
+ from .pipeline_output import AnimateDiffPipelineOutput
38
+
39
+ else:
40
+ import sys
41
+
42
+ sys.modules[__name__] = _LazyModule(
43
+ __name__,
44
+ globals()["__file__"],
45
+ _import_structure,
46
+ module_spec=__spec__,
47
+ )
48
+ for name, value in _dummy_objects.items():
49
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/audioldm/__init__.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ is_torch_available,
8
+ is_transformers_available,
9
+ is_transformers_version,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils.dummy_torch_and_transformers_objects import (
21
+ AudioLDMPipeline,
22
+ )
23
+
24
+ _dummy_objects.update({"AudioLDMPipeline": AudioLDMPipeline})
25
+ else:
26
+ _import_structure["pipeline_audioldm"] = ["AudioLDMPipeline"]
27
+
28
+
29
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
30
+ try:
31
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
32
+ raise OptionalDependencyNotAvailable()
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import (
35
+ AudioLDMPipeline,
36
+ )
37
+
38
+ else:
39
+ from .pipeline_audioldm import AudioLDMPipeline
40
+ else:
41
+ import sys
42
+
43
+ sys.modules[__name__] = _LazyModule(
44
+ __name__,
45
+ globals()["__file__"],
46
+ _import_structure,
47
+ module_spec=__spec__,
48
+ )
49
+
50
+ for name, value in _dummy_objects.items():
51
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/audioldm2/__init__.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ is_transformers_version,
11
+ )
12
+
13
+
14
+ _dummy_objects = {}
15
+ _import_structure = {}
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["modeling_audioldm2"] = ["AudioLDM2ProjectionModel", "AudioLDM2UNet2DConditionModel"]
26
+ _import_structure["pipeline_audioldm2"] = ["AudioLDM2Pipeline"]
27
+
28
+
29
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
30
+ try:
31
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
32
+ raise OptionalDependencyNotAvailable()
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+
36
+ else:
37
+ from .modeling_audioldm2 import AudioLDM2ProjectionModel, AudioLDM2UNet2DConditionModel
38
+ from .pipeline_audioldm2 import AudioLDM2Pipeline
39
+
40
+ else:
41
+ import sys
42
+
43
+ sys.modules[__name__] = _LazyModule(
44
+ __name__,
45
+ globals()["__file__"],
46
+ _import_structure,
47
+ module_spec=__spec__,
48
+ )
49
+ for name, value in _dummy_objects.items():
50
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/blip_diffusion/__init__.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from typing import List, Optional, Union
3
+
4
+ import numpy as np
5
+ import PIL
6
+ from PIL import Image
7
+
8
+ from ...utils import OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
9
+
10
+
11
+ try:
12
+ if not (is_transformers_available() and is_torch_available()):
13
+ raise OptionalDependencyNotAvailable()
14
+ except OptionalDependencyNotAvailable:
15
+ from ...utils.dummy_torch_and_transformers_objects import ShapEPipeline
16
+ else:
17
+ from .blip_image_processing import BlipImageProcessor
18
+ from .modeling_blip2 import Blip2QFormerModel
19
+ from .modeling_ctx_clip import ContextCLIPTextModel
20
+ from .pipeline_blip_diffusion import BlipDiffusionPipeline
diffusers/pipelines/consistency_models/__init__.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ _LazyModule,
6
+ )
7
+
8
+
9
+ _import_structure = {
10
+ "pipeline_consistency_models": ["ConsistencyModelPipeline"],
11
+ }
12
+
13
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
14
+ from .pipeline_consistency_models import ConsistencyModelPipeline
15
+
16
+ else:
17
+ import sys
18
+
19
+ sys.modules[__name__] = _LazyModule(
20
+ __name__,
21
+ globals()["__file__"],
22
+ _import_structure,
23
+ module_spec=__spec__,
24
+ )
diffusers/pipelines/controlnet/__init__.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_flax_available,
9
+ is_torch_available,
10
+ is_transformers_available,
11
+ )
12
+
13
+
14
+ _dummy_objects = {}
15
+ _import_structure = {}
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available()):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["multicontrolnet"] = ["MultiControlNetModel"]
26
+ _import_structure["pipeline_controlnet"] = ["StableDiffusionControlNetPipeline"]
27
+ _import_structure["pipeline_controlnet_blip_diffusion"] = ["BlipDiffusionControlNetPipeline"]
28
+ _import_structure["pipeline_controlnet_img2img"] = ["StableDiffusionControlNetImg2ImgPipeline"]
29
+ _import_structure["pipeline_controlnet_inpaint"] = ["StableDiffusionControlNetInpaintPipeline"]
30
+ _import_structure["pipeline_controlnet_inpaint_sd_xl"] = ["StableDiffusionXLControlNetInpaintPipeline"]
31
+ _import_structure["pipeline_controlnet_sd_xl"] = ["StableDiffusionXLControlNetPipeline"]
32
+ _import_structure["pipeline_controlnet_sd_xl_img2img"] = ["StableDiffusionXLControlNetImg2ImgPipeline"]
33
+ try:
34
+ if not (is_transformers_available() and is_flax_available()):
35
+ raise OptionalDependencyNotAvailable()
36
+ except OptionalDependencyNotAvailable:
37
+ from ...utils import dummy_flax_and_transformers_objects # noqa F403
38
+
39
+ _dummy_objects.update(get_objects_from_module(dummy_flax_and_transformers_objects))
40
+ else:
41
+ _import_structure["pipeline_flax_controlnet"] = ["FlaxStableDiffusionControlNetPipeline"]
42
+
43
+
44
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
45
+ try:
46
+ if not (is_transformers_available() and is_torch_available()):
47
+ raise OptionalDependencyNotAvailable()
48
+
49
+ except OptionalDependencyNotAvailable:
50
+ from ...utils.dummy_torch_and_transformers_objects import *
51
+ else:
52
+ from .multicontrolnet import MultiControlNetModel
53
+ from .pipeline_controlnet import StableDiffusionControlNetPipeline
54
+ from .pipeline_controlnet_blip_diffusion import BlipDiffusionControlNetPipeline
55
+ from .pipeline_controlnet_img2img import StableDiffusionControlNetImg2ImgPipeline
56
+ from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline
57
+ from .pipeline_controlnet_inpaint_sd_xl import StableDiffusionXLControlNetInpaintPipeline
58
+ from .pipeline_controlnet_sd_xl import StableDiffusionXLControlNetPipeline
59
+ from .pipeline_controlnet_sd_xl_img2img import StableDiffusionXLControlNetImg2ImgPipeline
60
+
61
+ try:
62
+ if not (is_transformers_available() and is_flax_available()):
63
+ raise OptionalDependencyNotAvailable()
64
+ except OptionalDependencyNotAvailable:
65
+ from ...utils.dummy_flax_and_transformers_objects import * # noqa F403
66
+ else:
67
+ from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline
68
+
69
+
70
+ else:
71
+ import sys
72
+
73
+ sys.modules[__name__] = _LazyModule(
74
+ __name__,
75
+ globals()["__file__"],
76
+ _import_structure,
77
+ module_spec=__spec__,
78
+ )
79
+ for name, value in _dummy_objects.items():
80
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/controlnet_xs/__init__.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_flax_available,
9
+ is_torch_available,
10
+ is_transformers_available,
11
+ )
12
+
13
+
14
+ _dummy_objects = {}
15
+ _import_structure = {}
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available()):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["pipeline_controlnet_xs"] = ["StableDiffusionControlNetXSPipeline"]
26
+ _import_structure["pipeline_controlnet_xs_sd_xl"] = ["StableDiffusionXLControlNetXSPipeline"]
27
+ try:
28
+ if not (is_transformers_available() and is_flax_available()):
29
+ raise OptionalDependencyNotAvailable()
30
+ except OptionalDependencyNotAvailable:
31
+ from ...utils import dummy_flax_and_transformers_objects # noqa F403
32
+
33
+ _dummy_objects.update(get_objects_from_module(dummy_flax_and_transformers_objects))
34
+ else:
35
+ pass # _import_structure["pipeline_flax_controlnet"] = ["FlaxStableDiffusionControlNetPipeline"]
36
+
37
+
38
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
39
+ try:
40
+ if not (is_transformers_available() and is_torch_available()):
41
+ raise OptionalDependencyNotAvailable()
42
+
43
+ except OptionalDependencyNotAvailable:
44
+ from ...utils.dummy_torch_and_transformers_objects import *
45
+ else:
46
+ from .pipeline_controlnet_xs import StableDiffusionControlNetXSPipeline
47
+ from .pipeline_controlnet_xs_sd_xl import StableDiffusionXLControlNetXSPipeline
48
+
49
+ try:
50
+ if not (is_transformers_available() and is_flax_available()):
51
+ raise OptionalDependencyNotAvailable()
52
+ except OptionalDependencyNotAvailable:
53
+ from ...utils.dummy_flax_and_transformers_objects import * # noqa F403
54
+ else:
55
+ pass # from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline
56
+
57
+
58
+ else:
59
+ import sys
60
+
61
+ sys.modules[__name__] = _LazyModule(
62
+ __name__,
63
+ globals()["__file__"],
64
+ _import_structure,
65
+ module_spec=__spec__,
66
+ )
67
+ for name, value in _dummy_objects.items():
68
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/dance_diffusion/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_dance_diffusion": ["DanceDiffusionPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_dance_diffusion import DanceDiffusionPipeline
10
+ else:
11
+ import sys
12
+
13
+ sys.modules[__name__] = _LazyModule(
14
+ __name__,
15
+ globals()["__file__"],
16
+ _import_structure,
17
+ module_spec=__spec__,
18
+ )
diffusers/pipelines/ddim/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_ddim": ["DDIMPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_ddim import DDIMPipeline
10
+ else:
11
+ import sys
12
+
13
+ sys.modules[__name__] = _LazyModule(
14
+ __name__,
15
+ globals()["__file__"],
16
+ _import_structure,
17
+ module_spec=__spec__,
18
+ )
diffusers/pipelines/ddpm/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ _LazyModule,
6
+ )
7
+
8
+
9
+ _import_structure = {"pipeline_ddpm": ["DDPMPipeline"]}
10
+
11
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
12
+ from .pipeline_ddpm import DDPMPipeline
13
+
14
+ else:
15
+ import sys
16
+
17
+ sys.modules[__name__] = _LazyModule(
18
+ __name__,
19
+ globals()["__file__"],
20
+ _import_structure,
21
+ module_spec=__spec__,
22
+ )
diffusers/pipelines/deepfloyd_if/__init__.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {
15
+ "timesteps": [
16
+ "fast27_timesteps",
17
+ "smart100_timesteps",
18
+ "smart185_timesteps",
19
+ "smart27_timesteps",
20
+ "smart50_timesteps",
21
+ "super100_timesteps",
22
+ "super27_timesteps",
23
+ "super40_timesteps",
24
+ ]
25
+ }
26
+
27
+ try:
28
+ if not (is_transformers_available() and is_torch_available()):
29
+ raise OptionalDependencyNotAvailable()
30
+ except OptionalDependencyNotAvailable:
31
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
32
+
33
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
34
+ else:
35
+ _import_structure["pipeline_if"] = ["IFPipeline"]
36
+ _import_structure["pipeline_if_img2img"] = ["IFImg2ImgPipeline"]
37
+ _import_structure["pipeline_if_img2img_superresolution"] = ["IFImg2ImgSuperResolutionPipeline"]
38
+ _import_structure["pipeline_if_inpainting"] = ["IFInpaintingPipeline"]
39
+ _import_structure["pipeline_if_inpainting_superresolution"] = ["IFInpaintingSuperResolutionPipeline"]
40
+ _import_structure["pipeline_if_superresolution"] = ["IFSuperResolutionPipeline"]
41
+ _import_structure["pipeline_output"] = ["IFPipelineOutput"]
42
+ _import_structure["safety_checker"] = ["IFSafetyChecker"]
43
+ _import_structure["watermark"] = ["IFWatermarker"]
44
+
45
+
46
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
47
+ try:
48
+ if not (is_transformers_available() and is_torch_available()):
49
+ raise OptionalDependencyNotAvailable()
50
+
51
+ except OptionalDependencyNotAvailable:
52
+ from ...utils.dummy_torch_and_transformers_objects import *
53
+ else:
54
+ from .pipeline_if import IFPipeline
55
+ from .pipeline_if_img2img import IFImg2ImgPipeline
56
+ from .pipeline_if_img2img_superresolution import IFImg2ImgSuperResolutionPipeline
57
+ from .pipeline_if_inpainting import IFInpaintingPipeline
58
+ from .pipeline_if_inpainting_superresolution import IFInpaintingSuperResolutionPipeline
59
+ from .pipeline_if_superresolution import IFSuperResolutionPipeline
60
+ from .pipeline_output import IFPipelineOutput
61
+ from .safety_checker import IFSafetyChecker
62
+ from .timesteps import (
63
+ fast27_timesteps,
64
+ smart27_timesteps,
65
+ smart50_timesteps,
66
+ smart100_timesteps,
67
+ smart185_timesteps,
68
+ super27_timesteps,
69
+ super40_timesteps,
70
+ super100_timesteps,
71
+ )
72
+ from .watermark import IFWatermarker
73
+
74
+ else:
75
+ import sys
76
+
77
+ sys.modules[__name__] = _LazyModule(
78
+ __name__,
79
+ globals()["__file__"],
80
+ _import_structure,
81
+ module_spec=__spec__,
82
+ )
83
+
84
+ for name, value in _dummy_objects.items():
85
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/__init__.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_librosa_available,
9
+ is_note_seq_available,
10
+ is_torch_available,
11
+ is_transformers_available,
12
+ )
13
+
14
+
15
+ _dummy_objects = {}
16
+ _import_structure = {}
17
+
18
+ try:
19
+ if not is_torch_available():
20
+ raise OptionalDependencyNotAvailable()
21
+ except OptionalDependencyNotAvailable:
22
+ from ...utils import dummy_pt_objects
23
+
24
+ _dummy_objects.update(get_objects_from_module(dummy_pt_objects))
25
+ else:
26
+ _import_structure["latent_diffusion_uncond"] = ["LDMPipeline"]
27
+ _import_structure["pndm"] = ["PNDMPipeline"]
28
+ _import_structure["repaint"] = ["RePaintPipeline"]
29
+ _import_structure["score_sde_ve"] = ["ScoreSdeVePipeline"]
30
+ _import_structure["stochastic_karras_ve"] = ["KarrasVePipeline"]
31
+
32
+ try:
33
+ if not (is_transformers_available() and is_torch_available()):
34
+ raise OptionalDependencyNotAvailable()
35
+ except OptionalDependencyNotAvailable:
36
+ from ...utils import dummy_torch_and_transformers_objects
37
+
38
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
39
+ else:
40
+ _import_structure["alt_diffusion"] = [
41
+ "AltDiffusionImg2ImgPipeline",
42
+ "AltDiffusionPipeline",
43
+ "AltDiffusionPipelineOutput",
44
+ ]
45
+ _import_structure["versatile_diffusion"] = [
46
+ "VersatileDiffusionDualGuidedPipeline",
47
+ "VersatileDiffusionImageVariationPipeline",
48
+ "VersatileDiffusionPipeline",
49
+ "VersatileDiffusionTextToImagePipeline",
50
+ ]
51
+ _import_structure["vq_diffusion"] = ["VQDiffusionPipeline"]
52
+ _import_structure["stable_diffusion_variants"] = [
53
+ "CycleDiffusionPipeline",
54
+ "StableDiffusionInpaintPipelineLegacy",
55
+ "StableDiffusionPix2PixZeroPipeline",
56
+ "StableDiffusionParadigmsPipeline",
57
+ "StableDiffusionModelEditingPipeline",
58
+ ]
59
+
60
+ try:
61
+ if not (is_torch_available() and is_librosa_available()):
62
+ raise OptionalDependencyNotAvailable()
63
+ except OptionalDependencyNotAvailable:
64
+ from ...utils import dummy_torch_and_librosa_objects # noqa F403
65
+
66
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_librosa_objects))
67
+
68
+ else:
69
+ _import_structure["audio_diffusion"] = ["AudioDiffusionPipeline", "Mel"]
70
+
71
+ try:
72
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
73
+ raise OptionalDependencyNotAvailable()
74
+ except OptionalDependencyNotAvailable:
75
+ from ...utils import dummy_transformers_and_torch_and_note_seq_objects # noqa F403
76
+
77
+ _dummy_objects.update(get_objects_from_module(dummy_transformers_and_torch_and_note_seq_objects))
78
+
79
+ else:
80
+ _import_structure["spectrogram_diffusion"] = ["MidiProcessor", "SpectrogramDiffusionPipeline"]
81
+
82
+
83
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
84
+ try:
85
+ if not is_torch_available():
86
+ raise OptionalDependencyNotAvailable()
87
+ except OptionalDependencyNotAvailable:
88
+ from ...utils.dummy_pt_objects import *
89
+
90
+ else:
91
+ from .latent_diffusion_uncond import LDMPipeline
92
+ from .pndm import PNDMPipeline
93
+ from .repaint import RePaintPipeline
94
+ from .score_sde_ve import ScoreSdeVePipeline
95
+ from .stochastic_karras_ve import KarrasVePipeline
96
+
97
+ try:
98
+ if not (is_transformers_available() and is_torch_available()):
99
+ raise OptionalDependencyNotAvailable()
100
+ except OptionalDependencyNotAvailable:
101
+ from ...utils.dummy_torch_and_transformers_objects import *
102
+
103
+ else:
104
+ from .alt_diffusion import AltDiffusionImg2ImgPipeline, AltDiffusionPipeline, AltDiffusionPipelineOutput
105
+ from .audio_diffusion import AudioDiffusionPipeline, Mel
106
+ from .spectrogram_diffusion import SpectrogramDiffusionPipeline
107
+ from .stable_diffusion_variants import (
108
+ CycleDiffusionPipeline,
109
+ StableDiffusionInpaintPipelineLegacy,
110
+ StableDiffusionModelEditingPipeline,
111
+ StableDiffusionParadigmsPipeline,
112
+ StableDiffusionPix2PixZeroPipeline,
113
+ )
114
+ from .stochastic_karras_ve import KarrasVePipeline
115
+ from .versatile_diffusion import (
116
+ VersatileDiffusionDualGuidedPipeline,
117
+ VersatileDiffusionImageVariationPipeline,
118
+ VersatileDiffusionPipeline,
119
+ VersatileDiffusionTextToImagePipeline,
120
+ )
121
+ from .vq_diffusion import VQDiffusionPipeline
122
+
123
+ try:
124
+ if not (is_torch_available() and is_librosa_available()):
125
+ raise OptionalDependencyNotAvailable()
126
+ except OptionalDependencyNotAvailable:
127
+ from ...utils.dummy_torch_and_librosa_objects import *
128
+ else:
129
+ from .audio_diffusion import AudioDiffusionPipeline, Mel
130
+
131
+ try:
132
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
133
+ raise OptionalDependencyNotAvailable()
134
+ except OptionalDependencyNotAvailable:
135
+ from ...utils.dummy_transformers_and_torch_and_note_seq_objects import * # noqa F403
136
+ else:
137
+ from .spectrogram_diffusion import (
138
+ MidiProcessor,
139
+ SpectrogramDiffusionPipeline,
140
+ )
141
+
142
+
143
+ else:
144
+ import sys
145
+
146
+ sys.modules[__name__] = _LazyModule(
147
+ __name__,
148
+ globals()["__file__"],
149
+ _import_structure,
150
+ module_spec=__spec__,
151
+ )
152
+ for name, value in _dummy_objects.items():
153
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/alt_diffusion/__init__.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ....utils import dummy_torch_and_transformers_objects
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["modeling_roberta_series"] = ["RobertaSeriesModelWithTransformation"]
25
+ _import_structure["pipeline_alt_diffusion"] = ["AltDiffusionPipeline"]
26
+ _import_structure["pipeline_alt_diffusion_img2img"] = ["AltDiffusionImg2ImgPipeline"]
27
+
28
+ _import_structure["pipeline_output"] = ["AltDiffusionPipelineOutput"]
29
+
30
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
31
+ try:
32
+ if not (is_transformers_available() and is_torch_available()):
33
+ raise OptionalDependencyNotAvailable()
34
+ except OptionalDependencyNotAvailable:
35
+ from ....utils.dummy_torch_and_transformers_objects import *
36
+
37
+ else:
38
+ from .modeling_roberta_series import RobertaSeriesModelWithTransformation
39
+ from .pipeline_alt_diffusion import AltDiffusionPipeline
40
+ from .pipeline_alt_diffusion_img2img import AltDiffusionImg2ImgPipeline
41
+ from .pipeline_output import AltDiffusionPipelineOutput
42
+
43
+ else:
44
+ import sys
45
+
46
+ sys.modules[__name__] = _LazyModule(
47
+ __name__,
48
+ globals()["__file__"],
49
+ _import_structure,
50
+ module_spec=__spec__,
51
+ )
52
+ for name, value in _dummy_objects.items():
53
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/audio_diffusion/__init__.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {
7
+ "mel": ["Mel"],
8
+ "pipeline_audio_diffusion": ["AudioDiffusionPipeline"],
9
+ }
10
+
11
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
12
+ from .mel import Mel
13
+ from .pipeline_audio_diffusion import AudioDiffusionPipeline
14
+
15
+ else:
16
+ import sys
17
+
18
+ sys.modules[__name__] = _LazyModule(
19
+ __name__,
20
+ globals()["__file__"],
21
+ _import_structure,
22
+ module_spec=__spec__,
23
+ )
diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_latent_diffusion_uncond": ["LDMPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_latent_diffusion_uncond import LDMPipeline
10
+ else:
11
+ import sys
12
+
13
+ sys.modules[__name__] = _LazyModule(
14
+ __name__,
15
+ globals()["__file__"],
16
+ _import_structure,
17
+ module_spec=__spec__,
18
+ )
diffusers/pipelines/deprecated/pndm/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_pndm": ["PNDMPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_pndm import PNDMPipeline
10
+ else:
11
+ import sys
12
+
13
+ sys.modules[__name__] = _LazyModule(
14
+ __name__,
15
+ globals()["__file__"],
16
+ _import_structure,
17
+ module_spec=__spec__,
18
+ )
diffusers/pipelines/deprecated/repaint/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_repaint": ["RePaintPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_repaint import RePaintPipeline
10
+
11
+ else:
12
+ import sys
13
+
14
+ sys.modules[__name__] = _LazyModule(
15
+ __name__,
16
+ globals()["__file__"],
17
+ _import_structure,
18
+ module_spec=__spec__,
19
+ )
diffusers/pipelines/deprecated/score_sde_ve/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_score_sde_ve": ["ScoreSdeVePipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_score_sde_ve import ScoreSdeVePipeline
10
+
11
+ else:
12
+ import sys
13
+
14
+ sys.modules[__name__] = _LazyModule(
15
+ __name__,
16
+ globals()["__file__"],
17
+ _import_structure,
18
+ module_spec=__spec__,
19
+ )
diffusers/pipelines/deprecated/spectrogram_diffusion/__init__.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # flake8: noqa
2
+ from typing import TYPE_CHECKING
3
+ from ....utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ _LazyModule,
6
+ is_note_seq_available,
7
+ OptionalDependencyNotAvailable,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ get_objects_from_module,
11
+ )
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ....utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["continous_encoder"] = ["SpectrogramContEncoder"]
25
+ _import_structure["notes_encoder"] = ["SpectrogramNotesEncoder"]
26
+ _import_structure["pipeline_spectrogram_diffusion"] = [
27
+ "SpectrogramContEncoder",
28
+ "SpectrogramDiffusionPipeline",
29
+ "T5FilmDecoder",
30
+ ]
31
+ try:
32
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
33
+ raise OptionalDependencyNotAvailable()
34
+ except OptionalDependencyNotAvailable:
35
+ from ....utils import dummy_transformers_and_torch_and_note_seq_objects
36
+
37
+ _dummy_objects.update(get_objects_from_module(dummy_transformers_and_torch_and_note_seq_objects))
38
+ else:
39
+ _import_structure["midi_utils"] = ["MidiProcessor"]
40
+
41
+
42
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
43
+ try:
44
+ if not (is_transformers_available() and is_torch_available()):
45
+ raise OptionalDependencyNotAvailable()
46
+
47
+ except OptionalDependencyNotAvailable:
48
+ from ....utils.dummy_torch_and_transformers_objects import *
49
+ else:
50
+ from .pipeline_spectrogram_diffusion import SpectrogramDiffusionPipeline
51
+ from .pipeline_spectrogram_diffusion import SpectrogramContEncoder
52
+ from .pipeline_spectrogram_diffusion import SpectrogramNotesEncoder
53
+ from .pipeline_spectrogram_diffusion import T5FilmDecoder
54
+
55
+ try:
56
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
57
+ raise OptionalDependencyNotAvailable()
58
+ except OptionalDependencyNotAvailable:
59
+ from ....utils.dummy_transformers_and_torch_and_note_seq_objects import *
60
+
61
+ else:
62
+ from .midi_utils import MidiProcessor
63
+
64
+ else:
65
+ import sys
66
+
67
+ sys.modules[__name__] = _LazyModule(
68
+ __name__,
69
+ globals()["__file__"],
70
+ _import_structure,
71
+ module_spec=__spec__,
72
+ )
73
+
74
+ for name, value in _dummy_objects.items():
75
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/stable_diffusion_variants/__init__.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ....utils import dummy_torch_and_transformers_objects
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_cycle_diffusion"] = ["CycleDiffusionPipeline"]
25
+ _import_structure["pipeline_stable_diffusion_inpaint_legacy"] = ["StableDiffusionInpaintPipelineLegacy"]
26
+ _import_structure["pipeline_stable_diffusion_model_editing"] = ["StableDiffusionModelEditingPipeline"]
27
+
28
+ _import_structure["pipeline_stable_diffusion_paradigms"] = ["StableDiffusionParadigmsPipeline"]
29
+ _import_structure["pipeline_stable_diffusion_pix2pix_zero"] = ["StableDiffusionPix2PixZeroPipeline"]
30
+
31
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
32
+ try:
33
+ if not (is_transformers_available() and is_torch_available()):
34
+ raise OptionalDependencyNotAvailable()
35
+ except OptionalDependencyNotAvailable:
36
+ from ....utils.dummy_torch_and_transformers_objects import *
37
+
38
+ else:
39
+ from .pipeline_cycle_diffusion import CycleDiffusionPipeline
40
+ from .pipeline_stable_diffusion_inpaint_legacy import StableDiffusionInpaintPipelineLegacy
41
+ from .pipeline_stable_diffusion_model_editing import StableDiffusionModelEditingPipeline
42
+ from .pipeline_stable_diffusion_paradigms import StableDiffusionParadigmsPipeline
43
+ from .pipeline_stable_diffusion_pix2pix_zero import StableDiffusionPix2PixZeroPipeline
44
+
45
+ else:
46
+ import sys
47
+
48
+ sys.modules[__name__] = _LazyModule(
49
+ __name__,
50
+ globals()["__file__"],
51
+ _import_structure,
52
+ module_spec=__spec__,
53
+ )
54
+ for name, value in _dummy_objects.items():
55
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/stochastic_karras_ve/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_stochastic_karras_ve": ["KarrasVePipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_stochastic_karras_ve import KarrasVePipeline
10
+
11
+ else:
12
+ import sys
13
+
14
+ sys.modules[__name__] = _LazyModule(
15
+ __name__,
16
+ globals()["__file__"],
17
+ _import_structure,
18
+ module_spec=__spec__,
19
+ )
diffusers/pipelines/deprecated/versatile_diffusion/__init__.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ is_torch_available,
8
+ is_transformers_available,
9
+ is_transformers_version,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ....utils.dummy_torch_and_transformers_objects import (
21
+ VersatileDiffusionDualGuidedPipeline,
22
+ VersatileDiffusionImageVariationPipeline,
23
+ VersatileDiffusionPipeline,
24
+ VersatileDiffusionTextToImagePipeline,
25
+ )
26
+
27
+ _dummy_objects.update(
28
+ {
29
+ "VersatileDiffusionDualGuidedPipeline": VersatileDiffusionDualGuidedPipeline,
30
+ "VersatileDiffusionImageVariationPipeline": VersatileDiffusionImageVariationPipeline,
31
+ "VersatileDiffusionPipeline": VersatileDiffusionPipeline,
32
+ "VersatileDiffusionTextToImagePipeline": VersatileDiffusionTextToImagePipeline,
33
+ }
34
+ )
35
+ else:
36
+ _import_structure["modeling_text_unet"] = ["UNetFlatConditionModel"]
37
+ _import_structure["pipeline_versatile_diffusion"] = ["VersatileDiffusionPipeline"]
38
+ _import_structure["pipeline_versatile_diffusion_dual_guided"] = ["VersatileDiffusionDualGuidedPipeline"]
39
+ _import_structure["pipeline_versatile_diffusion_image_variation"] = ["VersatileDiffusionImageVariationPipeline"]
40
+ _import_structure["pipeline_versatile_diffusion_text_to_image"] = ["VersatileDiffusionTextToImagePipeline"]
41
+
42
+
43
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
44
+ try:
45
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
46
+ raise OptionalDependencyNotAvailable()
47
+ except OptionalDependencyNotAvailable:
48
+ from ....utils.dummy_torch_and_transformers_objects import (
49
+ VersatileDiffusionDualGuidedPipeline,
50
+ VersatileDiffusionImageVariationPipeline,
51
+ VersatileDiffusionPipeline,
52
+ VersatileDiffusionTextToImagePipeline,
53
+ )
54
+ else:
55
+ from .pipeline_versatile_diffusion import VersatileDiffusionPipeline
56
+ from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline
57
+ from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline
58
+ from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline
59
+
60
+ else:
61
+ import sys
62
+
63
+ sys.modules[__name__] = _LazyModule(
64
+ __name__,
65
+ globals()["__file__"],
66
+ _import_structure,
67
+ module_spec=__spec__,
68
+ )
69
+
70
+ for name, value in _dummy_objects.items():
71
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/deprecated/vq_diffusion/__init__.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ....utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ is_torch_available,
8
+ is_transformers_available,
9
+ )
10
+
11
+
12
+ _dummy_objects = {}
13
+ _import_structure = {}
14
+
15
+ try:
16
+ if not (is_transformers_available() and is_torch_available()):
17
+ raise OptionalDependencyNotAvailable()
18
+ except OptionalDependencyNotAvailable:
19
+ from ....utils.dummy_torch_and_transformers_objects import (
20
+ LearnedClassifierFreeSamplingEmbeddings,
21
+ VQDiffusionPipeline,
22
+ )
23
+
24
+ _dummy_objects.update(
25
+ {
26
+ "LearnedClassifierFreeSamplingEmbeddings": LearnedClassifierFreeSamplingEmbeddings,
27
+ "VQDiffusionPipeline": VQDiffusionPipeline,
28
+ }
29
+ )
30
+ else:
31
+ _import_structure["pipeline_vq_diffusion"] = ["LearnedClassifierFreeSamplingEmbeddings", "VQDiffusionPipeline"]
32
+
33
+
34
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
35
+ try:
36
+ if not (is_transformers_available() and is_torch_available()):
37
+ raise OptionalDependencyNotAvailable()
38
+ except OptionalDependencyNotAvailable:
39
+ from ....utils.dummy_torch_and_transformers_objects import (
40
+ LearnedClassifierFreeSamplingEmbeddings,
41
+ VQDiffusionPipeline,
42
+ )
43
+ else:
44
+ from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
45
+
46
+ else:
47
+ import sys
48
+
49
+ sys.modules[__name__] = _LazyModule(
50
+ __name__,
51
+ globals()["__file__"],
52
+ _import_structure,
53
+ module_spec=__spec__,
54
+ )
55
+
56
+ for name, value in _dummy_objects.items():
57
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/dit/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule
4
+
5
+
6
+ _import_structure = {"pipeline_dit": ["DiTPipeline"]}
7
+
8
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
9
+ from .pipeline_dit import DiTPipeline
10
+
11
+ else:
12
+ import sys
13
+
14
+ sys.modules[__name__] = _LazyModule(
15
+ __name__,
16
+ globals()["__file__"],
17
+ _import_structure,
18
+ module_spec=__spec__,
19
+ )
diffusers/pipelines/i2vgen_xl/__init__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_i2vgen_xl"] = ["I2VGenXLPipeline"]
25
+
26
+
27
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
28
+ try:
29
+ if not (is_transformers_available() and is_torch_available()):
30
+ raise OptionalDependencyNotAvailable()
31
+ except OptionalDependencyNotAvailable:
32
+ from ...utils.dummy_torch_and_transformers_objects import * # noqa F403
33
+ else:
34
+ from .pipeline_i2vgen_xl import I2VGenXLPipeline
35
+
36
+ else:
37
+ import sys
38
+
39
+ sys.modules[__name__] = _LazyModule(
40
+ __name__,
41
+ globals()["__file__"],
42
+ _import_structure,
43
+ module_spec=__spec__,
44
+ )
45
+ for name, value in _dummy_objects.items():
46
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/kandinsky/__init__.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_kandinsky"] = ["KandinskyPipeline"]
25
+ _import_structure["pipeline_kandinsky_combined"] = [
26
+ "KandinskyCombinedPipeline",
27
+ "KandinskyImg2ImgCombinedPipeline",
28
+ "KandinskyInpaintCombinedPipeline",
29
+ ]
30
+ _import_structure["pipeline_kandinsky_img2img"] = ["KandinskyImg2ImgPipeline"]
31
+ _import_structure["pipeline_kandinsky_inpaint"] = ["KandinskyInpaintPipeline"]
32
+ _import_structure["pipeline_kandinsky_prior"] = ["KandinskyPriorPipeline", "KandinskyPriorPipelineOutput"]
33
+ _import_structure["text_encoder"] = ["MultilingualCLIP"]
34
+
35
+
36
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
37
+ try:
38
+ if not (is_transformers_available() and is_torch_available()):
39
+ raise OptionalDependencyNotAvailable()
40
+ except OptionalDependencyNotAvailable:
41
+ from ...utils.dummy_torch_and_transformers_objects import *
42
+
43
+ else:
44
+ from .pipeline_kandinsky import KandinskyPipeline
45
+ from .pipeline_kandinsky_combined import (
46
+ KandinskyCombinedPipeline,
47
+ KandinskyImg2ImgCombinedPipeline,
48
+ KandinskyInpaintCombinedPipeline,
49
+ )
50
+ from .pipeline_kandinsky_img2img import KandinskyImg2ImgPipeline
51
+ from .pipeline_kandinsky_inpaint import KandinskyInpaintPipeline
52
+ from .pipeline_kandinsky_prior import KandinskyPriorPipeline, KandinskyPriorPipelineOutput
53
+ from .text_encoder import MultilingualCLIP
54
+
55
+ else:
56
+ import sys
57
+
58
+ sys.modules[__name__] = _LazyModule(
59
+ __name__,
60
+ globals()["__file__"],
61
+ _import_structure,
62
+ module_spec=__spec__,
63
+ )
64
+
65
+ for name, value in _dummy_objects.items():
66
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/kandinsky2_2/__init__.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_kandinsky2_2"] = ["KandinskyV22Pipeline"]
25
+ _import_structure["pipeline_kandinsky2_2_combined"] = [
26
+ "KandinskyV22CombinedPipeline",
27
+ "KandinskyV22Img2ImgCombinedPipeline",
28
+ "KandinskyV22InpaintCombinedPipeline",
29
+ ]
30
+ _import_structure["pipeline_kandinsky2_2_controlnet"] = ["KandinskyV22ControlnetPipeline"]
31
+ _import_structure["pipeline_kandinsky2_2_controlnet_img2img"] = ["KandinskyV22ControlnetImg2ImgPipeline"]
32
+ _import_structure["pipeline_kandinsky2_2_img2img"] = ["KandinskyV22Img2ImgPipeline"]
33
+ _import_structure["pipeline_kandinsky2_2_inpainting"] = ["KandinskyV22InpaintPipeline"]
34
+ _import_structure["pipeline_kandinsky2_2_prior"] = ["KandinskyV22PriorPipeline"]
35
+ _import_structure["pipeline_kandinsky2_2_prior_emb2emb"] = ["KandinskyV22PriorEmb2EmbPipeline"]
36
+
37
+
38
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
39
+ try:
40
+ if not (is_transformers_available() and is_torch_available()):
41
+ raise OptionalDependencyNotAvailable()
42
+
43
+ except OptionalDependencyNotAvailable:
44
+ from ...utils.dummy_torch_and_transformers_objects import *
45
+ else:
46
+ from .pipeline_kandinsky2_2 import KandinskyV22Pipeline
47
+ from .pipeline_kandinsky2_2_combined import (
48
+ KandinskyV22CombinedPipeline,
49
+ KandinskyV22Img2ImgCombinedPipeline,
50
+ KandinskyV22InpaintCombinedPipeline,
51
+ )
52
+ from .pipeline_kandinsky2_2_controlnet import KandinskyV22ControlnetPipeline
53
+ from .pipeline_kandinsky2_2_controlnet_img2img import KandinskyV22ControlnetImg2ImgPipeline
54
+ from .pipeline_kandinsky2_2_img2img import KandinskyV22Img2ImgPipeline
55
+ from .pipeline_kandinsky2_2_inpainting import KandinskyV22InpaintPipeline
56
+ from .pipeline_kandinsky2_2_prior import KandinskyV22PriorPipeline
57
+ from .pipeline_kandinsky2_2_prior_emb2emb import KandinskyV22PriorEmb2EmbPipeline
58
+
59
+ else:
60
+ import sys
61
+
62
+ sys.modules[__name__] = _LazyModule(
63
+ __name__,
64
+ globals()["__file__"],
65
+ _import_structure,
66
+ module_spec=__spec__,
67
+ )
68
+
69
+ for name, value in _dummy_objects.items():
70
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/kandinsky3/__init__.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_kandinsky3"] = ["Kandinsky3Pipeline"]
25
+ _import_structure["pipeline_kandinsky3_img2img"] = ["Kandinsky3Img2ImgPipeline"]
26
+
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available()):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_kandinsky3 import Kandinsky3Pipeline
37
+ from .pipeline_kandinsky3_img2img import Kandinsky3Img2ImgPipeline
38
+ else:
39
+ import sys
40
+
41
+ sys.modules[__name__] = _LazyModule(
42
+ __name__,
43
+ globals()["__file__"],
44
+ _import_structure,
45
+ module_spec=__spec__,
46
+ )
47
+
48
+ for name, value in _dummy_objects.items():
49
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/latent_consistency_models/__init__.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available()):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["pipeline_latent_consistency_img2img"] = ["LatentConsistencyModelImg2ImgPipeline"]
26
+ _import_structure["pipeline_latent_consistency_text2img"] = ["LatentConsistencyModelPipeline"]
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available()):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_latent_consistency_img2img import LatentConsistencyModelImg2ImgPipeline
37
+ from .pipeline_latent_consistency_text2img import LatentConsistencyModelPipeline
38
+
39
+ else:
40
+ import sys
41
+
42
+ sys.modules[__name__] = _LazyModule(
43
+ __name__,
44
+ globals()["__file__"],
45
+ _import_structure,
46
+ module_spec=__spec__,
47
+ )
48
+
49
+ for name, value in _dummy_objects.items():
50
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/latent_diffusion/__init__.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_latent_diffusion"] = ["LDMBertModel", "LDMTextToImagePipeline"]
25
+ _import_structure["pipeline_latent_diffusion_superresolution"] = ["LDMSuperResolutionPipeline"]
26
+
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available()):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline
37
+ from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline
38
+
39
+ else:
40
+ import sys
41
+
42
+ sys.modules[__name__] = _LazyModule(
43
+ __name__,
44
+ globals()["__file__"],
45
+ _import_structure,
46
+ module_spec=__spec__,
47
+ )
48
+
49
+ for name, value in _dummy_objects.items():
50
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/ledits_pp/__init__.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_leditspp_stable_diffusion"] = ["LEditsPPPipelineStableDiffusion"]
25
+ _import_structure["pipeline_leditspp_stable_diffusion_xl"] = ["LEditsPPPipelineStableDiffusionXL"]
26
+
27
+ _import_structure["pipeline_output"] = ["LEditsPPDiffusionPipelineOutput", "LEditsPPDiffusionPipelineOutput"]
28
+
29
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
30
+ try:
31
+ if not (is_transformers_available() and is_torch_available()):
32
+ raise OptionalDependencyNotAvailable()
33
+
34
+ except OptionalDependencyNotAvailable:
35
+ from ...utils.dummy_torch_and_transformers_objects import *
36
+ else:
37
+ from .pipeline_leditspp_stable_diffusion import (
38
+ LEditsPPDiffusionPipelineOutput,
39
+ LEditsPPInversionPipelineOutput,
40
+ LEditsPPPipelineStableDiffusion,
41
+ )
42
+ from .pipeline_leditspp_stable_diffusion_xl import LEditsPPPipelineStableDiffusionXL
43
+
44
+ else:
45
+ import sys
46
+
47
+ sys.modules[__name__] = _LazyModule(
48
+ __name__,
49
+ globals()["__file__"],
50
+ _import_structure,
51
+ module_spec=__spec__,
52
+ )
53
+
54
+ for name, value in _dummy_objects.items():
55
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/musicldm/__init__.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ is_transformers_version,
11
+ )
12
+
13
+
14
+ _dummy_objects = {}
15
+ _import_structure = {}
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["pipeline_musicldm"] = ["MusicLDMPipeline"]
26
+
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_musicldm import MusicLDMPipeline
37
+
38
+ else:
39
+ import sys
40
+
41
+ sys.modules[__name__] = _LazyModule(
42
+ __name__,
43
+ globals()["__file__"],
44
+ _import_structure,
45
+ module_spec=__spec__,
46
+ )
47
+
48
+ for name, value in _dummy_objects.items():
49
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/paint_by_example/__init__.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from typing import TYPE_CHECKING, List, Optional, Union
3
+
4
+ import numpy as np
5
+ import PIL
6
+ from PIL import Image
7
+
8
+ from ...utils import (
9
+ DIFFUSERS_SLOW_IMPORT,
10
+ OptionalDependencyNotAvailable,
11
+ _LazyModule,
12
+ get_objects_from_module,
13
+ is_torch_available,
14
+ is_transformers_available,
15
+ )
16
+
17
+
18
+ _dummy_objects = {}
19
+ _import_structure = {}
20
+
21
+ try:
22
+ if not (is_transformers_available() and is_torch_available()):
23
+ raise OptionalDependencyNotAvailable()
24
+ except OptionalDependencyNotAvailable:
25
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
26
+
27
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
28
+ else:
29
+ _import_structure["image_encoder"] = ["PaintByExampleImageEncoder"]
30
+ _import_structure["pipeline_paint_by_example"] = ["PaintByExamplePipeline"]
31
+
32
+
33
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
34
+ try:
35
+ if not (is_transformers_available() and is_torch_available()):
36
+ raise OptionalDependencyNotAvailable()
37
+
38
+ except OptionalDependencyNotAvailable:
39
+ from ...utils.dummy_torch_and_transformers_objects import *
40
+ else:
41
+ from .image_encoder import PaintByExampleImageEncoder
42
+ from .pipeline_paint_by_example import PaintByExamplePipeline
43
+
44
+ else:
45
+ import sys
46
+
47
+ sys.modules[__name__] = _LazyModule(
48
+ __name__,
49
+ globals()["__file__"],
50
+ _import_structure,
51
+ module_spec=__spec__,
52
+ )
53
+
54
+ for name, value in _dummy_objects.items():
55
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/pia/__init__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_pia"] = ["PIAPipeline", "PIAPipelineOutput"]
25
+
26
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
27
+ try:
28
+ if not (is_transformers_available() and is_torch_available()):
29
+ raise OptionalDependencyNotAvailable()
30
+ except OptionalDependencyNotAvailable:
31
+ from ...utils.dummy_torch_and_transformers_objects import *
32
+
33
+ else:
34
+ from .pipeline_pia import PIAPipeline, PIAPipelineOutput
35
+
36
+ else:
37
+ import sys
38
+
39
+ sys.modules[__name__] = _LazyModule(
40
+ __name__,
41
+ globals()["__file__"],
42
+ _import_structure,
43
+ module_spec=__spec__,
44
+ )
45
+ for name, value in _dummy_objects.items():
46
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/pixart_alpha/__init__.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+
17
+ try:
18
+ if not (is_transformers_available() and is_torch_available()):
19
+ raise OptionalDependencyNotAvailable()
20
+ except OptionalDependencyNotAvailable:
21
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
22
+
23
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24
+ else:
25
+ _import_structure["pipeline_pixart_alpha"] = ["PixArtAlphaPipeline"]
26
+ _import_structure["pipeline_pixart_sigma"] = ["PixArtSigmaPipeline"]
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available()):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_pixart_alpha import (
37
+ ASPECT_RATIO_256_BIN,
38
+ ASPECT_RATIO_512_BIN,
39
+ ASPECT_RATIO_1024_BIN,
40
+ PixArtAlphaPipeline,
41
+ )
42
+ from .pipeline_pixart_sigma import ASPECT_RATIO_2048_BIN, PixArtSigmaPipeline
43
+
44
+ else:
45
+ import sys
46
+
47
+ sys.modules[__name__] = _LazyModule(
48
+ __name__,
49
+ globals()["__file__"],
50
+ _import_structure,
51
+ module_spec=__spec__,
52
+ )
53
+
54
+ for name, value in _dummy_objects.items():
55
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/semantic_stable_diffusion/__init__.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_output"] = ["SemanticStableDiffusionPipelineOutput"]
25
+ _import_structure["pipeline_semantic_stable_diffusion"] = ["SemanticStableDiffusionPipeline"]
26
+
27
+
28
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
29
+ try:
30
+ if not (is_transformers_available() and is_torch_available()):
31
+ raise OptionalDependencyNotAvailable()
32
+
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import *
35
+ else:
36
+ from .pipeline_semantic_stable_diffusion import SemanticStableDiffusionPipeline
37
+
38
+ else:
39
+ import sys
40
+
41
+ sys.modules[__name__] = _LazyModule(
42
+ __name__,
43
+ globals()["__file__"],
44
+ _import_structure,
45
+ module_spec=__spec__,
46
+ )
47
+
48
+ for name, value in _dummy_objects.items():
49
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/shap_e/__init__.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["camera"] = ["create_pan_cameras"]
25
+ _import_structure["pipeline_shap_e"] = ["ShapEPipeline"]
26
+ _import_structure["pipeline_shap_e_img2img"] = ["ShapEImg2ImgPipeline"]
27
+ _import_structure["renderer"] = [
28
+ "BoundingBoxVolume",
29
+ "ImportanceRaySampler",
30
+ "MLPNeRFModelOutput",
31
+ "MLPNeRSTFModel",
32
+ "ShapEParamsProjModel",
33
+ "ShapERenderer",
34
+ "StratifiedRaySampler",
35
+ "VoidNeRFModel",
36
+ ]
37
+
38
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
39
+ try:
40
+ if not (is_transformers_available() and is_torch_available()):
41
+ raise OptionalDependencyNotAvailable()
42
+
43
+ except OptionalDependencyNotAvailable:
44
+ from ...utils.dummy_torch_and_transformers_objects import *
45
+ else:
46
+ from .camera import create_pan_cameras
47
+ from .pipeline_shap_e import ShapEPipeline
48
+ from .pipeline_shap_e_img2img import ShapEImg2ImgPipeline
49
+ from .renderer import (
50
+ BoundingBoxVolume,
51
+ ImportanceRaySampler,
52
+ MLPNeRFModelOutput,
53
+ MLPNeRSTFModel,
54
+ ShapEParamsProjModel,
55
+ ShapERenderer,
56
+ StratifiedRaySampler,
57
+ VoidNeRFModel,
58
+ )
59
+
60
+ else:
61
+ import sys
62
+
63
+ sys.modules[__name__] = _LazyModule(
64
+ __name__,
65
+ globals()["__file__"],
66
+ _import_structure,
67
+ module_spec=__spec__,
68
+ )
69
+
70
+ for name, value in _dummy_objects.items():
71
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/stable_cascade/__init__.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_torch_available,
9
+ is_transformers_available,
10
+ )
11
+
12
+
13
+ _dummy_objects = {}
14
+ _import_structure = {}
15
+
16
+ try:
17
+ if not (is_transformers_available() and is_torch_available()):
18
+ raise OptionalDependencyNotAvailable()
19
+ except OptionalDependencyNotAvailable:
20
+ from ...utils import dummy_torch_and_transformers_objects
21
+
22
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23
+ else:
24
+ _import_structure["pipeline_stable_cascade"] = ["StableCascadeDecoderPipeline"]
25
+ _import_structure["pipeline_stable_cascade_combined"] = ["StableCascadeCombinedPipeline"]
26
+ _import_structure["pipeline_stable_cascade_prior"] = ["StableCascadePriorPipeline"]
27
+
28
+
29
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
30
+ try:
31
+ if not (is_transformers_available() and is_torch_available()):
32
+ raise OptionalDependencyNotAvailable()
33
+ except OptionalDependencyNotAvailable:
34
+ from ...utils.dummy_torch_and_transformers_objects import * # noqa F403
35
+ else:
36
+ from .pipeline_stable_cascade import StableCascadeDecoderPipeline
37
+ from .pipeline_stable_cascade_combined import StableCascadeCombinedPipeline
38
+ from .pipeline_stable_cascade_prior import StableCascadePriorPipeline
39
+ else:
40
+ import sys
41
+
42
+ sys.modules[__name__] = _LazyModule(
43
+ __name__,
44
+ globals()["__file__"],
45
+ _import_structure,
46
+ module_spec=__spec__,
47
+ )
48
+
49
+ for name, value in _dummy_objects.items():
50
+ setattr(sys.modules[__name__], name, value)
diffusers/pipelines/stable_diffusion/__init__.py ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import TYPE_CHECKING
2
+
3
+ from ...utils import (
4
+ DIFFUSERS_SLOW_IMPORT,
5
+ OptionalDependencyNotAvailable,
6
+ _LazyModule,
7
+ get_objects_from_module,
8
+ is_flax_available,
9
+ is_k_diffusion_available,
10
+ is_k_diffusion_version,
11
+ is_onnx_available,
12
+ is_torch_available,
13
+ is_transformers_available,
14
+ is_transformers_version,
15
+ )
16
+
17
+
18
+ _dummy_objects = {}
19
+ _additional_imports = {}
20
+ _import_structure = {"pipeline_output": ["StableDiffusionPipelineOutput"]}
21
+
22
+ if is_transformers_available() and is_flax_available():
23
+ _import_structure["pipeline_output"].extend(["FlaxStableDiffusionPipelineOutput"])
24
+ try:
25
+ if not (is_transformers_available() and is_torch_available()):
26
+ raise OptionalDependencyNotAvailable()
27
+ except OptionalDependencyNotAvailable:
28
+ from ...utils import dummy_torch_and_transformers_objects # noqa F403
29
+
30
+ _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
31
+ else:
32
+ _import_structure["clip_image_project_model"] = ["CLIPImageProjection"]
33
+ _import_structure["pipeline_cycle_diffusion"] = ["CycleDiffusionPipeline"]
34
+ _import_structure["pipeline_stable_diffusion"] = ["StableDiffusionPipeline"]
35
+ _import_structure["pipeline_stable_diffusion_attend_and_excite"] = ["StableDiffusionAttendAndExcitePipeline"]
36
+ _import_structure["pipeline_stable_diffusion_gligen"] = ["StableDiffusionGLIGENPipeline"]
37
+ _import_structure["pipeline_stable_diffusion_gligen_text_image"] = ["StableDiffusionGLIGENTextImagePipeline"]
38
+ _import_structure["pipeline_stable_diffusion_img2img"] = ["StableDiffusionImg2ImgPipeline"]
39
+ _import_structure["pipeline_stable_diffusion_inpaint"] = ["StableDiffusionInpaintPipeline"]
40
+ _import_structure["pipeline_stable_diffusion_inpaint_legacy"] = ["StableDiffusionInpaintPipelineLegacy"]
41
+ _import_structure["pipeline_stable_diffusion_instruct_pix2pix"] = ["StableDiffusionInstructPix2PixPipeline"]
42
+ _import_structure["pipeline_stable_diffusion_latent_upscale"] = ["StableDiffusionLatentUpscalePipeline"]
43
+ _import_structure["pipeline_stable_diffusion_model_editing"] = ["StableDiffusionModelEditingPipeline"]
44
+ _import_structure["pipeline_stable_diffusion_paradigms"] = ["StableDiffusionParadigmsPipeline"]
45
+ _import_structure["pipeline_stable_diffusion_upscale"] = ["StableDiffusionUpscalePipeline"]
46
+ _import_structure["pipeline_stable_unclip"] = ["StableUnCLIPPipeline"]
47
+ _import_structure["pipeline_stable_unclip_img2img"] = ["StableUnCLIPImg2ImgPipeline"]
48
+ _import_structure["safety_checker"] = ["StableDiffusionSafetyChecker"]
49
+ _import_structure["stable_unclip_image_normalizer"] = ["StableUnCLIPImageNormalizer"]
50
+ try:
51
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
52
+ raise OptionalDependencyNotAvailable()
53
+ except OptionalDependencyNotAvailable:
54
+ from ...utils.dummy_torch_and_transformers_objects import (
55
+ StableDiffusionImageVariationPipeline,
56
+ )
57
+
58
+ _dummy_objects.update({"StableDiffusionImageVariationPipeline": StableDiffusionImageVariationPipeline})
59
+ else:
60
+ _import_structure["pipeline_stable_diffusion_image_variation"] = ["StableDiffusionImageVariationPipeline"]
61
+ try:
62
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.26.0")):
63
+ raise OptionalDependencyNotAvailable()
64
+ except OptionalDependencyNotAvailable:
65
+ from ...utils.dummy_torch_and_transformers_objects import (
66
+ StableDiffusionDepth2ImgPipeline,
67
+ )
68
+
69
+ _dummy_objects.update(
70
+ {
71
+ "StableDiffusionDepth2ImgPipeline": StableDiffusionDepth2ImgPipeline,
72
+ }
73
+ )
74
+ else:
75
+ _import_structure["pipeline_stable_diffusion_depth2img"] = ["StableDiffusionDepth2ImgPipeline"]
76
+
77
+ try:
78
+ if not (is_transformers_available() and is_onnx_available()):
79
+ raise OptionalDependencyNotAvailable()
80
+ except OptionalDependencyNotAvailable:
81
+ from ...utils import dummy_onnx_objects # noqa F403
82
+
83
+ _dummy_objects.update(get_objects_from_module(dummy_onnx_objects))
84
+ else:
85
+ _import_structure["pipeline_onnx_stable_diffusion"] = [
86
+ "OnnxStableDiffusionPipeline",
87
+ "StableDiffusionOnnxPipeline",
88
+ ]
89
+ _import_structure["pipeline_onnx_stable_diffusion_img2img"] = ["OnnxStableDiffusionImg2ImgPipeline"]
90
+ _import_structure["pipeline_onnx_stable_diffusion_inpaint"] = ["OnnxStableDiffusionInpaintPipeline"]
91
+ _import_structure["pipeline_onnx_stable_diffusion_inpaint_legacy"] = ["OnnxStableDiffusionInpaintPipelineLegacy"]
92
+ _import_structure["pipeline_onnx_stable_diffusion_upscale"] = ["OnnxStableDiffusionUpscalePipeline"]
93
+
94
+ if is_transformers_available() and is_flax_available():
95
+ from ...schedulers.scheduling_pndm_flax import PNDMSchedulerState
96
+
97
+ _additional_imports.update({"PNDMSchedulerState": PNDMSchedulerState})
98
+ _import_structure["pipeline_flax_stable_diffusion"] = ["FlaxStableDiffusionPipeline"]
99
+ _import_structure["pipeline_flax_stable_diffusion_img2img"] = ["FlaxStableDiffusionImg2ImgPipeline"]
100
+ _import_structure["pipeline_flax_stable_diffusion_inpaint"] = ["FlaxStableDiffusionInpaintPipeline"]
101
+ _import_structure["safety_checker_flax"] = ["FlaxStableDiffusionSafetyChecker"]
102
+
103
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
104
+ try:
105
+ if not (is_transformers_available() and is_torch_available()):
106
+ raise OptionalDependencyNotAvailable()
107
+
108
+ except OptionalDependencyNotAvailable:
109
+ from ...utils.dummy_torch_and_transformers_objects import *
110
+
111
+ else:
112
+ from .clip_image_project_model import CLIPImageProjection
113
+ from .pipeline_stable_diffusion import (
114
+ StableDiffusionPipeline,
115
+ StableDiffusionPipelineOutput,
116
+ StableDiffusionSafetyChecker,
117
+ )
118
+ from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline
119
+ from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline
120
+ from .pipeline_stable_diffusion_instruct_pix2pix import (
121
+ StableDiffusionInstructPix2PixPipeline,
122
+ )
123
+ from .pipeline_stable_diffusion_latent_upscale import (
124
+ StableDiffusionLatentUpscalePipeline,
125
+ )
126
+ from .pipeline_stable_diffusion_upscale import StableDiffusionUpscalePipeline
127
+ from .pipeline_stable_unclip import StableUnCLIPPipeline
128
+ from .pipeline_stable_unclip_img2img import StableUnCLIPImg2ImgPipeline
129
+ from .safety_checker import StableDiffusionSafetyChecker
130
+ from .stable_unclip_image_normalizer import StableUnCLIPImageNormalizer
131
+
132
+ try:
133
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
134
+ raise OptionalDependencyNotAvailable()
135
+ except OptionalDependencyNotAvailable:
136
+ from ...utils.dummy_torch_and_transformers_objects import (
137
+ StableDiffusionImageVariationPipeline,
138
+ )
139
+ else:
140
+ from .pipeline_stable_diffusion_image_variation import (
141
+ StableDiffusionImageVariationPipeline,
142
+ )
143
+
144
+ try:
145
+ if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.26.0")):
146
+ raise OptionalDependencyNotAvailable()
147
+ except OptionalDependencyNotAvailable:
148
+ from ...utils.dummy_torch_and_transformers_objects import StableDiffusionDepth2ImgPipeline
149
+ else:
150
+ from .pipeline_stable_diffusion_depth2img import (
151
+ StableDiffusionDepth2ImgPipeline,
152
+ )
153
+
154
+ try:
155
+ if not (is_transformers_available() and is_onnx_available()):
156
+ raise OptionalDependencyNotAvailable()
157
+ except OptionalDependencyNotAvailable:
158
+ from ...utils.dummy_onnx_objects import *
159
+ else:
160
+ from .pipeline_onnx_stable_diffusion import (
161
+ OnnxStableDiffusionPipeline,
162
+ StableDiffusionOnnxPipeline,
163
+ )
164
+ from .pipeline_onnx_stable_diffusion_img2img import (
165
+ OnnxStableDiffusionImg2ImgPipeline,
166
+ )
167
+ from .pipeline_onnx_stable_diffusion_inpaint import (
168
+ OnnxStableDiffusionInpaintPipeline,
169
+ )
170
+ from .pipeline_onnx_stable_diffusion_upscale import (
171
+ OnnxStableDiffusionUpscalePipeline,
172
+ )
173
+
174
+ try:
175
+ if not (is_transformers_available() and is_flax_available()):
176
+ raise OptionalDependencyNotAvailable()
177
+ except OptionalDependencyNotAvailable:
178
+ from ...utils.dummy_flax_objects import *
179
+ else:
180
+ from .pipeline_flax_stable_diffusion import FlaxStableDiffusionPipeline
181
+ from .pipeline_flax_stable_diffusion_img2img import (
182
+ FlaxStableDiffusionImg2ImgPipeline,
183
+ )
184
+ from .pipeline_flax_stable_diffusion_inpaint import (
185
+ FlaxStableDiffusionInpaintPipeline,
186
+ )
187
+ from .pipeline_output import FlaxStableDiffusionPipelineOutput
188
+ from .safety_checker_flax import FlaxStableDiffusionSafetyChecker
189
+
190
+ else:
191
+ import sys
192
+
193
+ sys.modules[__name__] = _LazyModule(
194
+ __name__,
195
+ globals()["__file__"],
196
+ _import_structure,
197
+ module_spec=__spec__,
198
+ )
199
+
200
+ for name, value in _dummy_objects.items():
201
+ setattr(sys.modules[__name__], name, value)
202
+ for name, value in _additional_imports.items():
203
+ setattr(sys.modules[__name__], name, value)