Zhiminli commited on
Commit
b156b54
1 Parent(s): 256e41e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -31
README.md CHANGED
@@ -10,7 +10,8 @@ language:
10
 
11
  ### Instructions
12
 
13
- The dependencies and installation are basically the same as the [**base model**](https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.1).
 
14
 
15
  We provide three types of ControlNet weights for you to test: canny, depth and pose ControlNet.
16
 
@@ -24,7 +25,7 @@ huggingface-cli download Tencent-Hunyuan/HYDiT-ControlNet-v1.2 --local-dir ./ckp
24
  huggingface-cli download Tencent-Hunyuan/Distillation-v1.2 ./pytorch_model_distill.pt --local-dir ./ckpts/t2i/model
25
 
26
  # Quick start
27
- python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg --control-weight 1.0 --infer-mode fa
28
  ```
29
 
30
  Examples of condition input and ControlNet results are as follows:
@@ -86,33 +87,29 @@ We provide three types of weights for ControlNet training, `ema`, `module` and `
86
 
87
  Here is an example, we load the `distill` weights into the main model and conduct ControlNet training.
88
 
89
- If you want to load the `module` weights into the main model, just remove the `--ema-to-module` parameter.
90
-
91
  If apply multiple resolution training, you need to add the `--multireso` and `--reso-step 64` parameter.
92
 
93
  ```bash
94
- task_flag="canny_controlnet" # task flag is used to identify folders.
95
  control_type=canny
96
- resume=./ckpts/t2i/model/ # checkpoint root for resume
97
- index_file=path/to/your/index_file
98
- results_dir=./log_EXP # save root for results
99
- batch_size=1 # training batch size
100
- image_size=1024 # training image resolution
101
- grad_accu_steps=2 # gradient accumulation
102
- warmup_num_steps=0 # warm-up steps
103
- lr=0.0001 # learning rate
104
- ckpt_every=10000 # create a ckpt every a few steps.
105
- ckpt_latest_every=5000 # create a ckpt named `latest.pt` every a few steps.
 
106
 
107
 
108
  sh $(dirname "$0")/run_g_controlnet.sh \
109
  --task-flag ${task_flag} \
110
  --control-type ${control_type} \
111
- --noise-schedule scaled_linear --beta-start 0.00085 --beta-end 0.03 \
112
  --predict-type v_prediction \
113
- --multireso \
114
- --reso-step 64 \
115
- --ema-to-module \
116
  --uncond-p 0.44 \
117
  --uncond-p-t5 0.44 \
118
  --index-file ${index_file} \
@@ -125,18 +122,19 @@ sh $(dirname "$0")/run_g_controlnet.sh \
125
  --warmup-num-steps ${warmup_num_steps} \
126
  --use-flash-attn \
127
  --use-fp16 \
128
- --use-ema \
129
- --ema-dtype fp32 \
130
  --results-dir ${results_dir} \
131
- --resume-split \
132
- --resume ${resume} \
 
133
  --ckpt-every ${ckpt_every} \
134
  --ckpt-latest-every ${ckpt_latest_every} \
135
  --log-every 10 \
136
  --deepspeed \
137
  --deepspeed-optimizer \
138
  --use-zero-stage 2 \
 
139
  "$@"
 
140
  ```
141
 
142
  Recommended parameter settings
@@ -154,26 +152,26 @@ You can use the following command line for inference.
154
 
155
  a. You can use a float to specify the weight for all layers, **or use a list to separately specify the weight for each layer**, for example, '[1.0 * (0.825 ** float(19 - i)) for i in range(19)]'
156
  ```bash
157
- python3 sample_controlnet.py --control-weight [1.0 * (0.825 ** float(19 - i)) for i in range(19)] --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg --infer-mode fa
158
  ```
159
 
160
  b. Using canny ControlNet during inference
161
 
162
  ```bash
163
- python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg --control-weight 1.0 --infer-mode fa
164
  ```
165
 
166
  c. Using depth ControlNet during inference
167
 
168
  ```bash
169
- python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type depth --prompt "在茂密的森林中,一只黑白相间的熊猫静静地坐在绿树红花中,周围是山川和海洋。背景是白天的森林,光线充足。照片采用特写、平视和居中构图的方式,呈现出写实的效果" --condition-image-path controlnet/asset/input/depth.jpg --control-weight 1.0 --infer-mode fa
170
  ```
171
 
172
  d. Using pose ControlNet during inference
