forked from open-mmlab/mmagic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Taited/stable diffusion inpaint (open-mmlab#1976)
* support stable diffusion inpaint * add unit test for stable diffusion inpaint * fix unit tests and update model zoo error * fix unit test bug * fix unit test error, add attribute latent_channels for vae * fix lint: add the new config in readme * improve docstrings and readme for stable diffusion inpaint * add copyright of HuggingFace Team and markdown code language type --------- Co-authored-by: zengyanhong <[email protected]>
- Loading branch information
1 parent
66e4637
commit 0448b89
Showing
9 changed files
with
730 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
configs/stable_diffusion/stable-diffusion_ddim_denoisingunet-inpaint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Use DiffuserWrapper! | ||
stable_diffusion_v15_url = 'runwayml/stable-diffusion-inpainting' | ||
unet = dict( | ||
type='UNet2DConditionModel', | ||
subfolder='unet', | ||
from_pretrained=stable_diffusion_v15_url) | ||
vae = dict( | ||
type='AutoencoderKL', | ||
from_pretrained=stable_diffusion_v15_url, | ||
subfolder='vae') | ||
|
||
diffusion_scheduler = dict( | ||
type='EditDDIMScheduler', | ||
variance_type='learned_range', | ||
beta_end=0.012, | ||
beta_schedule='scaled_linear', | ||
beta_start=0.00085, | ||
num_train_timesteps=1000, | ||
set_alpha_to_one=False, | ||
clip_sample=False) | ||
|
||
model = dict( | ||
type='StableDiffusionInpaint', | ||
unet=unet, | ||
vae=vae, | ||
enable_xformers=False, | ||
text_encoder=dict( | ||
type='ClipWrapper', | ||
clip_type='huggingface', | ||
pretrained_model_name_or_path=stable_diffusion_v15_url, | ||
subfolder='text_encoder'), | ||
tokenizer=stable_diffusion_v15_url, | ||
scheduler=diffusion_scheduler, | ||
test_scheduler=diffusion_scheduler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from .stable_diffusion import StableDiffusion | ||
from .stable_diffusion_inpaint import StableDiffusionInpaint | ||
from .vae import AutoencoderKL | ||
|
||
__all__ = ['StableDiffusion', 'AutoencoderKL'] | ||
__all__ = ['StableDiffusion', 'AutoencoderKL', 'StableDiffusionInpaint'] |
Oops, something went wrong.