-
Notifications
You must be signed in to change notification settings - Fork 319
/
constants.py
82 lines (73 loc) · 2.15 KB
/
constants.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import torch
# =======================================================
NOISE_SCHEDULES = {
"linear",
"scaled_linear",
"squaredcos_cap_v2",
}
PREDICT_TYPE = {
"epsilon",
"sample",
"v_prediction",
}
# =======================================================
NEGATIVE_PROMPT = "错误的眼睛,糟糕的人脸,毁容,糟糕的艺术,变形,多余的肢体,模糊的颜色,模糊,重复,病态,残缺,"
# =======================================================
TRT_MAX_BATCH_SIZE = 1
TRT_MAX_WIDTH = 1280
TRT_MAX_HEIGHT = 1280
# =======================================================
# Constants about models
# =======================================================
VAE_EMA_PATH = "ckpts/t2i/sdxl-vae-fp16-fix"
TOKENIZER = "ckpts/t2i/tokenizer"
TEXT_ENCODER = "ckpts/t2i/clip_text_encoder"
T5_ENCODER = {
"MT5": "ckpts/t2i/mt5",
"attention_mask": True,
"layer_index": -1,
"attention_pool": True,
"torch_dtype": torch.float16,
"learnable_replace": True,
}
SAMPLER_FACTORY = {
"ddpm": {
"scheduler": "DDPMScheduler",
"name": "DDPM",
"kwargs": {
"steps_offset": 1,
"clip_sample": False,
"clip_sample_range": 1.0,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"beta_end": 0.02,
"prediction_type": "v_prediction",
},
},
"ddim": {
"scheduler": "DDIMScheduler",
"name": "DDIM",
"kwargs": {
"steps_offset": 1,
"clip_sample": False,
"clip_sample_range": 1.0,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"beta_end": 0.02,
"prediction_type": "v_prediction",
},
},
"dpmms": {
"scheduler": "DPMSolverMultistepScheduler",
"name": "DPMMS",
"kwargs": {
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"beta_end": 0.02,
"prediction_type": "v_prediction",
"trained_betas": None,
"solver_order": 2,
"algorithm_type": "dpmsolver++",
},
},
}