-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add vae image processor #1219
add vae image processor #1219
Changes from 8 commits
ce33c37
a96b841
ecb5f3b
55d011f
3e93a84
e0c3078
2513773
458ae95
d8b28c3
35b452b
09652d9
50a69c9
8a78313
dd292d8
99f4018
c2d966b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
StableDiffusionXLImg2ImgPipeline, | ||
) | ||
from diffusers.schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME | ||
from diffusers.utils import CONFIG_NAME | ||
from diffusers.utils import CONFIG_NAME, is_invisible_watermark_available | ||
from huggingface_hub import snapshot_download | ||
from transformers import CLIPFeatureExtractor, CLIPTokenizer | ||
from transformers.file_utils import add_end_docstrings | ||
|
@@ -45,6 +45,7 @@ | |
from ..pipelines.diffusers.pipeline_stable_diffusion_inpaint import StableDiffusionInpaintPipelineMixin | ||
from ..pipelines.diffusers.pipeline_stable_diffusion_xl import StableDiffusionXLPipelineMixin | ||
from ..pipelines.diffusers.pipeline_stable_diffusion_xl_img2img import StableDiffusionXLImg2ImgPipelineMixin | ||
from ..pipelines.diffusers.pipeline_utils import OptimumVaeImageProcessor | ||
from ..utils import ( | ||
DIFFUSION_MODEL_TEXT_ENCODER_2_SUBFOLDER, | ||
DIFFUSION_MODEL_TEXT_ENCODER_SUBFOLDER, | ||
|
@@ -171,6 +172,8 @@ def __init__( | |
else: | ||
self.vae_scale_factor = 8 | ||
|
||
self.image_processor = OptimumVaeImageProcessor(vae_scale_factor=self.vae_scale_factor) | ||
|
||
@staticmethod | ||
def load_model( | ||
vae_decoder_path: Union[str, Path], | ||
|
@@ -578,6 +581,7 @@ def __init__( | |
tokenizer_2: Optional[CLIPTokenizer] = None, | ||
use_io_binding: Optional[bool] = None, | ||
model_save_dir: Optional[Union[str, Path, TemporaryDirectory]] = None, | ||
add_watermarker: Optional[bool] = None, | ||
): | ||
super().__init__( | ||
vae_decoder_session=vae_decoder_session, | ||
|
@@ -593,11 +597,14 @@ def __init__( | |
use_io_binding=use_io_binding, | ||
model_save_dir=model_save_dir, | ||
) | ||
add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available() | ||
|
||
# additional invisible-watermark dependency for SD XL | ||
from ..pipelines.diffusers.watermark import StableDiffusionXLWatermarker | ||
if add_watermarker: | ||
from ..pipelines.diffusers.watermark import StableDiffusionXLWatermarker | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this import be at the top of the file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No without making |
||
|
||
self.watermark = StableDiffusionXLWatermarker() | ||
self.watermark = StableDiffusionXLWatermarker() | ||
else: | ||
self.watermark = None | ||
|
||
|
||
@add_end_docstrings(ONNX_MODEL_END_DOCSTRING) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting fordiffusers
next release before we can mergeedit : now comaptible