diffusers 0.24.0__py3-none-any.whl → 0.25.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- diffusers/__init__.py +11 -1
- diffusers/commands/fp16_safetensors.py +10 -11
- diffusers/configuration_utils.py +12 -8
- diffusers/dependency_versions_table.py +3 -2
- diffusers/experimental/rl/value_guided_sampling.py +1 -1
- diffusers/image_processor.py +286 -46
- diffusers/loaders/ip_adapter.py +11 -9
- diffusers/loaders/lora.py +198 -60
- diffusers/loaders/single_file.py +24 -18
- diffusers/loaders/textual_inversion.py +10 -14
- diffusers/loaders/unet.py +130 -37
- diffusers/models/__init__.py +18 -12
- diffusers/models/activations.py +9 -6
- diffusers/models/attention.py +137 -16
- diffusers/models/attention_processor.py +133 -46
- diffusers/models/autoencoders/__init__.py +5 -0
- diffusers/models/{autoencoder_asym_kl.py → autoencoders/autoencoder_asym_kl.py} +4 -4
- diffusers/models/{autoencoder_kl.py → autoencoders/autoencoder_kl.py} +45 -6
- diffusers/models/{autoencoder_kl_temporal_decoder.py → autoencoders/autoencoder_kl_temporal_decoder.py} +8 -8
- diffusers/models/{autoencoder_tiny.py → autoencoders/autoencoder_tiny.py} +4 -4
- diffusers/models/{consistency_decoder_vae.py → autoencoders/consistency_decoder_vae.py} +14 -14
- diffusers/models/{vae.py → autoencoders/vae.py} +9 -5
- diffusers/models/downsampling.py +338 -0
- diffusers/models/embeddings.py +112 -29
- diffusers/models/modeling_flax_utils.py +12 -7
- diffusers/models/modeling_utils.py +10 -10
- diffusers/models/normalization.py +108 -2
- diffusers/models/resnet.py +15 -699
- diffusers/models/transformer_2d.py +2 -2
- diffusers/models/unet_2d_condition.py +37 -0
- diffusers/models/{unet_kandi3.py → unet_kandinsky3.py} +105 -159
- diffusers/models/upsampling.py +454 -0
- diffusers/models/uvit_2d.py +471 -0
- diffusers/models/vq_model.py +9 -2
- diffusers/pipelines/__init__.py +81 -73
- diffusers/pipelines/amused/__init__.py +62 -0
- diffusers/pipelines/amused/pipeline_amused.py +328 -0
- diffusers/pipelines/amused/pipeline_amused_img2img.py +347 -0
- diffusers/pipelines/amused/pipeline_amused_inpaint.py +378 -0
- diffusers/pipelines/animatediff/pipeline_animatediff.py +38 -10
- diffusers/pipelines/auto_pipeline.py +17 -13
- diffusers/pipelines/controlnet/pipeline_controlnet.py +27 -10
- diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +47 -5
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +25 -8
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py +4 -6
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +26 -10
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +4 -3
- diffusers/pipelines/deprecated/__init__.py +153 -0
- diffusers/pipelines/{alt_diffusion → deprecated/alt_diffusion}/__init__.py +3 -3
- diffusers/pipelines/{alt_diffusion → deprecated/alt_diffusion}/pipeline_alt_diffusion.py +91 -18
- diffusers/pipelines/{alt_diffusion → deprecated/alt_diffusion}/pipeline_alt_diffusion_img2img.py +91 -18
- diffusers/pipelines/{alt_diffusion → deprecated/alt_diffusion}/pipeline_output.py +1 -1
- diffusers/pipelines/{audio_diffusion → deprecated/audio_diffusion}/__init__.py +1 -1
- diffusers/pipelines/{audio_diffusion → deprecated/audio_diffusion}/mel.py +2 -2
- diffusers/pipelines/{audio_diffusion → deprecated/audio_diffusion}/pipeline_audio_diffusion.py +4 -4
- diffusers/pipelines/{latent_diffusion_uncond → deprecated/latent_diffusion_uncond}/__init__.py +1 -1
- diffusers/pipelines/{latent_diffusion_uncond → deprecated/latent_diffusion_uncond}/pipeline_latent_diffusion_uncond.py +4 -4
- diffusers/pipelines/{pndm → deprecated/pndm}/__init__.py +1 -1
- diffusers/pipelines/{pndm → deprecated/pndm}/pipeline_pndm.py +4 -4
- diffusers/pipelines/{repaint → deprecated/repaint}/__init__.py +1 -1
- diffusers/pipelines/{repaint → deprecated/repaint}/pipeline_repaint.py +5 -5
- diffusers/pipelines/{score_sde_ve → deprecated/score_sde_ve}/__init__.py +1 -1
- diffusers/pipelines/{score_sde_ve → deprecated/score_sde_ve}/pipeline_score_sde_ve.py +4 -4
- diffusers/pipelines/{spectrogram_diffusion → deprecated/spectrogram_diffusion}/__init__.py +6 -6
- diffusers/pipelines/{spectrogram_diffusion/continous_encoder.py → deprecated/spectrogram_diffusion/continuous_encoder.py} +2 -2
- diffusers/pipelines/{spectrogram_diffusion → deprecated/spectrogram_diffusion}/midi_utils.py +1 -1
- diffusers/pipelines/{spectrogram_diffusion → deprecated/spectrogram_diffusion}/notes_encoder.py +2 -2
- diffusers/pipelines/{spectrogram_diffusion → deprecated/spectrogram_diffusion}/pipeline_spectrogram_diffusion.py +7 -7
- diffusers/pipelines/deprecated/stable_diffusion_variants/__init__.py +55 -0
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_cycle_diffusion.py +16 -11
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_onnx_stable_diffusion_inpaint_legacy.py +6 -6
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_stable_diffusion_inpaint_legacy.py +11 -11
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_stable_diffusion_model_editing.py +16 -11
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_stable_diffusion_paradigms.py +10 -10
- diffusers/pipelines/{stable_diffusion → deprecated/stable_diffusion_variants}/pipeline_stable_diffusion_pix2pix_zero.py +13 -13
- diffusers/pipelines/{stochastic_karras_ve → deprecated/stochastic_karras_ve}/__init__.py +1 -1
- diffusers/pipelines/{stochastic_karras_ve → deprecated/stochastic_karras_ve}/pipeline_stochastic_karras_ve.py +4 -4
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/__init__.py +3 -3
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/modeling_text_unet.py +54 -11
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/pipeline_versatile_diffusion.py +4 -4
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/pipeline_versatile_diffusion_dual_guided.py +6 -6
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/pipeline_versatile_diffusion_image_variation.py +6 -6
- diffusers/pipelines/{versatile_diffusion → deprecated/versatile_diffusion}/pipeline_versatile_diffusion_text_to_image.py +6 -6
- diffusers/pipelines/{vq_diffusion → deprecated/vq_diffusion}/__init__.py +3 -3
- diffusers/pipelines/{vq_diffusion → deprecated/vq_diffusion}/pipeline_vq_diffusion.py +5 -5
- diffusers/pipelines/kandinsky3/__init__.py +4 -4
- diffusers/pipelines/kandinsky3/convert_kandinsky3_unet.py +98 -0
- diffusers/pipelines/kandinsky3/{kandinsky3_pipeline.py → pipeline_kandinsky3.py} +172 -35
- diffusers/pipelines/kandinsky3/{kandinsky3img2img_pipeline.py → pipeline_kandinsky3_img2img.py} +228 -34
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +46 -5
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +47 -6
- diffusers/pipelines/onnx_utils.py +8 -5
- diffusers/pipelines/pipeline_flax_utils.py +7 -6
- diffusers/pipelines/pipeline_utils.py +32 -31
- diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +51 -2
- diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py +3 -3
- diffusers/pipelines/stable_diffusion/__init__.py +1 -72
- diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +67 -75
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +92 -8
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +92 -8
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +138 -10
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +57 -7
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +3 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +6 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +5 -0
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +5 -0
- diffusers/pipelines/stable_diffusion_attend_and_excite/__init__.py +48 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_attend_and_excite}/pipeline_stable_diffusion_attend_and_excite.py +5 -2
- diffusers/pipelines/stable_diffusion_diffedit/__init__.py +48 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_diffedit}/pipeline_stable_diffusion_diffedit.py +2 -3
- diffusers/pipelines/stable_diffusion_gligen/__init__.py +50 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_gligen}/pipeline_stable_diffusion_gligen.py +2 -2
- diffusers/pipelines/{stable_diffusion → stable_diffusion_gligen}/pipeline_stable_diffusion_gligen_text_image.py +3 -3
- diffusers/pipelines/stable_diffusion_k_diffusion/__init__.py +60 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_k_diffusion}/pipeline_stable_diffusion_k_diffusion.py +6 -1
- diffusers/pipelines/stable_diffusion_ldm3d/__init__.py +48 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_ldm3d}/pipeline_stable_diffusion_ldm3d.py +50 -7
- diffusers/pipelines/stable_diffusion_panorama/__init__.py +48 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_panorama}/pipeline_stable_diffusion_panorama.py +56 -8
- diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py +58 -6
- diffusers/pipelines/stable_diffusion_sag/__init__.py +48 -0
- diffusers/pipelines/{stable_diffusion → stable_diffusion_sag}/pipeline_stable_diffusion_sag.py +67 -10
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +97 -15
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +98 -14
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +97 -14
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py +7 -5
- diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py +12 -9
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_xl_adapter.py +6 -0
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +5 -0
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +5 -0
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +331 -9
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero_sdxl.py +468 -9
- diffusers/pipelines/unclip/pipeline_unclip.py +2 -1
- diffusers/pipelines/unclip/pipeline_unclip_image_variation.py +1 -0
- diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py +1 -1
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_prior.py +4 -0
- diffusers/schedulers/__init__.py +2 -0
- diffusers/schedulers/scheduling_amused.py +162 -0
- diffusers/schedulers/scheduling_consistency_models.py +2 -0
- diffusers/schedulers/scheduling_ddim_inverse.py +1 -4
- diffusers/schedulers/scheduling_ddpm.py +46 -0
- diffusers/schedulers/scheduling_ddpm_parallel.py +46 -0
- diffusers/schedulers/scheduling_deis_multistep.py +13 -1
- diffusers/schedulers/scheduling_dpmsolver_multistep.py +13 -1
- diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py +13 -1
- diffusers/schedulers/scheduling_dpmsolver_sde.py +2 -0
- diffusers/schedulers/scheduling_dpmsolver_singlestep.py +13 -1
- diffusers/schedulers/scheduling_euler_ancestral_discrete.py +58 -0
- diffusers/schedulers/scheduling_euler_discrete.py +62 -3
- diffusers/schedulers/scheduling_heun_discrete.py +2 -0
- diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py +2 -0
- diffusers/schedulers/scheduling_k_dpm_2_discrete.py +2 -0
- diffusers/schedulers/scheduling_lms_discrete.py +2 -0
- diffusers/schedulers/scheduling_unipc_multistep.py +13 -1
- diffusers/schedulers/scheduling_utils.py +3 -1
- diffusers/schedulers/scheduling_utils_flax.py +3 -1
- diffusers/training_utils.py +1 -1
- diffusers/utils/__init__.py +0 -2
- diffusers/utils/constants.py +2 -5
- diffusers/utils/dummy_pt_objects.py +30 -0
- diffusers/utils/dummy_torch_and_transformers_objects.py +45 -0
- diffusers/utils/dynamic_modules_utils.py +14 -18
- diffusers/utils/hub_utils.py +24 -36
- diffusers/utils/logging.py +1 -1
- diffusers/utils/state_dict_utils.py +8 -0
- diffusers/utils/testing_utils.py +199 -1
- diffusers/utils/torch_utils.py +3 -3
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/METADATA +55 -53
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/RECORD +174 -155
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/WHEEL +1 -1
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/entry_points.txt +0 -1
- /diffusers/pipelines/{alt_diffusion → deprecated/alt_diffusion}/modeling_roberta_series.py +0 -0
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/LICENSE +0 -0
- {diffusers-0.24.0.dist-info → diffusers-0.25.1.dist-info}/top_level.txt +0 -0
@@ -22,6 +22,7 @@ from typing import Optional, Union
|
|
22
22
|
|
23
23
|
import numpy as np
|
24
24
|
from huggingface_hub import hf_hub_download
|
25
|
+
from huggingface_hub.utils import validate_hf_hub_args
|
25
26
|
|
26
27
|
from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging
|
27
28
|
|
@@ -130,10 +131,11 @@ class OnnxRuntimeModel:
|
|
130
131
|
self._save_pretrained(save_directory, **kwargs)
|
131
132
|
|
132
133
|
@classmethod
|
134
|
+
@validate_hf_hub_args
|
133
135
|
def _from_pretrained(
|
134
136
|
cls,
|
135
137
|
model_id: Union[str, Path],
|
136
|
-
|
138
|
+
token: Optional[Union[bool, str, None]] = None,
|
137
139
|
revision: Optional[Union[str, None]] = None,
|
138
140
|
force_download: bool = False,
|
139
141
|
cache_dir: Optional[str] = None,
|
@@ -148,7 +150,7 @@ class OnnxRuntimeModel:
|
|
148
150
|
Arguments:
|
149
151
|
model_id (`str` or `Path`):
|
150
152
|
Directory from which to load
|
151
|
-
|
153
|
+
token (`str` or `bool`):
|
152
154
|
Is needed to load models from a private or gated repository
|
153
155
|
revision (`str`):
|
154
156
|
Revision is the specific model version to use. It can be a branch name, a tag name, or a commit id
|
@@ -179,7 +181,7 @@ class OnnxRuntimeModel:
|
|
179
181
|
model_cache_path = hf_hub_download(
|
180
182
|
repo_id=model_id,
|
181
183
|
filename=model_file_name,
|
182
|
-
|
184
|
+
token=token,
|
183
185
|
revision=revision,
|
184
186
|
cache_dir=cache_dir,
|
185
187
|
force_download=force_download,
|
@@ -190,11 +192,12 @@ class OnnxRuntimeModel:
|
|
190
192
|
return cls(model=model, **kwargs)
|
191
193
|
|
192
194
|
@classmethod
|
195
|
+
@validate_hf_hub_args
|
193
196
|
def from_pretrained(
|
194
197
|
cls,
|
195
198
|
model_id: Union[str, Path],
|
196
199
|
force_download: bool = True,
|
197
|
-
|
200
|
+
token: Optional[str] = None,
|
198
201
|
cache_dir: Optional[str] = None,
|
199
202
|
**model_kwargs,
|
200
203
|
):
|
@@ -207,6 +210,6 @@ class OnnxRuntimeModel:
|
|
207
210
|
revision=revision,
|
208
211
|
cache_dir=cache_dir,
|
209
212
|
force_download=force_download,
|
210
|
-
|
213
|
+
token=token,
|
211
214
|
**model_kwargs,
|
212
215
|
)
|
@@ -24,6 +24,7 @@ import numpy as np
|
|
24
24
|
import PIL.Image
|
25
25
|
from flax.core.frozen_dict import FrozenDict
|
26
26
|
from huggingface_hub import create_repo, snapshot_download
|
27
|
+
from huggingface_hub.utils import validate_hf_hub_args
|
27
28
|
from PIL import Image
|
28
29
|
from tqdm.auto import tqdm
|
29
30
|
|
@@ -32,7 +33,6 @@ from ..models.modeling_flax_utils import FLAX_WEIGHTS_NAME, FlaxModelMixin
|
|
32
33
|
from ..schedulers.scheduling_utils_flax import SCHEDULER_CONFIG_NAME, FlaxSchedulerMixin
|
33
34
|
from ..utils import (
|
34
35
|
CONFIG_NAME,
|
35
|
-
DIFFUSERS_CACHE,
|
36
36
|
BaseOutput,
|
37
37
|
PushToHubMixin,
|
38
38
|
http_user_agent,
|
@@ -227,6 +227,7 @@ class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
227
227
|
)
|
228
228
|
|
229
229
|
@classmethod
|
230
|
+
@validate_hf_hub_args
|
230
231
|
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
|
231
232
|
r"""
|
232
233
|
Instantiate a Flax-based diffusion pipeline from pretrained pipeline weights.
|
@@ -264,7 +265,7 @@ class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
264
265
|
local_files_only (`bool`, *optional*, defaults to `False`):
|
265
266
|
Whether to only load local model weights and configuration files or not. If set to `True`, the model
|
266
267
|
won't be downloaded from the Hub.
|
267
|
-
|
268
|
+
token (`str` or *bool*, *optional*):
|
268
269
|
The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
|
269
270
|
`diffusers-cli login` (stored in `~/.huggingface`) is used.
|
270
271
|
revision (`str`, *optional*, defaults to `"main"`):
|
@@ -314,11 +315,11 @@ class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
314
315
|
>>> dpm_params["scheduler"] = dpmpp_state
|
315
316
|
```
|
316
317
|
"""
|
317
|
-
cache_dir = kwargs.pop("cache_dir",
|
318
|
+
cache_dir = kwargs.pop("cache_dir", None)
|
318
319
|
resume_download = kwargs.pop("resume_download", False)
|
319
320
|
proxies = kwargs.pop("proxies", None)
|
320
321
|
local_files_only = kwargs.pop("local_files_only", False)
|
321
|
-
|
322
|
+
token = kwargs.pop("token", None)
|
322
323
|
revision = kwargs.pop("revision", None)
|
323
324
|
from_pt = kwargs.pop("from_pt", False)
|
324
325
|
use_memory_efficient_attention = kwargs.pop("use_memory_efficient_attention", False)
|
@@ -334,7 +335,7 @@ class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
334
335
|
resume_download=resume_download,
|
335
336
|
proxies=proxies,
|
336
337
|
local_files_only=local_files_only,
|
337
|
-
|
338
|
+
token=token,
|
338
339
|
revision=revision,
|
339
340
|
)
|
340
341
|
# make sure we only download sub-folders and `diffusers` filenames
|
@@ -365,7 +366,7 @@ class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
365
366
|
resume_download=resume_download,
|
366
367
|
proxies=proxies,
|
367
368
|
local_files_only=local_files_only,
|
368
|
-
|
369
|
+
token=token,
|
369
370
|
revision=revision,
|
370
371
|
allow_patterns=allow_patterns,
|
371
372
|
ignore_patterns=ignore_patterns,
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
|
-
|
17
16
|
import fnmatch
|
18
17
|
import importlib
|
19
18
|
import inspect
|
@@ -27,8 +26,16 @@ from typing import Any, Callable, Dict, List, Optional, Union
|
|
27
26
|
|
28
27
|
import numpy as np
|
29
28
|
import PIL.Image
|
29
|
+
import requests
|
30
30
|
import torch
|
31
|
-
from huggingface_hub import
|
31
|
+
from huggingface_hub import (
|
32
|
+
ModelCard,
|
33
|
+
create_repo,
|
34
|
+
hf_hub_download,
|
35
|
+
model_info,
|
36
|
+
snapshot_download,
|
37
|
+
)
|
38
|
+
from huggingface_hub.utils import OfflineModeIsEnabled, validate_hf_hub_args
|
32
39
|
from packaging import version
|
33
40
|
from requests.exceptions import HTTPError
|
34
41
|
from tqdm.auto import tqdm
|
@@ -40,8 +47,6 @@ from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME
|
|
40
47
|
from ..utils import (
|
41
48
|
CONFIG_NAME,
|
42
49
|
DEPRECATED_REVISION_ARGS,
|
43
|
-
DIFFUSERS_CACHE,
|
44
|
-
HF_HUB_OFFLINE,
|
45
50
|
SAFETENSORS_WEIGHTS_NAME,
|
46
51
|
WEIGHTS_NAME,
|
47
52
|
BaseOutput,
|
@@ -249,10 +254,11 @@ def variant_compatible_siblings(filenames, variant=None) -> Union[List[os.PathLi
|
|
249
254
|
return usable_filenames, variant_filenames
|
250
255
|
|
251
256
|
|
252
|
-
|
257
|
+
@validate_hf_hub_args
|
258
|
+
def warn_deprecated_model_variant(pretrained_model_name_or_path, token, variant, revision, model_filenames):
|
253
259
|
info = model_info(
|
254
260
|
pretrained_model_name_or_path,
|
255
|
-
|
261
|
+
token=token,
|
256
262
|
revision=None,
|
257
263
|
)
|
258
264
|
filenames = {sibling.rfilename for sibling in info.siblings}
|
@@ -375,7 +381,6 @@ def _get_pipeline_class(
|
|
375
381
|
custom_pipeline,
|
376
382
|
module_file=file_name,
|
377
383
|
class_name=class_name,
|
378
|
-
repo_id=repo_id,
|
379
384
|
cache_dir=cache_dir,
|
380
385
|
revision=revision,
|
381
386
|
)
|
@@ -758,10 +763,10 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
758
763
|
|
759
764
|
torch_dtype = kwargs.pop("torch_dtype", None)
|
760
765
|
if torch_dtype is not None:
|
761
|
-
deprecate("torch_dtype", "0.
|
766
|
+
deprecate("torch_dtype", "0.27.0", "")
|
762
767
|
torch_device = kwargs.pop("torch_device", None)
|
763
768
|
if torch_device is not None:
|
764
|
-
deprecate("torch_device", "0.
|
769
|
+
deprecate("torch_device", "0.27.0", "")
|
765
770
|
|
766
771
|
dtype_kwarg = kwargs.pop("dtype", None)
|
767
772
|
device_kwarg = kwargs.pop("device", None)
|
@@ -909,6 +914,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
909
914
|
return torch.float32
|
910
915
|
|
911
916
|
@classmethod
|
917
|
+
@validate_hf_hub_args
|
912
918
|
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], **kwargs):
|
913
919
|
r"""
|
914
920
|
Instantiate a PyTorch diffusion pipeline from pretrained pipeline weights.
|
@@ -976,7 +982,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
976
982
|
local_files_only (`bool`, *optional*, defaults to `False`):
|
977
983
|
Whether to only load local model weights and configuration files or not. If set to `True`, the model
|
978
984
|
won't be downloaded from the Hub.
|
979
|
-
|
985
|
+
token (`str` or *bool*, *optional*):
|
980
986
|
The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
|
981
987
|
`diffusers-cli login` (stored in `~/.huggingface`) is used.
|
982
988
|
revision (`str`, *optional*, defaults to `"main"`):
|
@@ -1056,12 +1062,12 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1056
1062
|
>>> pipeline.scheduler = scheduler
|
1057
1063
|
```
|
1058
1064
|
"""
|
1059
|
-
cache_dir = kwargs.pop("cache_dir",
|
1065
|
+
cache_dir = kwargs.pop("cache_dir", None)
|
1060
1066
|
resume_download = kwargs.pop("resume_download", False)
|
1061
1067
|
force_download = kwargs.pop("force_download", False)
|
1062
1068
|
proxies = kwargs.pop("proxies", None)
|
1063
|
-
local_files_only = kwargs.pop("local_files_only",
|
1064
|
-
|
1069
|
+
local_files_only = kwargs.pop("local_files_only", None)
|
1070
|
+
token = kwargs.pop("token", None)
|
1065
1071
|
revision = kwargs.pop("revision", None)
|
1066
1072
|
from_flax = kwargs.pop("from_flax", False)
|
1067
1073
|
torch_dtype = kwargs.pop("torch_dtype", None)
|
@@ -1094,7 +1100,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1094
1100
|
force_download=force_download,
|
1095
1101
|
proxies=proxies,
|
1096
1102
|
local_files_only=local_files_only,
|
1097
|
-
|
1103
|
+
token=token,
|
1098
1104
|
revision=revision,
|
1099
1105
|
from_flax=from_flax,
|
1100
1106
|
use_safetensors=use_safetensors,
|
@@ -1299,7 +1305,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1299
1305
|
"force_download": force_download,
|
1300
1306
|
"proxies": proxies,
|
1301
1307
|
"local_files_only": local_files_only,
|
1302
|
-
"
|
1308
|
+
"token": token,
|
1303
1309
|
"revision": revision,
|
1304
1310
|
"torch_dtype": torch_dtype,
|
1305
1311
|
"custom_pipeline": custom_pipeline,
|
@@ -1529,6 +1535,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1529
1535
|
cpu_offload(model, device, offload_buffers=offload_buffers)
|
1530
1536
|
|
1531
1537
|
@classmethod
|
1538
|
+
@validate_hf_hub_args
|
1532
1539
|
def download(cls, pretrained_model_name, **kwargs) -> Union[str, os.PathLike]:
|
1533
1540
|
r"""
|
1534
1541
|
Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights.
|
@@ -1576,7 +1583,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1576
1583
|
local_files_only (`bool`, *optional*, defaults to `False`):
|
1577
1584
|
Whether to only load local model weights and configuration files or not. If set to `True`, the model
|
1578
1585
|
won't be downloaded from the Hub.
|
1579
|
-
|
1586
|
+
token (`str` or *bool*, *optional*):
|
1580
1587
|
The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
|
1581
1588
|
`diffusers-cli login` (stored in `~/.huggingface`) is used.
|
1582
1589
|
revision (`str`, *optional*, defaults to `"main"`):
|
@@ -1619,12 +1626,12 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1619
1626
|
</Tip>
|
1620
1627
|
|
1621
1628
|
"""
|
1622
|
-
cache_dir = kwargs.pop("cache_dir",
|
1629
|
+
cache_dir = kwargs.pop("cache_dir", None)
|
1623
1630
|
resume_download = kwargs.pop("resume_download", False)
|
1624
1631
|
force_download = kwargs.pop("force_download", False)
|
1625
1632
|
proxies = kwargs.pop("proxies", None)
|
1626
|
-
local_files_only = kwargs.pop("local_files_only",
|
1627
|
-
|
1633
|
+
local_files_only = kwargs.pop("local_files_only", None)
|
1634
|
+
token = kwargs.pop("token", None)
|
1628
1635
|
revision = kwargs.pop("revision", None)
|
1629
1636
|
from_flax = kwargs.pop("from_flax", False)
|
1630
1637
|
custom_pipeline = kwargs.pop("custom_pipeline", None)
|
@@ -1646,12 +1653,8 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1646
1653
|
model_info_call_error: Optional[Exception] = None
|
1647
1654
|
if not local_files_only:
|
1648
1655
|
try:
|
1649
|
-
info = model_info(
|
1650
|
-
|
1651
|
-
use_auth_token=use_auth_token,
|
1652
|
-
revision=revision,
|
1653
|
-
)
|
1654
|
-
except HTTPError as e:
|
1656
|
+
info = model_info(pretrained_model_name, token=token, revision=revision)
|
1657
|
+
except (HTTPError, OfflineModeIsEnabled, requests.ConnectionError) as e:
|
1655
1658
|
logger.warn(f"Couldn't connect to the Hub: {e}.\nWill try to load from local cache.")
|
1656
1659
|
local_files_only = True
|
1657
1660
|
model_info_call_error = e # save error to reraise it if model is not cached locally
|
@@ -1665,7 +1668,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1665
1668
|
proxies=proxies,
|
1666
1669
|
force_download=force_download,
|
1667
1670
|
resume_download=resume_download,
|
1668
|
-
|
1671
|
+
token=token,
|
1669
1672
|
)
|
1670
1673
|
|
1671
1674
|
config_dict = cls._dict_from_json_file(config_file)
|
@@ -1715,9 +1718,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1715
1718
|
if revision in DEPRECATED_REVISION_ARGS and version.parse(
|
1716
1719
|
version.parse(__version__).base_version
|
1717
1720
|
) >= version.parse("0.22.0"):
|
1718
|
-
warn_deprecated_model_variant(
|
1719
|
-
pretrained_model_name, use_auth_token, variant, revision, model_filenames
|
1720
|
-
)
|
1721
|
+
warn_deprecated_model_variant(pretrained_model_name, token, variant, revision, model_filenames)
|
1721
1722
|
|
1722
1723
|
model_folder_names = {os.path.split(f)[0] for f in model_filenames if os.path.split(f)[0] in folder_names}
|
1723
1724
|
|
@@ -1859,7 +1860,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1859
1860
|
resume_download=resume_download,
|
1860
1861
|
proxies=proxies,
|
1861
1862
|
local_files_only=local_files_only,
|
1862
|
-
|
1863
|
+
token=token,
|
1863
1864
|
revision=revision,
|
1864
1865
|
allow_patterns=allow_patterns,
|
1865
1866
|
ignore_patterns=ignore_patterns,
|
@@ -1883,7 +1884,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
|
1883
1884
|
"force_download": force_download,
|
1884
1885
|
"proxies": proxies,
|
1885
1886
|
"local_files_only": local_files_only,
|
1886
|
-
"
|
1887
|
+
"token": token,
|
1887
1888
|
"variant": variant,
|
1888
1889
|
"use_safetensors": use_safetensors,
|
1889
1890
|
}
|
@@ -134,6 +134,51 @@ ASPECT_RATIO_512_BIN = {
|
|
134
134
|
}
|
135
135
|
|
136
136
|
|
137
|
+
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.retrieve_timesteps
|
138
|
+
def retrieve_timesteps(
|
139
|
+
scheduler,
|
140
|
+
num_inference_steps: Optional[int] = None,
|
141
|
+
device: Optional[Union[str, torch.device]] = None,
|
142
|
+
timesteps: Optional[List[int]] = None,
|
143
|
+
**kwargs,
|
144
|
+
):
|
145
|
+
"""
|
146
|
+
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
|
147
|
+
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
|
148
|
+
|
149
|
+
Args:
|
150
|
+
scheduler (`SchedulerMixin`):
|
151
|
+
The scheduler to get timesteps from.
|
152
|
+
num_inference_steps (`int`):
|
153
|
+
The number of diffusion steps used when generating samples with a pre-trained model. If used,
|
154
|
+
`timesteps` must be `None`.
|
155
|
+
device (`str` or `torch.device`, *optional*):
|
156
|
+
The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
|
157
|
+
timesteps (`List[int]`, *optional*):
|
158
|
+
Custom timesteps used to support arbitrary spacing between timesteps. If `None`, then the default
|
159
|
+
timestep spacing strategy of the scheduler is used. If `timesteps` is passed, `num_inference_steps`
|
160
|
+
must be `None`.
|
161
|
+
|
162
|
+
Returns:
|
163
|
+
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
|
164
|
+
second element is the number of inference steps.
|
165
|
+
"""
|
166
|
+
if timesteps is not None:
|
167
|
+
accepts_timesteps = "timesteps" in set(inspect.signature(scheduler.set_timesteps).parameters.keys())
|
168
|
+
if not accepts_timesteps:
|
169
|
+
raise ValueError(
|
170
|
+
f"The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom"
|
171
|
+
f" timestep schedules. Please check whether you are using the correct scheduler."
|
172
|
+
)
|
173
|
+
scheduler.set_timesteps(timesteps=timesteps, device=device, **kwargs)
|
174
|
+
timesteps = scheduler.timesteps
|
175
|
+
num_inference_steps = len(timesteps)
|
176
|
+
else:
|
177
|
+
scheduler.set_timesteps(num_inference_steps, device=device, **kwargs)
|
178
|
+
timesteps = scheduler.timesteps
|
179
|
+
return timesteps, num_inference_steps
|
180
|
+
|
181
|
+
|
137
182
|
class PixArtAlphaPipeline(DiffusionPipeline):
|
138
183
|
r"""
|
139
184
|
Pipeline for text-to-image generation using PixArt-Alpha.
|
@@ -783,8 +828,7 @@ class PixArtAlphaPipeline(DiffusionPipeline):
|
|
783
828
|
prompt_attention_mask = torch.cat([negative_prompt_attention_mask, prompt_attention_mask], dim=0)
|
784
829
|
|
785
830
|
# 4. Prepare timesteps
|
786
|
-
self.scheduler
|
787
|
-
timesteps = self.scheduler.timesteps
|
831
|
+
timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
|
788
832
|
|
789
833
|
# 5. Prepare latents.
|
790
834
|
latent_channels = self.transformer.config.in_channels
|
@@ -809,6 +853,11 @@ class PixArtAlphaPipeline(DiffusionPipeline):
|
|
809
853
|
aspect_ratio = torch.tensor([float(height / width)]).repeat(batch_size * num_images_per_prompt, 1)
|
810
854
|
resolution = resolution.to(dtype=prompt_embeds.dtype, device=device)
|
811
855
|
aspect_ratio = aspect_ratio.to(dtype=prompt_embeds.dtype, device=device)
|
856
|
+
|
857
|
+
if do_classifier_free_guidance:
|
858
|
+
resolution = torch.cat([resolution, resolution], dim=0)
|
859
|
+
aspect_ratio = torch.cat([aspect_ratio, aspect_ratio], dim=0)
|
860
|
+
|
812
861
|
added_cond_kwargs = {"resolution": resolution, "aspect_ratio": aspect_ratio}
|
813
862
|
|
814
863
|
# 7. Denoising loop
|
@@ -283,6 +283,9 @@ class ShapEImg2ImgPipeline(DiffusionPipeline):
|
|
283
283
|
f"Only the output types `pil`, `np`, `latent` and `mesh` are supported not output_type={output_type}"
|
284
284
|
)
|
285
285
|
|
286
|
+
# Offload all models
|
287
|
+
self.maybe_free_model_hooks()
|
288
|
+
|
286
289
|
if output_type == "latent":
|
287
290
|
return ShapEPipelineOutput(images=latents)
|
288
291
|
|
@@ -312,9 +315,6 @@ class ShapEImg2ImgPipeline(DiffusionPipeline):
|
|
312
315
|
if output_type == "pil":
|
313
316
|
images = [self.numpy_to_pil(image) for image in images]
|
314
317
|
|
315
|
-
# Offload all models
|
316
|
-
self.maybe_free_model_hooks()
|
317
|
-
|
318
318
|
if not return_dict:
|
319
319
|
return (images,)
|
320
320
|
|
@@ -34,18 +34,14 @@ else:
|
|
34
34
|
_import_structure["pipeline_stable_diffusion"] = ["StableDiffusionPipeline"]
|
35
35
|
_import_structure["pipeline_stable_diffusion_attend_and_excite"] = ["StableDiffusionAttendAndExcitePipeline"]
|
36
36
|
_import_structure["pipeline_stable_diffusion_gligen"] = ["StableDiffusionGLIGENPipeline"]
|
37
|
-
_import_structure["pipeline_stable_diffusion_gligen"] = ["StableDiffusionGLIGENPipeline"]
|
38
37
|
_import_structure["pipeline_stable_diffusion_gligen_text_image"] = ["StableDiffusionGLIGENTextImagePipeline"]
|
39
38
|
_import_structure["pipeline_stable_diffusion_img2img"] = ["StableDiffusionImg2ImgPipeline"]
|
40
39
|
_import_structure["pipeline_stable_diffusion_inpaint"] = ["StableDiffusionInpaintPipeline"]
|
41
40
|
_import_structure["pipeline_stable_diffusion_inpaint_legacy"] = ["StableDiffusionInpaintPipelineLegacy"]
|
42
41
|
_import_structure["pipeline_stable_diffusion_instruct_pix2pix"] = ["StableDiffusionInstructPix2PixPipeline"]
|
43
42
|
_import_structure["pipeline_stable_diffusion_latent_upscale"] = ["StableDiffusionLatentUpscalePipeline"]
|
44
|
-
_import_structure["pipeline_stable_diffusion_ldm3d"] = ["StableDiffusionLDM3DPipeline"]
|
45
43
|
_import_structure["pipeline_stable_diffusion_model_editing"] = ["StableDiffusionModelEditingPipeline"]
|
46
|
-
_import_structure["pipeline_stable_diffusion_panorama"] = ["StableDiffusionPanoramaPipeline"]
|
47
44
|
_import_structure["pipeline_stable_diffusion_paradigms"] = ["StableDiffusionParadigmsPipeline"]
|
48
|
-
_import_structure["pipeline_stable_diffusion_sag"] = ["StableDiffusionSAGPipeline"]
|
49
45
|
_import_structure["pipeline_stable_diffusion_upscale"] = ["StableDiffusionUpscalePipeline"]
|
50
46
|
_import_structure["pipeline_stable_unclip"] = ["StableUnCLIPPipeline"]
|
51
47
|
_import_structure["pipeline_stable_unclip_img2img"] = ["StableUnCLIPImg2ImgPipeline"]
|
@@ -68,37 +64,16 @@ try:
|
|
68
64
|
except OptionalDependencyNotAvailable:
|
69
65
|
from ...utils.dummy_torch_and_transformers_objects import (
|
70
66
|
StableDiffusionDepth2ImgPipeline,
|
71
|
-
StableDiffusionDiffEditPipeline,
|
72
|
-
StableDiffusionPix2PixZeroPipeline,
|
73
67
|
)
|
74
68
|
|
75
69
|
_dummy_objects.update(
|
76
70
|
{
|
77
71
|
"StableDiffusionDepth2ImgPipeline": StableDiffusionDepth2ImgPipeline,
|
78
|
-
"StableDiffusionDiffEditPipeline": StableDiffusionDiffEditPipeline,
|
79
|
-
"StableDiffusionPix2PixZeroPipeline": StableDiffusionPix2PixZeroPipeline,
|
80
72
|
}
|
81
73
|
)
|
82
74
|
else:
|
83
75
|
_import_structure["pipeline_stable_diffusion_depth2img"] = ["StableDiffusionDepth2ImgPipeline"]
|
84
|
-
_import_structure["pipeline_stable_diffusion_diffedit"] = ["StableDiffusionDiffEditPipeline"]
|
85
|
-
_import_structure["pipeline_stable_diffusion_pix2pix_zero"] = ["StableDiffusionPix2PixZeroPipeline"]
|
86
|
-
try:
|
87
|
-
if not (
|
88
|
-
is_torch_available()
|
89
|
-
and is_transformers_available()
|
90
|
-
and is_k_diffusion_available()
|
91
|
-
and is_k_diffusion_version(">=", "0.0.12")
|
92
|
-
):
|
93
|
-
raise OptionalDependencyNotAvailable()
|
94
|
-
except OptionalDependencyNotAvailable:
|
95
|
-
from ...utils import (
|
96
|
-
dummy_torch_and_transformers_and_k_diffusion_objects,
|
97
|
-
)
|
98
76
|
|
99
|
-
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_k_diffusion_objects))
|
100
|
-
else:
|
101
|
-
_import_structure["pipeline_stable_diffusion_k_diffusion"] = ["StableDiffusionKDiffusionPipeline"]
|
102
77
|
try:
|
103
78
|
if not (is_transformers_available() and is_onnx_available()):
|
104
79
|
raise OptionalDependencyNotAvailable()
|
@@ -135,39 +110,19 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
135
110
|
|
136
111
|
else:
|
137
112
|
from .clip_image_project_model import CLIPImageProjection
|
138
|
-
from .pipeline_cycle_diffusion import CycleDiffusionPipeline
|
139
113
|
from .pipeline_stable_diffusion import (
|
140
114
|
StableDiffusionPipeline,
|
141
115
|
StableDiffusionPipelineOutput,
|
142
116
|
StableDiffusionSafetyChecker,
|
143
117
|
)
|
144
|
-
from .pipeline_stable_diffusion_attend_and_excite import (
|
145
|
-
StableDiffusionAttendAndExcitePipeline,
|
146
|
-
)
|
147
|
-
from .pipeline_stable_diffusion_gligen import StableDiffusionGLIGENPipeline
|
148
|
-
from .pipeline_stable_diffusion_gligen_text_image import (
|
149
|
-
StableDiffusionGLIGENTextImagePipeline,
|
150
|
-
)
|
151
118
|
from .pipeline_stable_diffusion_img2img import StableDiffusionImg2ImgPipeline
|
152
119
|
from .pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipeline
|
153
|
-
from .pipeline_stable_diffusion_inpaint_legacy import (
|
154
|
-
StableDiffusionInpaintPipelineLegacy,
|
155
|
-
)
|
156
120
|
from .pipeline_stable_diffusion_instruct_pix2pix import (
|
157
121
|
StableDiffusionInstructPix2PixPipeline,
|
158
122
|
)
|
159
123
|
from .pipeline_stable_diffusion_latent_upscale import (
|
160
124
|
StableDiffusionLatentUpscalePipeline,
|
161
125
|
)
|
162
|
-
from .pipeline_stable_diffusion_ldm3d import StableDiffusionLDM3DPipeline
|
163
|
-
from .pipeline_stable_diffusion_model_editing import (
|
164
|
-
StableDiffusionModelEditingPipeline,
|
165
|
-
)
|
166
|
-
from .pipeline_stable_diffusion_panorama import StableDiffusionPanoramaPipeline
|
167
|
-
from .pipeline_stable_diffusion_paradigms import (
|
168
|
-
StableDiffusionParadigmsPipeline,
|
169
|
-
)
|
170
|
-
from .pipeline_stable_diffusion_sag import StableDiffusionSAGPipeline
|
171
126
|
from .pipeline_stable_diffusion_upscale import StableDiffusionUpscalePipeline
|
172
127
|
from .pipeline_stable_unclip import StableUnCLIPPipeline
|
173
128
|
from .pipeline_stable_unclip_img2img import StableUnCLIPImg2ImgPipeline
|
@@ -190,34 +145,11 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
190
145
|
if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.26.0")):
|
191
146
|
raise OptionalDependencyNotAvailable()
|
192
147
|
except OptionalDependencyNotAvailable:
|
193
|
-
from ...utils.dummy_torch_and_transformers_objects import
|
194
|
-
StableDiffusionDepth2ImgPipeline,
|
195
|
-
StableDiffusionDiffEditPipeline,
|
196
|
-
StableDiffusionPix2PixZeroPipeline,
|
197
|
-
)
|
148
|
+
from ...utils.dummy_torch_and_transformers_objects import StableDiffusionDepth2ImgPipeline
|
198
149
|
else:
|
199
150
|
from .pipeline_stable_diffusion_depth2img import (
|
200
151
|
StableDiffusionDepth2ImgPipeline,
|
201
152
|
)
|
202
|
-
from .pipeline_stable_diffusion_diffedit import StableDiffusionDiffEditPipeline
|
203
|
-
from .pipeline_stable_diffusion_pix2pix_zero import (
|
204
|
-
StableDiffusionPix2PixZeroPipeline,
|
205
|
-
)
|
206
|
-
|
207
|
-
try:
|
208
|
-
if not (
|
209
|
-
is_torch_available()
|
210
|
-
and is_transformers_available()
|
211
|
-
and is_k_diffusion_available()
|
212
|
-
and is_k_diffusion_version(">=", "0.0.12")
|
213
|
-
):
|
214
|
-
raise OptionalDependencyNotAvailable()
|
215
|
-
except OptionalDependencyNotAvailable:
|
216
|
-
from ...utils.dummy_torch_and_transformers_and_k_diffusion_objects import *
|
217
|
-
else:
|
218
|
-
from .pipeline_stable_diffusion_k_diffusion import (
|
219
|
-
StableDiffusionKDiffusionPipeline,
|
220
|
-
)
|
221
153
|
|
222
154
|
try:
|
223
155
|
if not (is_transformers_available() and is_onnx_available()):
|
@@ -235,9 +167,6 @@ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
|
235
167
|
from .pipeline_onnx_stable_diffusion_inpaint import (
|
236
168
|
OnnxStableDiffusionInpaintPipeline,
|
237
169
|
)
|
238
|
-
from .pipeline_onnx_stable_diffusion_inpaint_legacy import (
|
239
|
-
OnnxStableDiffusionInpaintPipelineLegacy,
|
240
|
-
)
|
241
170
|
from .pipeline_onnx_stable_diffusion_upscale import (
|
242
171
|
OnnxStableDiffusionUpscalePipeline,
|
243
172
|
)
|