diffusers 0.28.2__py3-none-any.whl → 0.29.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffusers/__init__.py +9 -1
- diffusers/commands/env.py +1 -5
- diffusers/dependency_versions_table.py +1 -1
- diffusers/image_processor.py +2 -1
- diffusers/loaders/__init__.py +2 -2
- diffusers/loaders/lora.py +406 -140
- diffusers/loaders/lora_conversion_utils.py +7 -1
- diffusers/loaders/single_file.py +1 -1
- diffusers/loaders/single_file_model.py +5 -0
- diffusers/loaders/single_file_utils.py +242 -2
- diffusers/loaders/unet.py +307 -272
- diffusers/models/__init__.py +5 -3
- diffusers/models/attention.py +125 -1
- diffusers/models/attention_processor.py +169 -1
- diffusers/models/autoencoders/__init__.py +1 -0
- diffusers/models/autoencoders/autoencoder_asym_kl.py +1 -1
- diffusers/models/autoencoders/autoencoder_kl.py +17 -6
- diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py +4 -2
- diffusers/models/autoencoders/consistency_decoder_vae.py +9 -9
- diffusers/models/autoencoders/vq_model.py +182 -0
- diffusers/models/controlnet_xs.py +6 -6
- diffusers/models/embeddings.py +112 -84
- diffusers/models/model_loading_utils.py +55 -0
- diffusers/models/modeling_utils.py +128 -17
- diffusers/models/normalization.py +11 -6
- diffusers/models/transformers/__init__.py +1 -0
- diffusers/models/transformers/dual_transformer_2d.py +5 -4
- diffusers/models/transformers/hunyuan_transformer_2d.py +149 -2
- diffusers/models/transformers/prior_transformer.py +5 -5
- diffusers/models/transformers/transformer_2d.py +2 -2
- diffusers/models/transformers/transformer_sd3.py +344 -0
- diffusers/models/transformers/transformer_temporal.py +12 -10
- diffusers/models/unets/unet_1d.py +3 -3
- diffusers/models/unets/unet_2d.py +3 -3
- diffusers/models/unets/unet_2d_condition.py +4 -15
- diffusers/models/unets/unet_3d_condition.py +5 -17
- diffusers/models/unets/unet_i2vgen_xl.py +4 -4
- diffusers/models/unets/unet_motion_model.py +4 -4
- diffusers/models/unets/unet_spatio_temporal_condition.py +3 -3
- diffusers/models/vq_model.py +8 -165
- diffusers/pipelines/__init__.py +2 -0
- diffusers/pipelines/animatediff/pipeline_animatediff.py +4 -3
- diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py +4 -3
- diffusers/pipelines/controlnet/pipeline_controlnet.py +4 -3
- diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +4 -3
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +4 -3
- diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs.py +4 -3
- diffusers/pipelines/deepfloyd_if/watermark.py +1 -1
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py +4 -3
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py +4 -3
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py +4 -3
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py +4 -3
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py +4 -3
- diffusers/pipelines/hunyuandit/pipeline_hunyuandit.py +24 -5
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +4 -3
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +4 -3
- diffusers/pipelines/marigold/marigold_image_processing.py +35 -20
- diffusers/pipelines/pia/pipeline_pia.py +4 -3
- diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +1 -1
- diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py +1 -1
- diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py +17 -17
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +5 -4
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +7 -6
- diffusers/pipelines/stable_diffusion_3/__init__.py +52 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_output.py +21 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py +886 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py +923 -0
- diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py +4 -3
- diffusers/pipelines/stable_diffusion_diffedit/pipeline_stable_diffusion_diffedit.py +10 -11
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py +4 -3
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py +4 -3
- diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_k_diffusion.py +4 -3
- diffusers/pipelines/stable_diffusion_ldm3d/pipeline_stable_diffusion_ldm3d.py +4 -3
- diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py +4 -3
- diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py +4 -3
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py +4 -3
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +4 -3
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +4 -3
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +4 -3
- diffusers/pipelines/unidiffuser/modeling_uvit.py +1 -1
- diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py +4 -3
- diffusers/schedulers/__init__.py +2 -0
- diffusers/schedulers/scheduling_dpmsolver_sde.py +2 -2
- diffusers/schedulers/scheduling_edm_dpmsolver_multistep.py +2 -3
- diffusers/schedulers/scheduling_edm_euler.py +2 -4
- diffusers/schedulers/scheduling_flow_match_euler_discrete.py +287 -0
- diffusers/schedulers/scheduling_lms_discrete.py +2 -2
- diffusers/training_utils.py +4 -4
- diffusers/utils/__init__.py +3 -0
- diffusers/utils/constants.py +2 -0
- diffusers/utils/dummy_pt_objects.py +30 -0
- diffusers/utils/dummy_torch_and_transformers_objects.py +30 -0
- diffusers/utils/dynamic_modules_utils.py +15 -13
- diffusers/utils/hub_utils.py +106 -0
- diffusers/utils/import_utils.py +0 -1
- diffusers/utils/logging.py +3 -1
- diffusers/utils/state_dict_utils.py +2 -0
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/METADATA +45 -45
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/RECORD +108 -111
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/WHEEL +1 -1
- diffusers/models/dual_transformer_2d.py +0 -20
- diffusers/models/prior_transformer.py +0 -12
- diffusers/models/t5_film_transformer.py +0 -70
- diffusers/models/transformer_2d.py +0 -25
- diffusers/models/transformer_temporal.py +0 -34
- diffusers/models/unet_1d.py +0 -26
- diffusers/models/unet_1d_blocks.py +0 -203
- diffusers/models/unet_2d.py +0 -27
- diffusers/models/unet_2d_blocks.py +0 -375
- diffusers/models/unet_2d_condition.py +0 -25
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/LICENSE +0 -0
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/entry_points.txt +0 -0
- {diffusers-0.28.2.dist-info → diffusers-0.29.0.dist-info}/top_level.txt +0 -0
diffusers/training_utils.py
CHANGED
@@ -157,19 +157,19 @@ def compute_dream_and_update_latents(
|
|
157
157
|
with torch.no_grad():
|
158
158
|
pred = unet(noisy_latents, timesteps, encoder_hidden_states).sample
|
159
159
|
|
160
|
-
|
160
|
+
_noisy_latents, _target = (None, None)
|
161
161
|
if noise_scheduler.config.prediction_type == "epsilon":
|
162
162
|
predicted_noise = pred
|
163
163
|
delta_noise = (noise - predicted_noise).detach()
|
164
164
|
delta_noise.mul_(dream_lambda)
|
165
|
-
|
166
|
-
|
165
|
+
_noisy_latents = noisy_latents.add(sqrt_one_minus_alphas_cumprod * delta_noise)
|
166
|
+
_target = target.add(delta_noise)
|
167
167
|
elif noise_scheduler.config.prediction_type == "v_prediction":
|
168
168
|
raise NotImplementedError("DREAM has not been implemented for v-prediction")
|
169
169
|
else:
|
170
170
|
raise ValueError(f"Unknown prediction type {noise_scheduler.config.prediction_type}")
|
171
171
|
|
172
|
-
return
|
172
|
+
return _noisy_latents, _target
|
173
173
|
|
174
174
|
|
175
175
|
def unet_lora_state_dict(unet: UNet2DConditionModel) -> Dict[str, torch.Tensor]:
|
diffusers/utils/__init__.py
CHANGED
@@ -28,9 +28,11 @@ from .constants import (
|
|
28
28
|
MIN_PEFT_VERSION,
|
29
29
|
ONNX_EXTERNAL_WEIGHTS_NAME,
|
30
30
|
ONNX_WEIGHTS_NAME,
|
31
|
+
SAFE_WEIGHTS_INDEX_NAME,
|
31
32
|
SAFETENSORS_FILE_EXTENSION,
|
32
33
|
SAFETENSORS_WEIGHTS_NAME,
|
33
34
|
USE_PEFT_BACKEND,
|
35
|
+
WEIGHTS_INDEX_NAME,
|
34
36
|
WEIGHTS_NAME,
|
35
37
|
)
|
36
38
|
from .deprecation_utils import deprecate
|
@@ -40,6 +42,7 @@ from .export_utils import export_to_gif, export_to_obj, export_to_ply, export_to
|
|
40
42
|
from .hub_utils import (
|
41
43
|
PushToHubMixin,
|
42
44
|
_add_variant,
|
45
|
+
_get_checkpoint_shard_files,
|
43
46
|
_get_model_file,
|
44
47
|
extract_commit_hash,
|
45
48
|
http_user_agent,
|
diffusers/utils/constants.py
CHANGED
@@ -28,9 +28,11 @@ _CHECK_PEFT = os.environ.get("_CHECK_PEFT", "1") in ENV_VARS_TRUE_VALUES
|
|
28
28
|
|
29
29
|
CONFIG_NAME = "config.json"
|
30
30
|
WEIGHTS_NAME = "diffusion_pytorch_model.bin"
|
31
|
+
WEIGHTS_INDEX_NAME = "diffusion_pytorch_model.bin.index.json"
|
31
32
|
FLAX_WEIGHTS_NAME = "diffusion_flax_model.msgpack"
|
32
33
|
ONNX_WEIGHTS_NAME = "model.onnx"
|
33
34
|
SAFETENSORS_WEIGHTS_NAME = "diffusion_pytorch_model.safetensors"
|
35
|
+
SAFE_WEIGHTS_INDEX_NAME = "diffusion_pytorch_model.safetensors.index.json"
|
34
36
|
SAFETENSORS_FILE_EXTENSION = "safetensors"
|
35
37
|
ONNX_EXTERNAL_WEIGHTS_NAME = "weights.pb"
|
36
38
|
HUGGINGFACE_CO_RESOLVE_ENDPOINT = os.environ.get("HF_ENDPOINT", "https://huggingface.co")
|
@@ -242,6 +242,21 @@ class PriorTransformer(metaclass=DummyObject):
|
|
242
242
|
requires_backends(cls, ["torch"])
|
243
243
|
|
244
244
|
|
245
|
+
class SD3Transformer2DModel(metaclass=DummyObject):
|
246
|
+
_backends = ["torch"]
|
247
|
+
|
248
|
+
def __init__(self, *args, **kwargs):
|
249
|
+
requires_backends(self, ["torch"])
|
250
|
+
|
251
|
+
@classmethod
|
252
|
+
def from_config(cls, *args, **kwargs):
|
253
|
+
requires_backends(cls, ["torch"])
|
254
|
+
|
255
|
+
@classmethod
|
256
|
+
def from_pretrained(cls, *args, **kwargs):
|
257
|
+
requires_backends(cls, ["torch"])
|
258
|
+
|
259
|
+
|
245
260
|
class T2IAdapter(metaclass=DummyObject):
|
246
261
|
_backends = ["torch"]
|
247
262
|
|
@@ -1005,6 +1020,21 @@ class EulerDiscreteScheduler(metaclass=DummyObject):
|
|
1005
1020
|
requires_backends(cls, ["torch"])
|
1006
1021
|
|
1007
1022
|
|
1023
|
+
class FlowMatchEulerDiscreteScheduler(metaclass=DummyObject):
|
1024
|
+
_backends = ["torch"]
|
1025
|
+
|
1026
|
+
def __init__(self, *args, **kwargs):
|
1027
|
+
requires_backends(self, ["torch"])
|
1028
|
+
|
1029
|
+
@classmethod
|
1030
|
+
def from_config(cls, *args, **kwargs):
|
1031
|
+
requires_backends(cls, ["torch"])
|
1032
|
+
|
1033
|
+
@classmethod
|
1034
|
+
def from_pretrained(cls, *args, **kwargs):
|
1035
|
+
requires_backends(cls, ["torch"])
|
1036
|
+
|
1037
|
+
|
1008
1038
|
class HeunDiscreteScheduler(metaclass=DummyObject):
|
1009
1039
|
_backends = ["torch"]
|
1010
1040
|
|
@@ -902,6 +902,36 @@ class StableCascadePriorPipeline(metaclass=DummyObject):
|
|
902
902
|
requires_backends(cls, ["torch", "transformers"])
|
903
903
|
|
904
904
|
|
905
|
+
class StableDiffusion3Img2ImgPipeline(metaclass=DummyObject):
|
906
|
+
_backends = ["torch", "transformers"]
|
907
|
+
|
908
|
+
def __init__(self, *args, **kwargs):
|
909
|
+
requires_backends(self, ["torch", "transformers"])
|
910
|
+
|
911
|
+
@classmethod
|
912
|
+
def from_config(cls, *args, **kwargs):
|
913
|
+
requires_backends(cls, ["torch", "transformers"])
|
914
|
+
|
915
|
+
@classmethod
|
916
|
+
def from_pretrained(cls, *args, **kwargs):
|
917
|
+
requires_backends(cls, ["torch", "transformers"])
|
918
|
+
|
919
|
+
|
920
|
+
class StableDiffusion3Pipeline(metaclass=DummyObject):
|
921
|
+
_backends = ["torch", "transformers"]
|
922
|
+
|
923
|
+
def __init__(self, *args, **kwargs):
|
924
|
+
requires_backends(self, ["torch", "transformers"])
|
925
|
+
|
926
|
+
@classmethod
|
927
|
+
def from_config(cls, *args, **kwargs):
|
928
|
+
requires_backends(cls, ["torch", "transformers"])
|
929
|
+
|
930
|
+
@classmethod
|
931
|
+
def from_pretrained(cls, *args, **kwargs):
|
932
|
+
requires_backends(cls, ["torch", "transformers"])
|
933
|
+
|
934
|
+
|
905
935
|
class StableDiffusionAdapterPipeline(metaclass=DummyObject):
|
906
936
|
_backends = ["torch", "transformers"]
|
907
937
|
|
@@ -25,21 +25,19 @@ from pathlib import Path
|
|
25
25
|
from typing import Dict, Optional, Union
|
26
26
|
from urllib import request
|
27
27
|
|
28
|
-
from huggingface_hub import
|
29
|
-
from huggingface_hub.utils import validate_hf_hub_args
|
28
|
+
from huggingface_hub import hf_hub_download, model_info
|
29
|
+
from huggingface_hub.utils import RevisionNotFoundError, validate_hf_hub_args
|
30
30
|
from packaging import version
|
31
31
|
|
32
32
|
from .. import __version__
|
33
33
|
from . import DIFFUSERS_DYNAMIC_MODULE_NAME, HF_MODULES_CACHE, logging
|
34
34
|
|
35
35
|
|
36
|
-
COMMUNITY_PIPELINES_URL = (
|
37
|
-
"https://raw.githubusercontent.com/huggingface/diffusers/{revision}/examples/community/{pipeline}.py"
|
38
|
-
)
|
39
|
-
|
40
|
-
|
41
36
|
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
42
37
|
|
38
|
+
# See https://huggingface.co/datasets/diffusers/community-pipelines-mirror
|
39
|
+
COMMUNITY_PIPELINES_MIRROR_ID = "diffusers/community-pipelines-mirror"
|
40
|
+
|
43
41
|
|
44
42
|
def get_diffusers_versions():
|
45
43
|
url = "https://pypi.org/pypi/diffusers/json"
|
@@ -281,20 +279,24 @@ def get_cached_module_file(
|
|
281
279
|
f" {', '.join(available_versions + ['main'])}."
|
282
280
|
)
|
283
281
|
|
284
|
-
# community pipeline on GitHub
|
285
|
-
github_url = COMMUNITY_PIPELINES_URL.format(revision=revision, pipeline=pretrained_model_name_or_path)
|
286
282
|
try:
|
287
|
-
resolved_module_file =
|
288
|
-
|
283
|
+
resolved_module_file = hf_hub_download(
|
284
|
+
repo_id=COMMUNITY_PIPELINES_MIRROR_ID,
|
285
|
+
repo_type="dataset",
|
286
|
+
filename=f"{revision}/{pretrained_model_name_or_path}.py",
|
289
287
|
cache_dir=cache_dir,
|
290
288
|
force_download=force_download,
|
291
289
|
proxies=proxies,
|
292
|
-
resume_download=resume_download,
|
293
290
|
local_files_only=local_files_only,
|
294
|
-
token=False,
|
295
291
|
)
|
296
292
|
submodule = "git"
|
297
293
|
module_file = pretrained_model_name_or_path + ".py"
|
294
|
+
except RevisionNotFoundError as e:
|
295
|
+
raise EnvironmentError(
|
296
|
+
f"Revision '{revision}' not found in the community pipelines mirror. Check available revisions on"
|
297
|
+
" https://huggingface.co/datasets/diffusers/community-pipelines-mirror/tree/main."
|
298
|
+
" If you don't find the revision you are looking for, please open an issue on https://github.com/huggingface/diffusers/issues."
|
299
|
+
) from e
|
298
300
|
except EnvironmentError:
|
299
301
|
logger.error(f"Could not locate the {module_file} inside {pretrained_model_name_or_path}.")
|
300
302
|
raise
|
diffusers/utils/hub_utils.py
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
16
|
|
17
|
+
import json
|
17
18
|
import os
|
18
19
|
import re
|
19
20
|
import sys
|
@@ -29,6 +30,8 @@ from huggingface_hub import (
|
|
29
30
|
ModelCardData,
|
30
31
|
create_repo,
|
31
32
|
hf_hub_download,
|
33
|
+
model_info,
|
34
|
+
snapshot_download,
|
32
35
|
upload_folder,
|
33
36
|
)
|
34
37
|
from huggingface_hub.constants import HF_HUB_CACHE, HF_HUB_DISABLE_TELEMETRY, HF_HUB_OFFLINE
|
@@ -393,6 +396,109 @@ def _get_model_file(
|
|
393
396
|
)
|
394
397
|
|
395
398
|
|
399
|
+
# Adapted from
|
400
|
+
# https://github.com/huggingface/transformers/blob/1360801a69c0b169e3efdbb0cd05d9a0e72bfb70/src/transformers/utils/hub.py#L976
|
401
|
+
# Differences are in parallelization of shard downloads and checking if shards are present.
|
402
|
+
|
403
|
+
|
404
|
+
def _check_if_shards_exist_locally(local_dir, subfolder, original_shard_filenames):
|
405
|
+
shards_path = os.path.join(local_dir, subfolder)
|
406
|
+
shard_filenames = [os.path.join(shards_path, f) for f in original_shard_filenames]
|
407
|
+
for shard_file in shard_filenames:
|
408
|
+
if not os.path.exists(shard_file):
|
409
|
+
raise ValueError(
|
410
|
+
f"{shards_path} does not appear to have a file named {shard_file} which is "
|
411
|
+
"required according to the checkpoint index."
|
412
|
+
)
|
413
|
+
|
414
|
+
|
415
|
+
def _get_checkpoint_shard_files(
|
416
|
+
pretrained_model_name_or_path,
|
417
|
+
index_filename,
|
418
|
+
cache_dir=None,
|
419
|
+
proxies=None,
|
420
|
+
resume_download=False,
|
421
|
+
local_files_only=False,
|
422
|
+
token=None,
|
423
|
+
user_agent=None,
|
424
|
+
revision=None,
|
425
|
+
subfolder="",
|
426
|
+
):
|
427
|
+
"""
|
428
|
+
For a given model:
|
429
|
+
|
430
|
+
- download and cache all the shards of a sharded checkpoint if `pretrained_model_name_or_path` is a model ID on the
|
431
|
+
Hub
|
432
|
+
- returns the list of paths to all the shards, as well as some metadata.
|
433
|
+
|
434
|
+
For the description of each arg, see [`PreTrainedModel.from_pretrained`]. `index_filename` is the full path to the
|
435
|
+
index (downloaded and cached if `pretrained_model_name_or_path` is a model ID on the Hub).
|
436
|
+
"""
|
437
|
+
if not os.path.isfile(index_filename):
|
438
|
+
raise ValueError(f"Can't find a checkpoint index ({index_filename}) in {pretrained_model_name_or_path}.")
|
439
|
+
|
440
|
+
with open(index_filename, "r") as f:
|
441
|
+
index = json.loads(f.read())
|
442
|
+
|
443
|
+
original_shard_filenames = sorted(set(index["weight_map"].values()))
|
444
|
+
sharded_metadata = index["metadata"]
|
445
|
+
sharded_metadata["all_checkpoint_keys"] = list(index["weight_map"].keys())
|
446
|
+
sharded_metadata["weight_map"] = index["weight_map"].copy()
|
447
|
+
shards_path = os.path.join(pretrained_model_name_or_path, subfolder)
|
448
|
+
|
449
|
+
# First, let's deal with local folder.
|
450
|
+
if os.path.isdir(pretrained_model_name_or_path):
|
451
|
+
_check_if_shards_exist_locally(
|
452
|
+
pretrained_model_name_or_path, subfolder=subfolder, original_shard_filenames=original_shard_filenames
|
453
|
+
)
|
454
|
+
return pretrained_model_name_or_path, sharded_metadata
|
455
|
+
|
456
|
+
# At this stage pretrained_model_name_or_path is a model identifier on the Hub
|
457
|
+
allow_patterns = original_shard_filenames
|
458
|
+
ignore_patterns = ["*.json", "*.md"]
|
459
|
+
if not local_files_only:
|
460
|
+
# `model_info` call must guarded with the above condition.
|
461
|
+
model_files_info = model_info(pretrained_model_name_or_path)
|
462
|
+
for shard_file in original_shard_filenames:
|
463
|
+
shard_file_present = any(shard_file in k.rfilename for k in model_files_info.siblings)
|
464
|
+
if not shard_file_present:
|
465
|
+
raise EnvironmentError(
|
466
|
+
f"{shards_path} does not appear to have a file named {shard_file} which is "
|
467
|
+
"required according to the checkpoint index."
|
468
|
+
)
|
469
|
+
|
470
|
+
try:
|
471
|
+
# Load from URL
|
472
|
+
cached_folder = snapshot_download(
|
473
|
+
pretrained_model_name_or_path,
|
474
|
+
cache_dir=cache_dir,
|
475
|
+
resume_download=resume_download,
|
476
|
+
proxies=proxies,
|
477
|
+
local_files_only=local_files_only,
|
478
|
+
token=token,
|
479
|
+
revision=revision,
|
480
|
+
allow_patterns=allow_patterns,
|
481
|
+
ignore_patterns=ignore_patterns,
|
482
|
+
user_agent=user_agent,
|
483
|
+
)
|
484
|
+
|
485
|
+
# We have already dealt with RepositoryNotFoundError and RevisionNotFoundError when getting the index, so
|
486
|
+
# we don't have to catch them here. We have also dealt with EntryNotFoundError.
|
487
|
+
except HTTPError as e:
|
488
|
+
raise EnvironmentError(
|
489
|
+
f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load {pretrained_model_name_or_path}. You should try"
|
490
|
+
" again after checking your internet connection."
|
491
|
+
) from e
|
492
|
+
|
493
|
+
# If `local_files_only=True`, `cached_folder` may not contain all the shard files.
|
494
|
+
if local_files_only:
|
495
|
+
_check_if_shards_exist_locally(
|
496
|
+
local_dir=cache_dir, subfolder=subfolder, original_shard_filenames=original_shard_filenames
|
497
|
+
)
|
498
|
+
|
499
|
+
return cached_folder, sharded_metadata
|
500
|
+
|
501
|
+
|
396
502
|
class PushToHubMixin:
|
397
503
|
"""
|
398
504
|
A Mixin to push a model, scheduler, or pipeline to the Hugging Face Hub.
|
diffusers/utils/import_utils.py
CHANGED
diffusers/utils/logging.py
CHANGED
@@ -82,7 +82,9 @@ def _configure_library_root_logger() -> None:
|
|
82
82
|
# This library has already configured the library root logger.
|
83
83
|
return
|
84
84
|
_default_handler = logging.StreamHandler() # Set sys.stderr as stream.
|
85
|
-
|
85
|
+
|
86
|
+
if sys.stderr: # only if sys.stderr exists, e.g. when not using pythonw in windows
|
87
|
+
_default_handler.flush = sys.stderr.flush
|
86
88
|
|
87
89
|
# Apply our default configuration to the library root logger.
|
88
90
|
library_root_logger = _get_library_root_logger()
|
@@ -62,6 +62,8 @@ DIFFUSERS_TO_PEFT = {
|
|
62
62
|
".out_proj.lora_linear_layer.down": ".out_proj.lora_A",
|
63
63
|
".lora_linear_layer.up": ".lora_B",
|
64
64
|
".lora_linear_layer.down": ".lora_A",
|
65
|
+
"text_projection.lora.down.weight": "text_projection.lora_A.weight",
|
66
|
+
"text_projection.lora.up.weight": "text_projection.lora_B.weight",
|
65
67
|
}
|
66
68
|
|
67
69
|
DIFFUSERS_OLD_TO_PEFT = {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: diffusers
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.29.0
|
4
4
|
Summary: State-of-the-art diffusion in PyTorch and JAX.
|
5
5
|
Home-page: https://github.com/huggingface/diffusers
|
6
6
|
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)
|
7
|
-
Author-email:
|
7
|
+
Author-email: diffusers@huggingface.co
|
8
8
|
License: Apache 2.0 License
|
9
9
|
Keywords: deep learning diffusion jax pytorch stable diffusion audioldm
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
@@ -23,81 +23,81 @@ Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
24
24
|
Requires-Dist: importlib-metadata
|
25
25
|
Requires-Dist: filelock
|
26
|
-
Requires-Dist: huggingface-hub >=0.
|
26
|
+
Requires-Dist: huggingface-hub (>=0.23.2)
|
27
27
|
Requires-Dist: numpy
|
28
|
-
Requires-Dist: regex !=2019.12.17
|
28
|
+
Requires-Dist: regex (!=2019.12.17)
|
29
29
|
Requires-Dist: requests
|
30
|
-
Requires-Dist: safetensors >=0.3.1
|
30
|
+
Requires-Dist: safetensors (>=0.3.1)
|
31
31
|
Requires-Dist: Pillow
|
32
32
|
Provides-Extra: dev
|
33
|
-
Requires-Dist: urllib3 <=2.0.0 ; extra == 'dev'
|
34
|
-
Requires-Dist: isort >=5.5.4 ; extra == 'dev'
|
35
|
-
Requires-Dist: ruff ==0.1.5 ; extra == 'dev'
|
36
|
-
Requires-Dist: hf-doc-builder >=0.3.0 ; extra == 'dev'
|
37
|
-
Requires-Dist: compel ==0.1.8 ; extra == 'dev'
|
38
|
-
Requires-Dist: GitPython <3.1.19 ; extra == 'dev'
|
33
|
+
Requires-Dist: urllib3 (<=2.0.0) ; extra == 'dev'
|
34
|
+
Requires-Dist: isort (>=5.5.4) ; extra == 'dev'
|
35
|
+
Requires-Dist: ruff (==0.1.5) ; extra == 'dev'
|
36
|
+
Requires-Dist: hf-doc-builder (>=0.3.0) ; extra == 'dev'
|
37
|
+
Requires-Dist: compel (==0.1.8) ; extra == 'dev'
|
38
|
+
Requires-Dist: GitPython (<3.1.19) ; extra == 'dev'
|
39
39
|
Requires-Dist: datasets ; extra == 'dev'
|
40
40
|
Requires-Dist: Jinja2 ; extra == 'dev'
|
41
|
-
Requires-Dist: invisible-watermark >=0.2.0 ; extra == 'dev'
|
42
|
-
Requires-Dist: k-diffusion >=0.0.12 ; extra == 'dev'
|
41
|
+
Requires-Dist: invisible-watermark (>=0.2.0) ; extra == 'dev'
|
42
|
+
Requires-Dist: k-diffusion (>=0.0.12) ; extra == 'dev'
|
43
43
|
Requires-Dist: librosa ; extra == 'dev'
|
44
44
|
Requires-Dist: parameterized ; extra == 'dev'
|
45
45
|
Requires-Dist: pytest ; extra == 'dev'
|
46
46
|
Requires-Dist: pytest-timeout ; extra == 'dev'
|
47
47
|
Requires-Dist: pytest-xdist ; extra == 'dev'
|
48
|
-
Requires-Dist: requests-mock ==1.10.0 ; extra == 'dev'
|
49
|
-
Requires-Dist: safetensors >=0.3.1 ; extra == 'dev'
|
50
|
-
Requires-Dist: sentencepiece !=0.1.92,>=0.1.91 ; extra == 'dev'
|
48
|
+
Requires-Dist: requests-mock (==1.10.0) ; extra == 'dev'
|
49
|
+
Requires-Dist: safetensors (>=0.3.1) ; extra == 'dev'
|
50
|
+
Requires-Dist: sentencepiece (!=0.1.92,>=0.1.91) ; extra == 'dev'
|
51
51
|
Requires-Dist: scipy ; extra == 'dev'
|
52
52
|
Requires-Dist: torchvision ; extra == 'dev'
|
53
|
-
Requires-Dist: transformers >=4.25.1 ; extra == 'dev'
|
54
|
-
Requires-Dist: accelerate >=0.29.3 ; extra == 'dev'
|
55
|
-
Requires-Dist: protobuf <4,>=3.20.3 ; extra == 'dev'
|
53
|
+
Requires-Dist: transformers (>=4.25.1) ; extra == 'dev'
|
54
|
+
Requires-Dist: accelerate (>=0.29.3) ; extra == 'dev'
|
55
|
+
Requires-Dist: protobuf (<4,>=3.20.3) ; extra == 'dev'
|
56
56
|
Requires-Dist: tensorboard ; extra == 'dev'
|
57
|
-
Requires-Dist: peft >=0.6.0 ; extra == 'dev'
|
58
|
-
Requires-Dist: torch >=1.4 ; extra == 'dev'
|
59
|
-
Requires-Dist: jax >=0.4.1 ; extra == 'dev'
|
60
|
-
Requires-Dist: jaxlib >=0.4.1 ; extra == 'dev'
|
61
|
-
Requires-Dist: flax >=0.4.1 ; extra == 'dev'
|
57
|
+
Requires-Dist: peft (>=0.6.0) ; extra == 'dev'
|
58
|
+
Requires-Dist: torch (>=1.4) ; extra == 'dev'
|
59
|
+
Requires-Dist: jax (>=0.4.1) ; extra == 'dev'
|
60
|
+
Requires-Dist: jaxlib (>=0.4.1) ; extra == 'dev'
|
61
|
+
Requires-Dist: flax (>=0.4.1) ; extra == 'dev'
|
62
62
|
Provides-Extra: docs
|
63
|
-
Requires-Dist: hf-doc-builder >=0.3.0 ; extra == 'docs'
|
63
|
+
Requires-Dist: hf-doc-builder (>=0.3.0) ; extra == 'docs'
|
64
64
|
Provides-Extra: flax
|
65
|
-
Requires-Dist: jax >=0.4.1 ; extra == 'flax'
|
66
|
-
Requires-Dist: jaxlib >=0.4.1 ; extra == 'flax'
|
67
|
-
Requires-Dist: flax >=0.4.1 ; extra == 'flax'
|
65
|
+
Requires-Dist: jax (>=0.4.1) ; extra == 'flax'
|
66
|
+
Requires-Dist: jaxlib (>=0.4.1) ; extra == 'flax'
|
67
|
+
Requires-Dist: flax (>=0.4.1) ; extra == 'flax'
|
68
68
|
Provides-Extra: quality
|
69
|
-
Requires-Dist: urllib3 <=2.0.0 ; extra == 'quality'
|
70
|
-
Requires-Dist: isort >=5.5.4 ; extra == 'quality'
|
71
|
-
Requires-Dist: ruff ==0.1.5 ; extra == 'quality'
|
72
|
-
Requires-Dist: hf-doc-builder >=0.3.0 ; extra == 'quality'
|
69
|
+
Requires-Dist: urllib3 (<=2.0.0) ; extra == 'quality'
|
70
|
+
Requires-Dist: isort (>=5.5.4) ; extra == 'quality'
|
71
|
+
Requires-Dist: ruff (==0.1.5) ; extra == 'quality'
|
72
|
+
Requires-Dist: hf-doc-builder (>=0.3.0) ; extra == 'quality'
|
73
73
|
Provides-Extra: test
|
74
|
-
Requires-Dist: compel ==0.1.8 ; extra == 'test'
|
75
|
-
Requires-Dist: GitPython <3.1.19 ; extra == 'test'
|
74
|
+
Requires-Dist: compel (==0.1.8) ; extra == 'test'
|
75
|
+
Requires-Dist: GitPython (<3.1.19) ; extra == 'test'
|
76
76
|
Requires-Dist: datasets ; extra == 'test'
|
77
77
|
Requires-Dist: Jinja2 ; extra == 'test'
|
78
|
-
Requires-Dist: invisible-watermark >=0.2.0 ; extra == 'test'
|
79
|
-
Requires-Dist: k-diffusion >=0.0.12 ; extra == 'test'
|
78
|
+
Requires-Dist: invisible-watermark (>=0.2.0) ; extra == 'test'
|
79
|
+
Requires-Dist: k-diffusion (>=0.0.12) ; extra == 'test'
|
80
80
|
Requires-Dist: librosa ; extra == 'test'
|
81
81
|
Requires-Dist: parameterized ; extra == 'test'
|
82
82
|
Requires-Dist: pytest ; extra == 'test'
|
83
83
|
Requires-Dist: pytest-timeout ; extra == 'test'
|
84
84
|
Requires-Dist: pytest-xdist ; extra == 'test'
|
85
|
-
Requires-Dist: requests-mock ==1.10.0 ; extra == 'test'
|
86
|
-
Requires-Dist: safetensors >=0.3.1 ; extra == 'test'
|
87
|
-
Requires-Dist: sentencepiece !=0.1.92,>=0.1.91 ; extra == 'test'
|
85
|
+
Requires-Dist: requests-mock (==1.10.0) ; extra == 'test'
|
86
|
+
Requires-Dist: safetensors (>=0.3.1) ; extra == 'test'
|
87
|
+
Requires-Dist: sentencepiece (!=0.1.92,>=0.1.91) ; extra == 'test'
|
88
88
|
Requires-Dist: scipy ; extra == 'test'
|
89
89
|
Requires-Dist: torchvision ; extra == 'test'
|
90
|
-
Requires-Dist: transformers >=4.25.1 ; extra == 'test'
|
90
|
+
Requires-Dist: transformers (>=4.25.1) ; extra == 'test'
|
91
91
|
Provides-Extra: torch
|
92
|
-
Requires-Dist: torch >=1.4 ; extra == 'torch'
|
93
|
-
Requires-Dist: accelerate >=0.29.3 ; extra == 'torch'
|
92
|
+
Requires-Dist: torch (>=1.4) ; extra == 'torch'
|
93
|
+
Requires-Dist: accelerate (>=0.29.3) ; extra == 'torch'
|
94
94
|
Provides-Extra: training
|
95
|
-
Requires-Dist: accelerate >=0.29.3 ; extra == 'training'
|
95
|
+
Requires-Dist: accelerate (>=0.29.3) ; extra == 'training'
|
96
96
|
Requires-Dist: datasets ; extra == 'training'
|
97
|
-
Requires-Dist: protobuf <4,>=3.20.3 ; extra == 'training'
|
97
|
+
Requires-Dist: protobuf (<4,>=3.20.3) ; extra == 'training'
|
98
98
|
Requires-Dist: tensorboard ; extra == 'training'
|
99
99
|
Requires-Dist: Jinja2 ; extra == 'training'
|
100
|
-
Requires-Dist: peft >=0.6.0 ; extra == 'training'
|
100
|
+
Requires-Dist: peft (>=0.6.0) ; extra == 'training'
|
101
101
|
|
102
102
|
<!---
|
103
103
|
Copyright 2022 - The HuggingFace Team. All rights reserved.
|