forked from open-mmlab/mmagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stable-diffusion_xl_ddim_denoisingunet.py
40 lines (38 loc) · 1.17 KB
/
stable-diffusion_xl_ddim_denoisingunet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Use DiffuserWrapper!
stable_diffusion_xl_url = 'stabilityai/stable-diffusion-xl-base-1.0'
unet = dict(
type='UNet2DConditionModel',
subfolder='unet',
from_pretrained=stable_diffusion_xl_url)
vae = dict(
type='AutoencoderKL',
from_pretrained=stable_diffusion_xl_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='StableDiffusionXL',
unet=unet,
vae=vae,
enable_xformers=False,
text_encoder_one=dict(
type='ClipWrapper',
clip_type='huggingface',
pretrained_model_name_or_path=stable_diffusion_xl_url,
subfolder='text_encoder'),
tokenizer_one=stable_diffusion_xl_url,
text_encoder_two=dict(
type='ClipWrapper',
clip_type='huggingface',
pretrained_model_name_or_path=stable_diffusion_xl_url,
subfolder='text_encoder_2'),
tokenizer_two=stable_diffusion_xl_url,
scheduler=diffusion_scheduler,
test_scheduler=diffusion_scheduler)