Skip to content

Commit 6582570

Browse files
Merge branch 'huggingface:main' into main
2 parents 798b492 + d06750a commit 6582570

File tree

7 files changed

+826
-4
lines changed

7 files changed

+826
-4
lines changed

src/diffusers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@
495495
"LTXImageToVideoPipeline",
496496
"LTXLatentUpsamplePipeline",
497497
"LTXPipeline",
498+
"LucyEditPipeline",
498499
"Lumina2Pipeline",
499500
"Lumina2Text2ImgPipeline",
500501
"LuminaPipeline",
@@ -1149,6 +1150,7 @@
11491150
LTXImageToVideoPipeline,
11501151
LTXLatentUpsamplePipeline,
11511152
LTXPipeline,
1153+
LucyEditPipeline,
11521154
Lumina2Pipeline,
11531155
Lumina2Text2ImgPipeline,
11541156
LuminaPipeline,

src/diffusers/models/autoencoders/autoencoder_kl_wan.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ def __init__(
10521052
is_residual=is_residual,
10531053
)
10541054

1055-
self.spatial_compression_ratio = 2 ** len(self.temperal_downsample)
1055+
self.spatial_compression_ratio = scale_factor_spatial
10561056

10571057
# When decoding a batch of video latents at a time, one can save memory by slicing across the batch dimension
10581058
# to perform decoding of a single video latent at a time.
@@ -1145,12 +1145,13 @@ def clear_cache(self):
11451145
def _encode(self, x: torch.Tensor):
11461146
_, _, num_frame, height, width = x.shape
11471147

1148-
if self.use_tiling and (width > self.tile_sample_min_width or height > self.tile_sample_min_height):
1149-
return self.tiled_encode(x)
1150-
11511148
self.clear_cache()
11521149
if self.config.patch_size is not None:
11531150
x = patchify(x, patch_size=self.config.patch_size)
1151+
1152+
if self.use_tiling and (width > self.tile_sample_min_width or height > self.tile_sample_min_height):
1153+
return self.tiled_encode(x)
1154+
11541155
iter_ = 1 + (num_frame - 1) // 4
11551156
for i in range(iter_):
11561157
self._enc_conv_idx = [0]

src/diffusers/pipelines/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@
285285
]
286286
_import_structure["lumina"] = ["LuminaPipeline", "LuminaText2ImgPipeline"]
287287
_import_structure["lumina2"] = ["Lumina2Pipeline", "Lumina2Text2ImgPipeline"]
288+
_import_structure["lucy"] = ["LucyEditPipeline"]
288289
_import_structure["marigold"].extend(
289290
[
290291
"MarigoldDepthPipeline",
@@ -682,6 +683,7 @@
682683
LEditsPPPipelineStableDiffusionXL,
683684
)
684685
from .ltx import LTXConditionPipeline, LTXImageToVideoPipeline, LTXLatentUpsamplePipeline, LTXPipeline
686+
from .lucy import LucyEditPipeline
685687
from .lumina import LuminaPipeline, LuminaText2ImgPipeline
686688
from .lumina2 import Lumina2Pipeline, Lumina2Text2ImgPipeline
687689
from .marigold import (
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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_lucy_edit"] = ["LucyEditPipeline"]
26+
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
27+
try:
28+
if not (is_transformers_available() and is_torch_available()):
29+
raise OptionalDependencyNotAvailable()
30+
31+
except OptionalDependencyNotAvailable:
32+
from ...utils.dummy_torch_and_transformers_objects import *
33+
else:
34+
from .pipeline_lucy_edit import LucyEditPipeline
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+
46+
for name, value in _dummy_objects.items():
47+
setattr(sys.modules[__name__], name, value)

0 commit comments

Comments
 (0)