diff --git a/README.md b/README.md index d2ba417..3e35921 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ # ComfyUI-TrainTools-MZ 在ComfyUI中进行lora微调的节点,依赖于kohya-ss/sd-scripts等训练工具 + ## Recent changes + ## Installation 1. Clone this repo into `custom_nodes` folder. @@ -13,15 +15,39 @@ ## Nodes ### MZ_KohyaSSInitWorkspace -初始化训练文件夹,文件夹位于output目录 - -![image](https://github.com/MinusZoneAI/ComfyUI-TrainTools-MZ/assets/5035199/338bf5b6-58be-47a1-9450-72bd3f238855) +初始化训练文件夹,文件夹位于output目录(Initialize the training folder, the folder in the output directory) ++ lora_name(LoRa名称): 用于生成训练文件夹的名称(Used to generate the name of the training folder ++ branch(分支): sd-scripts的分支,默认为当前代码调试时使用的分支(sd-scripts branch, default is the branch used when debugging the current code) ++ source(源): sd-scripts的源,默认为github,下载有问题的话可以切换加速源(sd-scripts source, default is github, if there is a problem with the download, you can switch to the accelerated source) + ### MZ_ImagesCopyWorkspace - +复制图片到训练文件夹中和一些数据集配置(Copy images to the training folder and some dataset configurations) ++ images(图片列表): 推荐使用 https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite 中的上传文件夹节点 (It is recommended to use the upload folder node in https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite ) ++ force_clear(强制清空): 复制图片前是否强制清空原有文件夹内容(Whether to force clear the original folder content before copying the image) ++ force_clear_only_images(仅清空图片): 仅清空图片文件夹内容,不清空其他文件夹内容(Only clear the content of the image folder, not the content of other folders) ++ same_caption_generate(生成相同标注): 是否生成相同的标注文件(Whether to generate the same annotation file) ++ same_caption(单一标签): 生成相同标签的内容(Generate content with the same label) ++ 其他字段参考: https://github.com/kohya-ss/sd-scripts ![image](https://github.com/MinusZoneAI/ComfyUI-TrainTools-MZ/assets/5035199/b2eb8f78-9314-4860-9248-8c04f87bc470) +### MZ_KohyaSSUseConfig +一些基础的训练配置(Some basic training configurations) ++ 没什么特殊的,字段参考: https://github.com/kohya-ss/sd-scripts + + +### MZ_KohyaSSAdvConfig +更多的训练配置(More training configurations) ++ 没什么特殊的,字段参考: https://github.com/kohya-ss/sd-scripts + +### MZ_KohyaSSTrain +训练主线程(Training main thread) ++ base_lora(基础lora): 加载一个lora模型后进行训练,和sd-scripts中的`network_weights`参数一致,启用时忽略dim/alpha/dropout(Train after loading a lora model, consistent with the `network_weights` parameter in sd-scripts, ignore dim/alpha/dropout when enabled) ++ sample_generate(启用样图生成): 每次保存模型时进行一次示例图片生成,并展示训练过程中每个保存epoch时的示例图片(Enable example image generation each time the model is saved, and display the example image at each saved epoch during training) ++ sample_prompt(提示词): 生成示例图片时使用的提示词(Phrase used when generating example images) + + ## FAQ diff --git a/examples/workflow.json b/examples/workflow.json new file mode 100644 index 0000000..5ff33d5 --- /dev/null +++ b/examples/workflow.json @@ -0,0 +1,414 @@ +{ + "last_node_id": 43, + "last_link_id": 55, + "nodes": [ + { + "id": 35, + "type": "MZ_KohyaSSUseConfig", + "pos": [ + 1440, + -40 + ], + "size": { + "0": 367.79998779296875, + "1": 266 + }, + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "workspace_config", + "type": "MZ_TT_SS_WorkspaceConfig", + "link": 55, + "label": "workspace_config", + "slot_index": 0 + }, + { + "name": "advanced_config", + "type": "MZ_TT_SS_AdvConfig", + "link": null, + "label": "advanced_config", + "slot_index": 1 + }, + { + "name": "workspace_images_dir", + "type": "STRING", + "link": 46, + "widget": { + "name": "workspace_images_dir" + }, + "slot_index": 2, + "label": "workspace_images_dir" + } + ], + "outputs": [ + { + "name": "train_config", + "type": "MZ_TT_SS_TrainConfig", + "links": [ + 53 + ], + "shape": 3, + "label": "train_config", + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "MZ_KohyaSSUseConfig" + }, + "widgets_values": [ + "", + "lora_sd1_5", + "LEOSAM_FilmGirl_Ultra.safetensors", + 500, + 0, + 10, + "1e-4" + ] + }, + { + "id": 6, + "type": "PreviewImage", + "pos": [ + 1230, + 540 + ], + "size": { + "0": 210, + "1": 250 + }, + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 5, + "label": "图像" + } + ], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 5, + "type": "ImageScale", + "pos": [ + 690, + 330 + ], + "size": { + "0": 315, + "1": 130 + }, + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 3, + "label": "图像" + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 5, + 10 + ], + "shape": 3, + "label": "图像", + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "ImageScale" + }, + "widgets_values": [ + "nearest-exact", + 800, + 800, + "center" + ] + }, + { + "id": 4, + "type": "VHS_LoadVideo", + "pos": [ + 120, + 410 + ], + "size": [ + 240, + 400 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "meta_batch", + "type": "VHS_BatchManager", + "link": null, + "label": "批次管理" + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 3 + ], + "shape": 3, + "label": "图像", + "slot_index": 0 + }, + { + "name": "frame_count", + "type": "INT", + "links": null, + "shape": 3, + "label": "帧计数" + }, + { + "name": "audio", + "type": "VHS_AUDIO", + "links": null, + "shape": 3, + "label": "音频" + }, + { + "name": "video_info", + "type": "VHS_VIDEOINFO", + "links": null, + "shape": 3, + "label": "视频信息" + } + ], + "properties": { + "Node name for S&R": "VHS_LoadVideo" + }, + "widgets_values": { + "video": "初中就爱听的女团初恋,甜甜的(_´͈_⌵_`͈_)σண❤️.初中就爱听的女团初恋,甜甜的(_´͈_⌵_`͈_)σண❤️.1018975724.mp4", + "force_rate": 0, + "force_size": "Disabled", + "custom_width": 512, + "custom_height": 512, + "frame_load_cap": 5, + "skip_first_frames": 0, + "select_every_nth": 75, + "choose video to upload": "image", + "videopreview": { + "hidden": false, + "paused": false, + "params": { + "frame_load_cap": 5, + "skip_first_frames": 0, + "force_rate": 0, + "select_every_nth": 75, + "filename": "初中就爱听的女团初恋,甜甜的(_´͈_⌵_`͈_)σண❤️.初中就爱听的女团初恋,甜甜的(_´͈_⌵_`͈_)σண❤️.1018975724.mp4", + "type": "input", + "format": "video/mp4" + } + } + } + }, + { + "id": 10, + "type": "MZ_ImagesCopyWorkspace", + "pos": [ + 330, + 50 + ], + "size": { + "0": 468.5999755859375, + "1": 150 + }, + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "workspace_config", + "type": "MZ_TT_SS_WorkspaceConfig", + "link": 54, + "label": "workspace_config", + "slot_index": 0 + }, + { + "name": "images", + "type": "IMAGE", + "link": 10, + "label": "images" + } + ], + "outputs": [ + { + "name": "workspace_images_dir", + "type": "STRING", + "links": [ + 46 + ], + "shape": 3, + "label": "workspace_images_dir", + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "MZ_ImagesCopyWorkspace" + }, + "widgets_values": [ + "enable", + 256, + 1, + 1 + ] + }, + { + "id": 43, + "type": "MZ_KohyaSSInitWorkspace", + "pos": [ + -30, + -280 + ], + "size": { + "0": 315, + "1": 130 + }, + "flags": {}, + "order": 1, + "mode": 0, + "outputs": [ + { + "name": "workspace_config", + "type": "MZ_TT_SS_WorkspaceConfig", + "links": [ + 54, + 55 + ], + "shape": 3, + "label": "workspace_config", + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "MZ_KohyaSSInitWorkspace" + }, + "widgets_values": [ + "", + "71e2c91", + 0, + "randomize" + ] + }, + { + "id": 42, + "type": "MZ_KohyaSSTrain", + "pos": [ + 2060, + -40 + ], + "size": { + "0": 490, + "1": 460 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "train_config", + "type": "MZ_TT_SS_TrainConfig", + "link": 53, + "label": "train_config" + } + ], + "properties": { + "Node name for S&R": "MZ_KohyaSSTrain" + }, + "widgets_values": [ + "latest", + "enable", + "1girl" + ] + } + ], + "links": [ + [ + 3, + 4, + 0, + 5, + 0, + "IMAGE" + ], + [ + 5, + 5, + 0, + 6, + 0, + "IMAGE" + ], + [ + 10, + 5, + 0, + 10, + 1, + "IMAGE" + ], + [ + 46, + 10, + 0, + 35, + 2, + "STRING" + ], + [ + 53, + 35, + 0, + 42, + 0, + "MZ_TT_SS_TrainConfig" + ], + [ + 54, + 43, + 0, + 10, + 0, + "MZ_TT_SS_WorkspaceConfig" + ], + [ + 55, + 43, + 0, + 35, + 0, + "MZ_TT_SS_WorkspaceConfig" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.8390545288824108, + "offset": [ + 200.62039992117187, + 261.11695663143445 + ] + } + }, + "version": 0.4 +} \ No newline at end of file diff --git a/examples/workflow.png b/examples/workflow.png new file mode 100644 index 0000000..bad55f8 Binary files /dev/null and b/examples/workflow.png differ