hcpdiff 0.9.1__py3-none-any.whl → 2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. hcpdiff/__init__.py +4 -4
  2. hcpdiff/ckpt_manager/__init__.py +4 -5
  3. hcpdiff/ckpt_manager/ckpt.py +24 -0
  4. hcpdiff/ckpt_manager/format/__init__.py +4 -0
  5. hcpdiff/ckpt_manager/format/diffusers.py +59 -0
  6. hcpdiff/ckpt_manager/format/emb.py +21 -0
  7. hcpdiff/ckpt_manager/format/lora_webui.py +252 -0
  8. hcpdiff/ckpt_manager/format/sd_single.py +41 -0
  9. hcpdiff/ckpt_manager/loader.py +64 -0
  10. hcpdiff/data/__init__.py +4 -28
  11. hcpdiff/data/cache/__init__.py +1 -0
  12. hcpdiff/data/cache/vae.py +102 -0
  13. hcpdiff/data/dataset.py +20 -0
  14. hcpdiff/data/handler/__init__.py +3 -0
  15. hcpdiff/data/handler/controlnet.py +18 -0
  16. hcpdiff/data/handler/diffusion.py +90 -0
  17. hcpdiff/data/handler/text.py +111 -0
  18. hcpdiff/data/source/__init__.py +3 -3
  19. hcpdiff/data/source/folder_class.py +12 -29
  20. hcpdiff/data/source/text.py +40 -0
  21. hcpdiff/data/source/text2img.py +36 -74
  22. hcpdiff/data/source/text2img_cond.py +9 -15
  23. hcpdiff/diffusion/__init__.py +0 -0
  24. hcpdiff/diffusion/noise/__init__.py +2 -0
  25. hcpdiff/diffusion/noise/pyramid_noise.py +42 -0
  26. hcpdiff/diffusion/noise/zero_terminal.py +39 -0
  27. hcpdiff/diffusion/sampler/__init__.py +5 -0
  28. hcpdiff/diffusion/sampler/base.py +72 -0
  29. hcpdiff/diffusion/sampler/ddpm.py +20 -0
  30. hcpdiff/diffusion/sampler/diffusers.py +66 -0
  31. hcpdiff/diffusion/sampler/edm.py +22 -0
  32. hcpdiff/diffusion/sampler/sigma_scheduler/__init__.py +3 -0
  33. hcpdiff/diffusion/sampler/sigma_scheduler/base.py +14 -0
  34. hcpdiff/diffusion/sampler/sigma_scheduler/ddpm.py +197 -0
  35. hcpdiff/diffusion/sampler/sigma_scheduler/edm.py +48 -0
  36. hcpdiff/easy/__init__.py +2 -0
  37. hcpdiff/easy/cfg/__init__.py +3 -0
  38. hcpdiff/easy/cfg/sd15_train.py +207 -0
  39. hcpdiff/easy/cfg/sdxl_train.py +147 -0
  40. hcpdiff/easy/cfg/t2i.py +228 -0
  41. hcpdiff/easy/model/__init__.py +2 -0
  42. hcpdiff/easy/model/cnet.py +31 -0
  43. hcpdiff/easy/model/loader.py +79 -0
  44. hcpdiff/easy/sampler.py +46 -0
  45. hcpdiff/evaluate/__init__.py +1 -0
  46. hcpdiff/evaluate/previewer.py +60 -0
  47. hcpdiff/loss/__init__.py +4 -1
  48. hcpdiff/loss/base.py +41 -0
  49. hcpdiff/loss/gw.py +35 -0
  50. hcpdiff/loss/ssim.py +37 -0
  51. hcpdiff/loss/vlb.py +79 -0
  52. hcpdiff/loss/weighting.py +66 -0
  53. hcpdiff/models/__init__.py +2 -2
  54. hcpdiff/models/cfg_context.py +17 -14
  55. hcpdiff/models/compose/compose_hook.py +44 -23
  56. hcpdiff/models/compose/compose_tokenizer.py +21 -8
  57. hcpdiff/models/compose/sdxl_composer.py +4 -4
  58. hcpdiff/models/controlnet.py +16 -16
  59. hcpdiff/models/lora_base_patch.py +14 -25
  60. hcpdiff/models/lora_layers.py +3 -9
  61. hcpdiff/models/lora_layers_patch.py +14 -24
  62. hcpdiff/models/text_emb_ex.py +84 -6
  63. hcpdiff/models/textencoder_ex.py +54 -18
  64. hcpdiff/models/wrapper/__init__.py +3 -0
  65. hcpdiff/models/wrapper/pixart.py +19 -0
  66. hcpdiff/models/wrapper/sd.py +218 -0
  67. hcpdiff/models/wrapper/utils.py +20 -0
  68. hcpdiff/parser/__init__.py +1 -0
  69. hcpdiff/parser/embpt.py +32 -0
  70. hcpdiff/tools/convert_caption_txt2json.py +1 -1
  71. hcpdiff/tools/dataset_generator.py +94 -0
  72. hcpdiff/tools/download_hf_model.py +24 -0
  73. hcpdiff/tools/init_proj.py +3 -21
  74. hcpdiff/tools/lora_convert.py +18 -17
  75. hcpdiff/tools/save_model.py +12 -0
  76. hcpdiff/tools/sd2diffusers.py +1 -1
  77. hcpdiff/train_colo.py +1 -1
  78. hcpdiff/train_deepspeed.py +1 -1
  79. hcpdiff/trainer_ac.py +79 -0
  80. hcpdiff/trainer_ac_single.py +31 -0
  81. hcpdiff/utils/__init__.py +0 -2
  82. hcpdiff/utils/inpaint_pipe.py +7 -2
  83. hcpdiff/utils/net_utils.py +29 -6
  84. hcpdiff/utils/pipe_hook.py +24 -7
  85. hcpdiff/utils/utils.py +21 -4
  86. hcpdiff/workflow/__init__.py +15 -10
  87. hcpdiff/workflow/daam/__init__.py +1 -0
  88. hcpdiff/workflow/daam/act.py +66 -0
  89. hcpdiff/workflow/daam/hook.py +109 -0
  90. hcpdiff/workflow/diffusion.py +118 -128
  91. hcpdiff/workflow/fast.py +31 -0
  92. hcpdiff/workflow/flow.py +67 -0
  93. hcpdiff/workflow/io.py +36 -130
  94. hcpdiff/workflow/model.py +46 -43
  95. hcpdiff/workflow/text.py +60 -47
  96. hcpdiff/workflow/utils.py +32 -12
  97. hcpdiff/workflow/vae.py +37 -38
  98. hcpdiff-2.2.dist-info/METADATA +299 -0
  99. hcpdiff-2.2.dist-info/RECORD +115 -0
  100. {hcpdiff-0.9.1.dist-info → hcpdiff-2.2.dist-info}/WHEEL +1 -1
  101. hcpdiff-2.2.dist-info/entry_points.txt +5 -0
  102. hcpdiff/ckpt_manager/base.py +0 -16
  103. hcpdiff/ckpt_manager/ckpt_diffusers.py +0 -45
  104. hcpdiff/ckpt_manager/ckpt_pkl.py +0 -138
  105. hcpdiff/ckpt_manager/ckpt_safetensor.py +0 -64
  106. hcpdiff/ckpt_manager/ckpt_webui.py +0 -54
  107. hcpdiff/data/bucket.py +0 -358
  108. hcpdiff/data/caption_loader.py +0 -80
  109. hcpdiff/data/cond_dataset.py +0 -40
  110. hcpdiff/data/crop_info_dataset.py +0 -40
  111. hcpdiff/data/data_processor.py +0 -33
  112. hcpdiff/data/pair_dataset.py +0 -146
  113. hcpdiff/data/sampler.py +0 -54
  114. hcpdiff/data/source/base.py +0 -30
  115. hcpdiff/data/utils.py +0 -80
  116. hcpdiff/deprecated/__init__.py +0 -1
  117. hcpdiff/deprecated/cfg_converter.py +0 -81
  118. hcpdiff/deprecated/lora_convert.py +0 -31
  119. hcpdiff/infer_workflow.py +0 -57
  120. hcpdiff/loggers/__init__.py +0 -13
  121. hcpdiff/loggers/base_logger.py +0 -76
  122. hcpdiff/loggers/cli_logger.py +0 -40
  123. hcpdiff/loggers/preview/__init__.py +0 -1
  124. hcpdiff/loggers/preview/image_previewer.py +0 -149
  125. hcpdiff/loggers/tensorboard_logger.py +0 -30
  126. hcpdiff/loggers/wandb_logger.py +0 -31
  127. hcpdiff/loggers/webui_logger.py +0 -9
  128. hcpdiff/loss/min_snr_loss.py +0 -52
  129. hcpdiff/models/layers.py +0 -81
  130. hcpdiff/models/plugin.py +0 -348
  131. hcpdiff/models/wrapper.py +0 -75
  132. hcpdiff/noise/__init__.py +0 -3
  133. hcpdiff/noise/noise_base.py +0 -16
  134. hcpdiff/noise/pyramid_noise.py +0 -50
  135. hcpdiff/noise/zero_terminal.py +0 -44
  136. hcpdiff/train_ac.py +0 -566
  137. hcpdiff/train_ac_single.py +0 -39
  138. hcpdiff/utils/caption_tools.py +0 -105
  139. hcpdiff/utils/cfg_net_tools.py +0 -321
  140. hcpdiff/utils/cfg_resolvers.py +0 -16
  141. hcpdiff/utils/ema.py +0 -52
  142. hcpdiff/utils/img_size_tool.py +0 -248
  143. hcpdiff/vis/__init__.py +0 -3
  144. hcpdiff/vis/base_interface.py +0 -12
  145. hcpdiff/vis/disk_interface.py +0 -48
  146. hcpdiff/vis/webui_interface.py +0 -17
  147. hcpdiff/viser_fast.py +0 -138
  148. hcpdiff/visualizer.py +0 -265
  149. hcpdiff/visualizer_reloadable.py +0 -237
  150. hcpdiff/workflow/base.py +0 -59
  151. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/anime/text2img_anime.yaml +0 -21
  152. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/anime/text2img_anime_lora.yaml +0 -58
  153. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/change_vae.yaml +0 -6
  154. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/euler_a.yaml +0 -8
  155. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/img2img.yaml +0 -10
  156. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/img2img_controlnet.yaml +0 -19
  157. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/inpaint.yaml +0 -11
  158. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/load_lora.yaml +0 -26
  159. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/load_unet_part.yaml +0 -18
  160. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/offload_2GB.yaml +0 -6
  161. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/save_model.yaml +0 -44
  162. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/text2img.yaml +0 -53
  163. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/text2img_DA++.yaml +0 -34
  164. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/infer/text2img_sdxl.yaml +0 -9
  165. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/plugins/plugin_controlnet.yaml +0 -17
  166. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/te_struct.txt +0 -193
  167. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/dataset/base_dataset.yaml +0 -29
  168. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/dataset/regularization_dataset.yaml +0 -31
  169. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/CustomDiffusion.yaml +0 -74
  170. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/DreamArtist++.yaml +0 -135
  171. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/DreamArtist.yaml +0 -45
  172. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/DreamBooth.yaml +0 -62
  173. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/FT_sdxl.yaml +0 -33
  174. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/Lion_optimizer.yaml +0 -17
  175. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/TextualInversion.yaml +0 -41
  176. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/add_logger_tensorboard_wandb.yaml +0 -15
  177. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/controlnet.yaml +0 -53
  178. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/ema.yaml +0 -10
  179. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/fine-tuning.yaml +0 -53
  180. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/locon.yaml +0 -24
  181. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/lora_anime_character.yaml +0 -77
  182. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/lora_conventional.yaml +0 -56
  183. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/lora_sdxl.yaml +0 -41
  184. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/min_snr.yaml +0 -7
  185. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples/preview_in_training.yaml +0 -6
  186. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples_noob/DreamBooth.yaml +0 -70
  187. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples_noob/TextualInversion.yaml +0 -45
  188. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples_noob/fine-tuning.yaml +0 -45
  189. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/examples_noob/lora.yaml +0 -63
  190. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/train_base.yaml +0 -81
  191. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/train/tuning_base.yaml +0 -42
  192. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/unet_struct.txt +0 -932
  193. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/workflow/highres_fix_latent.yaml +0 -86
  194. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/workflow/highres_fix_pixel.yaml +0 -99
  195. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/workflow/text2img.yaml +0 -59
  196. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/workflow/text2img_lora.yaml +0 -70
  197. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/zero2.json +0 -32
  198. hcpdiff-0.9.1.data/data/hcpdiff/cfgs/zero3.json +0 -39
  199. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/caption.txt +0 -1
  200. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/name.txt +0 -1
  201. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/name_2pt_caption.txt +0 -1
  202. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/name_caption.txt +0 -1
  203. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/object.txt +0 -27
  204. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/object_caption.txt +0 -27
  205. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/style.txt +0 -19
  206. hcpdiff-0.9.1.data/data/hcpdiff/prompt_tuning_template/style_caption.txt +0 -19
  207. hcpdiff-0.9.1.dist-info/METADATA +0 -199
  208. hcpdiff-0.9.1.dist-info/RECORD +0 -160
  209. hcpdiff-0.9.1.dist-info/entry_points.txt +0 -2
  210. {hcpdiff-0.9.1.dist-info → hcpdiff-2.2.dist-info/licenses}/LICENSE +0 -0
  211. {hcpdiff-0.9.1.dist-info → hcpdiff-2.2.dist-info}/top_level.txt +0 -0
