Skip to content

Commit 491bc9f

Browse files
committed
fix setup for watermarking.
1 parent 9b918eb commit 491bc9f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"torchvision",
118118
"transformers>=4.25.1",
119119
"urllib3<=2.0.0",
120+
"invisible-watermark"
120121
]
121122

122123
# this is a lookup table with items like:
@@ -207,6 +208,7 @@ def run(self):
207208
"scipy",
208209
"torchvision",
209210
"transformers",
211+
"invisible-watermark",
210212
)
211213
extras["torch"] = deps_list("torch", "accelerate")
212214

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@
3131
from ...utils import (
3232
is_accelerate_available,
3333
is_accelerate_version,
34+
is_invisible_watermark_available,
3435
logging,
3536
randn_tensor,
3637
replace_example_docstring,
3738
)
3839
from ..pipeline_utils import DiffusionPipeline
3940
from . import StableDiffusionXLPipelineOutput
40-
from .watermark import StableDiffusionXLWatermarker
41+
42+
43+
if is_invisible_watermark_available():
44+
from .watermark import StableDiffusionXLWatermarker
45+
else:
46+
raise ImportError("StableDiffusionXLWatermarker requires the `invisible-watermark` library installed.")
4147

4248

4349
logger = logging.get_logger(__name__) # pylint: disable=invalid-name

tests/others/test_dependencies.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ def test_backend_registration(self):
3434
for backend in cls_module._backends:
3535
if backend == "k_diffusion":
3636
backend = "k-diffusion"
37+
elif backend == "invisible_watermark":
38+
backend = "invisible-watermark"
3739
assert backend in deps, f"{backend} is not in the deps table!"

0 commit comments

Comments
 (0)