173
 
174
 
175
  ```bash
176
- python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type pose --prompt "在白天的森林中,一位穿着绿色上衣的亚洲女性站在大象旁边。照片采用了中景、平视和居中构图的方式,呈现出写实的效果。这张照片蕴含了人物摄影文化,并展现了宁静的氛围" --condition-image-path controlnet/asset/input/pose.jpg --control-weight 1.0 --infer-mode fa
177
  ```
178
 
179
  ## HunyuanDiT Controlnet v1.1
@@ -193,7 +191,7 @@ huggingface-cli download Tencent-Hunyuan/Distillation-v1.1 ./pytorch_model_disti
193
  ```bash
194
  task_flag="canny_controlnet" # the task flag is used to identify folders.
195
  control_type=canny
196
- resume=./HunyuanDiT-v1.1/t2i/model/ # checkpoint root for resume
197
  index_file=/path/to/your/indexfile # index file for dataloader
198
  results_dir=./log_EXP # save root for results
199
  batch_size=1 # training batch size
@@ -213,7 +211,6 @@ sh $(dirname "$0")/run_g_controlnet.sh \
213
  --predict-type v_prediction \
214
  --multireso \
215
  --reso-step 64 \
216
- --ema-to-module \
217
  --uncond-p 0.44 \
218
  --uncond-p-t5 0.44 \
219
  --index-file ${index_file} \
@@ -227,8 +224,8 @@ sh $(dirname "$0")/run_g_controlnet.sh \
227
  --use-flash-attn \
228
  --use-fp16 \
229
  --results-dir ${results_dir} \
230
- --resume-split \
231
- --resume ${resume} \
232
  --epochs ${epochs} \
233
  --ckpt-every ${ckpt_every} \
234
  --ckpt-latest-every ${ckpt_latest_every} \
@@ -261,3 +258,4 @@ c. Using pose ControlNet during inference
261
  ```bash
262
  python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type pose --prompt "一位亚洲女性,身穿绿色上衣,戴着紫色头巾和紫色围巾,站在黑板前。背景是黑板。照片采用近景、平视和居中构图的方式呈现真实摄影风格" --condition-image-path controlnet/asset/input/pose.jpg --control-weight 1.0 --use-style-cond --size-cond 1024 1024 --beta-end 0.03
263
  ```
 
 
10
 
11
  ### Instructions
12
 
13
+
14
+ The dependencies and installation are basically the same as the [**base model**](https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.2).
15
 
16
  We provide three types of ControlNet weights for you to test: canny, depth and pose ControlNet.
17
 
 
25
  huggingface-cli download Tencent-Hunyuan/Distillation-v1.2 ./pytorch_model_distill.pt --local-dir ./ckpts/t2i/model
26
 
27
  # Quick start
28
+ python sample_controlnet.py --infer-mode fa --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg --control-weight 1.0
29
  ```
30
 
31
  Examples of condition input and ControlNet results are as follows:
 
87
 
88
  Here is an example, we load the `distill` weights into the main model and conduct ControlNet training.
89
 
 
 
90
  If apply multiple resolution training, you need to add the `--multireso` and `--reso-step 64` parameter.
91
 
92
  ```bash
93
+ task_flag="canny_controlnet" # the task flag is used to identify folders.
94
  control_type=canny
95
+ resume_module_root=./ckpts/t2i/model/pytorch_model_distill.pt # checkpoint root for resume
96
+ index_file=/path/to/your/indexfile # index file for dataloader
97
+ results_dir=./log_EXP # save root for results
98
+ batch_size=1 # training batch size
99
+ image_size=1024 # training image resolution
100
+ grad_accu_steps=2 # gradient accumulation
101
+ warmup_num_steps=0 # warm-up steps
102
+ lr=0.0001 # learning rate
103
+ ckpt_every=10000 # create a ckpt every a few steps.
104
+ ckpt_latest_every=5000 # create a ckpt named `latest.pt` every a few steps.
105
+ epochs=100 # total training epochs
106
 
107
 
108
  sh $(dirname "$0")/run_g_controlnet.sh \
109
  --task-flag ${task_flag} \
110
  --control-type ${control_type} \
111
+ --noise-schedule scaled_linear --beta-start 0.00085 --beta-end 0.018 \
112
  --predict-type v_prediction \
 
 
 
113
  --uncond-p 0.44 \
114
  --uncond-p-t5 0.44 \
115
  --index-file ${index_file} \
 
122
  --warmup-num-steps ${warmup_num_steps} \
123
  --use-flash-attn \
124
  --use-fp16 \
 
 
125
  --results-dir ${results_dir} \
126
+ --resume \
127
+ --resume-module-root ${resume_module_root} \
128
+ --epochs ${epochs} \
129
  --ckpt-every ${ckpt_every} \
130
  --ckpt-latest-every ${ckpt_latest_every} \
131
  --log-every 10 \
132
  --deepspeed \
133
  --deepspeed-optimizer \
134
  --use-zero-stage 2 \
135
+ --gradient-checkpointing \
136
  "$@"
137
+
138
  ```