@@ -1,135 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/regularization_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- unet: null
7
-
8
- lora_unet:
9
- - lr: 1e-4
10
- rank: 0.01875
11
- branch: p
12
- dropout: 0.1
13
- layers:
14
- - 're:.*\.to_k$'
15
- - 're:.*\.to_v$'
16
- - 're:.*\.ff$'
17
- #- 're:.*\.attn.?$' # Increases fitness, but potentially reduces controllability
18
- - lr: 4e-5 # Low negative unet lr prevents image collapse
19
- rank: 0.01875
20
- branch: n
21
- dropout: 0.1
22
- layers:
23
- - 're:.*\.to_k$'
24
- - 're:.*\.to_v$'
25
- - 're:.*\.ff$'
26
- #- 're:.*\.attn.?$' # Increases fitness, but potentially reduces controllability
27
- # - lr: 1e-4
28
- # rank: 0.01875
29
- # type: p
30
- # layers:
31
- # - 're:.*\.resnets$' # Increases fitness, but potentially reduces controllability and change style
32
- # - lr: 4e-5
33
- # rank: 0.01875
34
- # type: n
35
- # layers:
36
- # - 're:.*\.resnets$' # Increases fitness, but potentially reduces controllability and change style
37
-
38
- lora_text_encoder:
39
- - lr: 2e-5
40
- rank: 2
41
- branch: p
42
- dropout: 0.1
43
- layers:
44
- - 're:.*self_attn$'
45
- - 're:.*mlp$'
46
- - lr: 2e-5
47
- rank: 2
48
- branch: n
49
- dropout: 0.1
50
- layers:
51
- - 're:.*self_attn$'
52
- - 're:.*mlp$'
53
-
54
- tokenizer_pt:
55
- train: # prompt tuning embeddings
56
- - { name: 'pt-botdog1', lr: 0.0025 }
57
- - { name: 'pt-botdog1-neg', lr: 0.0025 }
58
-
59
- train:
60
- gradient_accumulation_steps: 1
61
- save_step: 100
62
-
63
- #cfg_scale: '1.0-3.0:cos' # dynamic CFG with timestamp
64
- cfg_scale: '3.0'
65
-
66
- loss:
67
- criterion: # min SNR loss
68
- _target_: hcpdiff.loss.MinSNRLoss
69
- gamma: 2.0
70
-
71
- scheduler:
72
- name: one_cycle
73
- num_warmup_steps: 200
74
- num_training_steps: 1000
75
- scheduler_kwargs: { }
76
-
77
- scheduler_pt:
78
- name: one_cycle
79
- num_warmup_steps: 200
80
- num_training_steps: 1000
81
- scheduler_kwargs: {}
82
-
83
- model:
84
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
85
- tokenizer_repeats: 1
86
- ema_unet: 0
87
- ema_text_encoder: 0
88
- clip_skip: 0
89
-
90
- # The dataset configuration inherits regularization_dataset.yaml
91
- # 数据集配置继承自 regularization_dataset.yaml, 只需修改部分参数
92
- data:
93
- dataset1:
94
- batch_size: 4
95
- cache_latents: True
96
-
97
- source:
98
- data_source1:
99
- img_root: 'imgs/'
100
- prompt_template: 'prompt_tuning_template/object.txt'
101
- caption_file: null # path to image captions (file_words)
102
- att_mask: null
103
-
104
- word_names: --- # remove unused item
105
- text_transforms:
106
- transforms: # without TagShuffle and TagDropout. | 去掉 TagShuffle 和 TagDropout.
107
- - _target_: hcpdiff.utils.caption_tools.TemplateFill
108
- word_names:
109
- pt1: [pt-botdog1, pt-botdog1-neg]
110
- bucket:
111
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
112
- target_area: ${hcp.eval:"512*512"}
113
- num_bucket: 1
114
-
115
- # Add regularization to prevent image crashes
116
- # Regularization images is generated by model itself with prompt from dataset
117
- dataset_class:
118
- batch_size: 1
119
- cache_latents: True
120
- loss_weight: 1.0
121
-
122
- source:
123
- data_source1:
124
- img_root: 'imgs/v15'
125
- prompt_template: 'prompt_tuning_template/caption.txt'
126
- caption_file:
127
- _targe_: hcpdiff.data.JsonCaptionLoader
128
- path: 'imgs/v15/image_captions.json'
129
- att_mask: null
130
-
131
- word_names:
132
- pt1: ['', '']
133
- bucket:
134
- _target_: hcpdiff.data.bucket.FixedBucket
135
- target_size: [512, 512]
@@ -1,45 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/base_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- tokenizer_pt:
7
- train: # prompt tuning embeddings, needs to be created in advance
8
- - { name: 'pt-catgirl1', lr: 0.003 }
9
- - { name: 'pt-catgirl1-neg', lr: 0.003 }
10
-
11
- train:
12
- gradient_accumulation_steps: 1
13
- save_step: 100
14
-
15
- #cfg_scale: '1.0-3.0:cos' # dynamic CFG with timestamp
16
- cfg_scale: '3.0'
17
-
18
- scheduler:
19
- name: 'constant_with_warmup'
20
- num_warmup_steps: 50
21
- num_training_steps: 600
22
-
23
- model:
24
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
25
- tokenizer_repeats: 1
26
- ema_unet: 0
27
- ema_text_encoder: 0
28
-
29
- data:
30
- dataset1:
31
- batch_size: 4
32
- cache_latents: True
33
-
34
- source:
35
- data_source1:
36
- img_root: 'imgs/'
37
- prompt_template: 'prompt_tuning_template/object.txt'
38
- caption_file: null # path to image captions (file_words)
39
-
40
- word_names:
41
- pt1: [ pt-catgirl1, pt-catgirl1-neg ] # A pair of word for positive and negative branches respectively.
42
- bucket:
43
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
44
- target_area: ${hcp.eval:"512*512"}
45
- num_bucket: 1
@@ -1,62 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/regularization_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- unet:
7
- -
8
- lr: 1e-6
9
- layers:
10
- - ''
11
-
12
- train:
13
- gradient_accumulation_steps: 1
14
- save_step: 100
15
-
16
- scheduler:
17
- name: 'constant_with_warmup'
18
- num_warmup_steps: 50
19
- num_training_steps: 600
20
-
21
- model:
22
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
23
- tokenizer_repeats: 1
24
-
25
- # The dataset configuration inherits regularization_dataset.yaml
26
- # 数据集配置继承自 regularization_dataset.yaml, 只需修改部分参数
27
- data:
28
- dataset1:
29
- batch_size: 4
30
- cache_latents: True
31
-
32
- source:
33
- data_source1:
34
- img_root: 'imgs/'
35
- prompt_template: 'prompt_tuning_template/object.txt'
36
- caption_file: null # path to image captions (file_words)
37
- att_mask: null
38
-
39
- word_names:
40
- pt1: sks
41
- class: dog
42
- bucket:
43
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
44
- target_area: ${hcp.eval:"512*512"}
45
- num_bucket: 1
46
-
47
- dataset_class:
48
- batch_size: 1
49
- cache_latents: True
50
- loss_weight: 1.0
51
-
52
- source:
53
- data_source1:
54
- img_root: 'imgs/db_class'
55
- prompt_template: 'prompt_tuning_template/object.txt'
56
- caption_file: null
57
-
58
- word_names:
59
- class: dog
60
- bucket:
61
- _target_: hcpdiff.data.bucket.FixedBucket
62
- target_size: [512, 512]
@@ -1,33 +0,0 @@
1
- _base_:
2
- - cfgs/train/examples/fine-tuning.yaml
3
-
4
- mixed_precision: 'bf16'
5
-
6
- train:
7
- optimizer:
8
- _target_: transformers.optimization.Adafactor
9
- _partial_: True
10
- relative_step: False
11
- weight_decay: 1e-3
12
-
13
- model:
14
- pretrained_model_name_or_path: 'stabilityai/stable-diffusion-xl-base-1.0'
15
- clip_skip: 1
16
- clip_final_norm: False
17
- force_cast_precision: True
18
-
19
- data:
20
- dataset1:
21
- _target_: hcpdiff.data.CropInfoPairDataset
22
- batch_size: 4
23
-
24
- source:
25
- data_source1:
26
- img_root: 'imgs/'
27
- prompt_template: 'prompt_tuning_template/object.txt'
28
- caption_file: 'imgs/image_captions.json' # path to image captions (file_words)
29
-
30
- bucket:
31
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
32
- target_area: ${hcp.eval:"1024*1024"}
33
- num_bucket: 4
@@ -1,17 +0,0 @@
1
- _base_: [cfgs/train/examples/fine-tuning.yaml]
2
-
3
- # Install: pip install lion-pytorch
4
-
5
- train:
6
- optimizer:
7
- type: --- # remove unused item
8
- _target_: lion_pytorch.Lion
9
- _partial_: True
10
- weight_decay: 1e-2
11
- #use_triton: True # set this to True to use cuda kernel w/ Triton lang (Tillet et al)
12
-
13
- optimizer_pt:
14
- type: ---
15
- _target_: lion_pytorch.Lion
16
- _partial_: True
17
- weight_decay: 1e-3
@@ -1,41 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/base_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- tokenizer_pt:
7
- train: # prompt tuning embeddings, needs to be created in advance
8
- - { name: 'pt-catgirl1', lr: 0.003 }
9
-
10
- train:
11
- gradient_accumulation_steps: 1
12
- save_step: 100
13
-
14
- scheduler:
15
- name: 'constant_with_warmup'
16
- num_warmup_steps: 50
17
- num_training_steps: 600
18
-
19
- model:
20
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
21
- tokenizer_repeats: 1
22
- ema_unet: 0
23
- ema_text_encoder: 0
24
-
25
- data:
26
- dataset1:
27
- batch_size: 4
28
- cache_latents: True
29
-
30
- source:
31
- data_source1:
32
- img_root: 'imgs/'
33
- prompt_template: 'prompt_tuning_template/object.txt'
34
- caption_file: null # path to image captions (file_words)
35
-
36
- word_names:
37
- pt1: pt-catgirl1
38
- bucket:
39
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
40
- target_area: ${hcp.eval:"512*512"}
41
- num_bucket: 1
@@ -1,15 +0,0 @@
1
- _base_: [cfgs/train/train_base.yaml]
2
-
3
- logger:
4
- -
5
- _target_: hcpdiff.loggers.CLILogger
6
- _partial_: True
7
- out_path: 'train.log'
8
- log_step: 20
9
- - _target_: hcpdiff.loggers.TBLogger
10
- _partial_: True
11
- out_path: 'tblog/'
12
- log_step: 5
13
- - _target_: hcpdiff.loggers.WanDBLogger
14
- _partial_: True
15
- log_step: 5
@@ -1,53 +0,0 @@
1
- _base_:
2
- - cfgs/train/train_base.yaml
3
- - cfgs/plugins/plugin_controlnet.yaml # include controlnet plugin
4
-
5
- tokenizer_pt:
6
- train: null
7
-
8
- train:
9
- gradient_accumulation_steps: 1
10
- save_step: 100
11
-
12
- scheduler:
13
- name: 'constant_with_warmup'
14
- num_warmup_steps: 50
15
- num_training_steps: 600
16
-
17
- model:
18
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
19
- tokenizer_repeats: 1
20
- ema_unet: 0
21
- ema_text_encoder: 0
22
-
23
- data:
24
- dataset1:
25
- _target_: hcpdiff.data.TextImageCondPairDataset
26
- _partial_: True # Not directly instantiate the object here. There are other parameters to be added in the runtime.
27
- batch_size: 4
28
- cache_latents: True
29
- att_mask_encode: False
30
- loss_weight: 1.0
31
-
32
- source:
33
- data_source1:
34
- _target_: hcpdiff.data.source.Text2ImageCondSource
35
- img_root: 'imgs/'
36
- cond_root: 'cond_imgs/'
37
- prompt_template: 'prompt_tuning_template/object.txt'
38
- caption_file: null # path to image captions (file_words)
39
- att_mask: null
40
- bg_color: [ 255, 255, 255 ] # RGB; for ARGB -> RGB
41
-
42
- text_transforms:
43
- _target_: torchvision.transforms.Compose
44
- transforms:
45
- - _target_: hcpdiff.utils.caption_tools.TagShuffle
46
- - _target_: hcpdiff.utils.caption_tools.TagDropout
47
- p: 0.1
48
- - _target_: hcpdiff.utils.caption_tools.TemplateFill
49
- word_names: { }
50
- bucket:
51
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
52
- target_area: ${hcp.eval:"512*512"}
53
- num_bucket: 5
@@ -1,10 +0,0 @@
1
- _base_:
2
- - cfgs/train/examples/fine-tuning.yaml
3
-
4
- model:
5
- ema:
6
- _target_: hcpdiff.utils.ema.ModelEMA
7
- _partial_: True
8
- decay_max: 0.9997
9
- power: 0.85
10
-
@@ -1,53 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/base_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- unet:
7
- -
8
- lr: 1e-6
9
- layers:
10
- - '' # fine-tuning all layers in unet
11
-
12
- ## fine-tuning text-encoder
13
- #text_encoder:
14
- # - lr: 1e-6
15
- # layers:
16
- # - ''
17
-
18
- tokenizer_pt:
19
- train: null
20
-
21
- train:
22
- gradient_accumulation_steps: 1
23
- save_step: 100
24
-
25
- scheduler:
26
- name: 'constant_with_warmup'
27
- num_warmup_steps: 50
28
- num_training_steps: 600
29
-
30
- model:
31
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
32
- tokenizer_repeats: 1
33
- ema_unet: 0
34
- ema_text_encoder: 0
35
-
36
- # The dataset configuration inherits base_dataset.yaml
37
- # 数据集配置继承自base_dataset.yaml, 只需修改部分参数
38
- data:
39
- dataset1:
40
- batch_size: 4
41
- cache_latents: True
42
-
43
- source:
44
- data_source1:
45
- img_root: 'imgs/'
46
- prompt_template: 'prompt_tuning_template/object.txt'
47
- caption_file: null # path to image captions (file_words)
48
- att_mask: null
49
-
50
- bucket:
51
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
52
- target_area: ${hcp.eval:"512*512"}
53
- num_bucket: 5
@@ -1,24 +0,0 @@
1
- _base_: [cfgs/train/examples/lora_conventional.yaml]
2
-
3
- lora_unet:
4
- - # Linear
5
- lr: 1e-4
6
- rank: 8
7
- layers:
8
- - 're:.*\.attn.?$'
9
- - 're:.*\.ff$'
10
- - # Conv2d
11
- lr: 1e-4
12
- rank: 8
13
- layers:
14
- - 're:.*\.resnets$'
15
- - 're:.*\.proj_in$'
16
- - 're:.*\.proj_out$'
17
- - 're:.*\.conv$'
18
-
19
- lora_text_encoder:
20
- - lr: 1e-5
21
- rank: 4
22
- layers:
23
- - 're:.*self_attn$'
24
- - 're:.*mlp$'
@@ -1,77 +0,0 @@
1
- _base_:
2
- - cfgs/train/examples/lora_conventional.yaml
3
-
4
- model:
5
- pretrained_model_name_or_path: 'deepghs/animefull-latest'
6
- clip_skip: 1
7
-
8
- character_name: surtr_arknights
9
- dataset_dir: '/root/autodl-tmp/dataset/surtr_3'
10
- # if exp_dir is not set, a random time-based directory will be used
11
- # exp_dir: 'exps/surtr'
12
-
13
- unet_rank: 8
14
- text_encoder_rank: 4
15
-
16
- tokenizer_pt:
17
- emb_dir: 'embs/' #自定义word目录
18
- replace: False #训练后是否替换原有word
19
- train:
20
- - name: ${character_name}
21
- lr: 0.003
22
-
23
- lora_unet:
24
- - lr: 1e-4
25
- rank: ${unet_rank}
26
- layers:
27
- - 're:.*\.attn.?$'
28
- - 're:.*\.ff$'
29
-
30
- lora_text_encoder:
31
- - lr: 1e-5
32
- rank: ${text_encoder_rank}
33
- layers:
34
- - 're:.*self_attn$'
35
- - 're:.*mlp$'
36
-
37
- data:
38
- dataset1:
39
- batch_size: 4
40
- cache_latents: True
41
-
42
- source:
43
- data_source1:
44
- img_root: ${dataset_dir}
45
- prompt_template: 'prompt_tuning_template/object_caption.txt'
46
- caption_file: ${dataset_dir} # path to image captions (file_words)
47
-
48
- word_names:
49
- pt1: ${character_name}
50
-
51
- # support images with any size, not recommended for anime training
52
- # bucket:
53
- # _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
54
- # target_area: ${times:512,512}
55
- # num_bucket: 5
56
-
57
- # all images must have the same size, such as 512x704
58
- bucket:
59
- _target_: hcpdiff.data.bucket.SizeBucket.from_files # aspect ratio bucket
60
- target_area: ---
61
- num_bucket: 1
62
-
63
- logger:
64
- - _target_: hcpdiff.loggers.CLILogger
65
- _partial_: True
66
- out_path: 'train.log'
67
- log_step: 20
68
- - _target_: hcpdiff.loggers.TBLogger
69
- _partial_: True
70
- out_path: 'tblog/'
71
- log_step: 5
72
- # - _target_: hcpdiff.loggers.WanDBLogger
73
- # _partial_: True
74
- # out_path: null
75
- # log_step: 5
76
-
77
-
@@ -1,56 +0,0 @@
1
- _base_:
2
- - cfgs/train/dataset/base_dataset.yaml
3
- - cfgs/train/train_base.yaml
4
- - cfgs/train/tuning_base.yaml
5
-
6
- lora_unet:
7
- -
8
- lr: 1e-4
9
- rank: 8
10
- layers:
11
- - 're:.*\.attn.?$'
12
- - 're:.*\.ff$'
13
-
14
- lora_text_encoder:
15
- - lr: 1e-5
16
- rank: 4
17
- layers:
18
- - 're:.*self_attn$'
19
- - 're:.*mlp$'
20
-
21
- tokenizer_pt:
22
- train: null
23
-
24
- train:
25
- gradient_accumulation_steps: 1
26
- save_step: 100
27
-
28
- scheduler:
29
- name: 'constant_with_warmup'
30
- num_warmup_steps: 50
31
- num_training_steps: 1000
32
-
33
- model:
34
- pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
35
- tokenizer_repeats: 1
36
- ema_unet: 0
37
- ema_text_encoder: 0
38
-
39
- data:
40
- dataset1:
41
- batch_size: 4
42
- cache_latents: True
43
-
44
- source:
45
- data_source1:
46
- img_root: 'imgs/'
47
- prompt_template: 'prompt_tuning_template/object.txt'
48
- caption_file: null # path to image captions (file_words)
49
-
50
- word_names:
51
- pt1: pt-cat1
52
-
53
- bucket:
54
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
55
- target_area: ${hcp.eval:"512*512"}
56
- num_bucket: 5
@@ -1,41 +0,0 @@
1
- _base_:
2
- - cfgs/train/examples/lora_conventional.yaml
3
-
4
- lora_unet:
5
- -
6
- lr: 1e-4
7
- rank: 8
8
- layers:
9
- - 're:.*\.attn.?$'
10
- - 're:.*\.ff$'
11
-
12
- lora_text_encoder:
13
- - lr: 1e-5
14
- rank: 4
15
- # for both CLIP
16
- layers:
17
- - 're:.*self_attn$'
18
- - 're:.*mlp$'
19
- # for CLIP1 (CLIP_B)
20
- # layers:
21
- # - 're:clip_B.*self_attn$'
22
- # - 're:clip_B.*mlp$'
23
- # for CLIP2 (CLIP_bigG)
24
- # layers:
25
- # - 're:clip_bigG.*self_attn$'
26
- # - 're:clip_bigG.*mlp$'
27
-
28
- model:
29
- pretrained_model_name_or_path: '/mnt/f/models/stable-diffusion-xl-base-1.0'
30
- clip_skip: 1
31
- clip_final_norm: False
32
-
33
- data:
34
- dataset1:
35
- _target_: hcpdiff.data.CropInfoPairDataset
36
- batch_size: 4
37
-
38
- bucket:
39
- _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
40
- target_area: ${hcp.eval:"768*768"}
41
- num_bucket: 4
@@ -1,7 +0,0 @@
1
- _base_: [cfgs/train/examples/fine-tuning.yaml]
2
-
3
- train:
4
- loss:
5
- criterion: # min SNR loss
6
- _target_: hcpdiff.loss.MinSNRLoss
7
- gamma: 2.0
@@ -1,6 +0,0 @@
1
- _base_: [cfgs/train/train_base.yaml]
2
-
3
- previewer:
4
- _target_: hcpdiff.loggers.preview.ImagePreviewer
5
- _partial_: True
6
- infer_cfg: cfgs/infer/text2img.yaml