139
 
140
  Recommended parameter settings
 
152
 
153
  a. You can use a float to specify the weight for all layers, **or use a list to separately specify the weight for each layer**, for example, '[1.0 * (0.825 ** float(19 - i)) for i in range(19)]'
154
  ```bash
155
+ python sample_controlnet.py --infer-mode fa --control-weight "[1.0 * (0.825 ** float(19 - i)) for i in range(19)]" --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg
156
  ```
157
 
158
  b. Using canny ControlNet during inference
159
 
160
  ```bash
161
+ python sample_controlnet.py --infer-mode fa --control-weight 1.0 --no-enhance --load-key distill --infer-steps 50 --control-type canny --prompt "在夜晚的酒店门前,一座古老的中国风格的狮子雕像矗立着,它的眼睛闪烁着光芒,仿佛在守护着这座建筑。背景是夜晚的酒店前,构图方式是特写,平视,居中构图。这张照片呈现了真实摄影风格,蕴含了中国雕塑文化,同时展现了神秘氛围" --condition-image-path controlnet/asset/input/canny.jpg
162
  ```
163
 
164
  c. Using depth ControlNet during inference
165
 
166
  ```bash
167
+ python sample_controlnet.py --infer-mode fa --control-weight 1.0 --no-enhance --load-key distill --infer-steps 50 --control-type depth --prompt "在茂密的森林中,一只黑白相间的熊猫静静地坐在绿树红花中,周围是山川和海洋。背景是白天的森林,光线充足。照片采用特写、平视和居中构图的方式,呈现出写实的效果" --condition-image-path controlnet/asset/input/depth.jpg
168
  ```
169
 
170
  d. Using pose ControlNet during inference
171
 
172
 
173
  ```bash
174
+ python3 sample_controlnet.py --infer-mode fa --control-weight 1.0 --no-enhance --load-key distill --infer-steps 50 --control-type pose --prompt "在白天的森林中,一位穿着绿色上衣的亚洲女性站在大象旁边。照片采用了中景、平视和居中构图的方式,呈现出写实的效果。这张照片蕴含了人物摄影文化,并展现了宁静的氛围" --condition-image-path controlnet/asset/input/pose.jpg
175
  ```
176
 
177
  ## HunyuanDiT Controlnet v1.1
 
191
  ```bash
192
  task_flag="canny_controlnet" # the task flag is used to identify folders.
193
  control_type=canny
194
+ resume_module_root=./ckpts/t2i/model/pytorch_model_distill.pt # checkpoint root for resume
195
  index_file=/path/to/your/indexfile # index file for dataloader
196
  results_dir=./log_EXP # save root for results
197
  batch_size=1 # training batch size
 
211
  --predict-type v_prediction \
212
  --multireso \
213
  --reso-step 64 \
 
214
  --uncond-p 0.44 \
215
  --uncond-p-t5 0.44 \
216
  --index-file ${index_file} \
 
224
  --use-flash-attn \
225
  --use-fp16 \
226
  --results-dir ${results_dir} \
227
+ --resume \
228
+ --resume-module-root ${resume_module_root} \
229
  --epochs ${epochs} \
230
  --ckpt-every ${ckpt_every} \
231
  --ckpt-latest-every ${ckpt_latest_every} \
 
258
  ```bash
259
  python3 sample_controlnet.py --no-enhance --load-key distill --infer-steps 50 --control-type pose --prompt "一位亚洲女性,身穿绿色上衣,戴着紫色头巾和紫色围巾,站在黑板前。背景是黑板。照片采用近景、平视和居中构图的方式呈现真实摄影风格" --condition-image-path controlnet/asset/input/pose.jpg --control-weight 1.0 --use-style-cond --size-cond 1024 1024 --beta-end 0.03
260
  ```
261
+