Update Flux2 Control Cfg Distill && Fix Bug in Lora Training Register Hook (#445)

This commit is contained in:
Bubbliiiing
2026-02-03 10:23:10 +08:00
committed by GitHub
parent 0af07603da
commit 0f0e2bd5ab
81 changed files with 9151 additions and 176 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ For chunked loading, it is recommended to directly download the FLUX.2-dev weigh
│ ├── 📂 Fun_Models/
│ │ └── flux2_tokenizer/
│ └── 📂 model_patches/
│ └── FLUX.2-dev-Fun-Controlnet-Union.safetensors
│ └── FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors
```
### 2. Preprocessing Weights (Optional)
+2 -2
View File
@@ -875,7 +875,7 @@ class LoadFlux2ControlNetInPipeline:
),
"model_name": (
folder_paths.get_filename_list("model_patches"),
{"default": "FLUX.2-dev-Fun-Controlnet-Union.safetensors", },
{"default": "FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors", },
),
"funmodels": ("FunModels",),
},
@@ -1017,7 +1017,7 @@ class LoadFlux2ControlNetInModel:
),
"model_name": (
folder_paths.get_filename_list("model_patches"),
{"default": "FLUX.2-dev-Fun-Controlnet-Union.safetensors", },
{"default": "FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors", },
),
"transformer": ("TransformerModel",),
},
@@ -194,7 +194,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
@@ -316,7 +316,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
@@ -194,7 +194,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
@@ -186,7 +186,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
@@ -149,7 +149,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
@@ -122,7 +122,7 @@
},
"widgets_values": [
"flux2/flux2_control.yaml",
"FLUX.2-dev-Fun-Controlnet-Union.safetensors"
"FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
]
},
{
+30 -11
View File
@@ -1,4 +1,4 @@
# Z-Image-Turbo Model Setup Guide
# Z-Image Model Setup Guide
## a. Model Links and Storage Locations
@@ -13,7 +13,7 @@ For chunked loading, it is recommended to directly download the Z-Image weights
| Component | File Name |
|-----------|-----------|
| Text Encoder | [`qwen_3_4b.safetensors`](https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors) |
| Diffusion Model | [`z_image_turbo_bf16.safetensors`](https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors) |
| Diffusion Model | [`z_image_turbo_bf16.safetensors`](https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors) and [`z_image_bf16.safetensors`](https://huggingface.co/Comfy-Org/z_image/resolve/main/split_files/diffusion_models/z_image_bf16.safetensors) |
| VAE | [`ae.safetensors`](https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors) |
| tokenizer(Qwen3-4B) | [`tokenizer`](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo/tree/main/tokenizer) |
@@ -23,6 +23,7 @@ For chunked loading, it is recommended to directly download the Z-Image weights
|------|--------------|-------------|-------------|
| Z-Image-Turbo-Fun-Controlnet-Union | [🤗Link](https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union) | [😄Link](https://modelscope.cn/models/PAI/Z-Image-Turbo-Fun-Controlnet-Union) | ControlNet weights for Z-Image-Turbo, supporting multiple control conditions including Canny, Depth, Pose, MLSD, etc. |
| Z-Image-Turbo-Fun-Controlnet-Union-2.1 | [🤗Link](https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union-2.1) | [😄Link](https://modelscope.cn/models/PAI/Z-Image-Turbo-Fun-Controlnet-Union-2.1) | Upgraded ControlNet weights for Z-Image-Turbo with additions at more layers and longer training time, supporting multiple control conditions including Canny, Depth, Pose, MLSD, etc. |
| Z-Image-Fun-Controlnet-Union-2.1 | [🤗Link](https://huggingface.co/alibaba-pai/Z-Image-Fun-Controlnet-Union-2.1) | [😄Link](https://modelscope.cn/models/PAI/Z-Image-Fun-Controlnet-Union-2.1) | Upgraded ControlNet weights for Z-Image with additions at more layers and longer training time, supporting multiple control conditions including Canny, Depth, Pose, MLSD, Scribble, Hed and Gray. |
**Storage Location:**
@@ -74,8 +75,9 @@ If you prefer full model loading, you can directly download the diffusers weight
| Name | Hugging Face | Model Scope | Description |
|------|--------------|-------------|-------------|
| Z-Image-Turbo | [🤗Link](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) | [😄Link](https://www.modelscope.cn/models/Tongyi-MAI/Z-Image-Turbo) | Official full weights for Z-Image-Turbo |
| Z-Image | [🤗Link](https://huggingface.co/Tongyi-MAI/Z-Image) | [😄Link](https://www.modelscope.cn/models/Tongyi-MAI/Z-Image) | Official full weights for Z-Image |
For full model loading, use the diffusers version of Z-Image Turbo and place the model in `ComfyUI/models/Fun_Models/`.
For full model loading, use the diffusers version of Z-Image and place the model in `ComfyUI/models/Fun_Models/`.
**Storage Location:**
@@ -83,6 +85,7 @@ For full model loading, use the diffusers version of Z-Image Turbo and place the
📂 ComfyUI/
├── 📂 models/
│ └── 📂 Fun_Models/
│ ├── 📂 Z-Image
│ └── 📂 Z-Image-Turbo
```
@@ -90,20 +93,36 @@ For full model loading, use the diffusers version of Z-Image Turbo and place the
### 1. Chunked Loading (Recommended)
[Z Image Turbo Text to Image](v1/z_image_chunked_loading_workflow_t2i.json)
[Z Image Text to Image](v1/z_image_chunked_loading_workflow_t2i.json)
[Z Image Turbo Text to Image and Control](v1/z_image_chunked_loading_workflow_t2i_control.json)
[Z Image Text to Image and Control](v1/z_image_chunked_loading_workflow_t2i_control.json)
[Z Image Turbo Text to Image and Control with Pose Detect](v1/z_image_chunked_loading_workflow_t2i_control_pose_process.json)
[Z Image Text to Image and Control with Pose Detect](v1/z_image_chunked_loading_workflow_t2i_control_pose_process.json)
[Z Image Turbo Text to Image and Control with Depth Detect](v1/z_image_chunked_loading_workflow_t2i_control_depth_process.json)
[Z Image Text to Image and Control with Depth Detect](v1/z_image_chunked_loading_workflow_t2i_control_depth_process.json)
[Z Image Turbo Text to Image and Control with Canny Detect](v1/z_image_chunked_loading_workflow_t2i_control_canny_process.json)
[Z Image Text to Image and Control with Canny Detect](v1/z_image_chunked_loading_workflow_t2i_control_canny_process.json)
[Z Image Turbo Image to Image with Inpaint](v1/z_image_chunked_loading_workflow_i2i_inpaint.json)
[Z Image Image to Image with Inpaint](v1/z_image_chunked_loading_workflow_i2i_inpaint.json)
[Z Image Turbo Text to Image](v1/z_image_turbo_chunked_loading_workflow_t2i.json)
[Z Image Turbo Text to Image and Control](v1/z_image_turbo_chunked_loading_workflow_t2i_control.json)
[Z Image Turbo Text to Image and Control with Pose Detect](v1/z_image_turbo_chunked_loading_workflow_t2i_control_pose_process.json)
[Z Image Turbo Text to Image and Control with Depth Detect](v1/z_image_turbo_chunked_loading_workflow_t2i_control_depth_process.json)
[Z Image Turbo Text to Image and Control with Canny Detect](v1/z_image_turbo_chunked_loading_workflow_t2i_control_canny_process.json)
[Z Image Turbo Image to Image with Inpaint](v1/z_image_turbo_chunked_loading_workflow_i2i_inpaint.json)
### 2. Full Model Loading (Optional)
[Z Image Turbo Text to Image](v1/z_image_workflow_t2i.json)
[Z Image Text to Image](v1/z_image_workflow_t2i.json)
[Z Image Turbo Text to Image and Control](v1/z_image_workflow_t2i_control.json)
[Z Image Text to Image and Control](v1/z_image_workflow_t2i_control.json)
[Z Image Turbo Text to Image](v1/z_image_turbo_workflow_t2i.json)
[Z Image Turbo Text to Image and Control](v1/z_image_turbo_workflow_t2i_control.json)
+26 -9
View File
@@ -27,6 +27,9 @@ from ...videox_fun.models import (AutoencoderKL, AutoTokenizer,
ZImageTransformer2DModel)
from ...videox_fun.models.cache_utils import get_teacache_coefficients
from ...videox_fun.pipeline import ZImageControlPipeline, ZImagePipeline
from ...videox_fun.utils import (register_auto_device_hook,
safe_enable_group_offload,
safe_remove_group_offloading)
from ...videox_fun.utils.fm_solvers import FlowDPMSolverMultistepScheduler
from ...videox_fun.utils.fm_solvers_unipc import FlowUniPCMultistepScheduler
from ...videox_fun.utils.fp8_optimization import (
@@ -453,7 +456,9 @@ class CombineZImagePipeline:
"tokenizer": ("Tokenizer",),
"model_name": ("STRING",),
"GPU_memory_mode":(
["model_full_load", "model_full_load_and_qfloat8","model_cpu_offload", "model_cpu_offload_and_qfloat8", "sequential_cpu_offload"],
[
"model_full_load", "model_full_load_and_qfloat8", "model_cpu_offload",
"model_cpu_offload_and_qfloat8", "model_group_offload", "sequential_cpu_offload"],
{
"default": "model_cpu_offload",
}
@@ -505,14 +510,17 @@ class CombineZImagePipeline:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_group_offload":
register_auto_device_hook(pipeline.transformer)
safe_enable_group_offload(pipeline, onload_device=device, offload_device=offload_device, offload_type="leaf_level", use_stream=True)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -536,14 +544,17 @@ class LoadZImageModel:
"required": {
"model": (
[
"Z-Image-Turbo"
"Z-Image-Turbo",
"Z-Image"
],
{
"default": 'Z-Image-Turbo',
}
),
"GPU_memory_mode":(
["model_full_load", "model_full_load_and_qfloat8","model_cpu_offload", "model_cpu_offload_and_qfloat8", "sequential_cpu_offload"],
[
"model_full_load", "model_full_load_and_qfloat8", "model_cpu_offload",
"model_cpu_offload_and_qfloat8", "model_group_offload", "sequential_cpu_offload"],
{
"default": "model_cpu_offload",
}
@@ -637,14 +648,17 @@ class LoadZImageModel:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_group_offload":
register_auto_device_hook(pipeline.transformer)
safe_enable_group_offload(pipeline, onload_device=device, offload_device=offload_device, offload_type="leaf_level", use_stream=True)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -800,14 +814,17 @@ class LoadZImageControlNetInPipeline:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_group_offload":
register_auto_device_hook(pipeline.transformer)
safe_enable_group_offload(pipeline, onload_device=device, offload_device=offload_device, offload_type="leaf_level", use_stream=True)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(control_transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(control_transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(control_transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(control_transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(control_transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(control_transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -223,7 +223,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -261,7 +261,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -300,7 +300,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1.safetensors"
]
},
{
@@ -369,8 +369,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -223,7 +223,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -261,7 +261,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -331,8 +331,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -535,7 +535,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1_lite.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1-lite.safetensors"
]
}
],
@@ -104,8 +104,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3
]
@@ -145,7 +145,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -245,7 +245,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -350,7 +350,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -255,7 +255,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -357,7 +357,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -396,7 +396,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1.safetensors"
]
},
{
@@ -465,8 +465,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -223,7 +223,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -261,7 +261,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -300,7 +300,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1.safetensors"
]
},
{
@@ -369,8 +369,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -223,7 +223,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -261,7 +261,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -300,7 +300,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1.safetensors"
]
},
{
@@ -369,8 +369,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -290,7 +290,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -360,8 +360,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -431,7 +431,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -469,7 +469,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1_lite.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1-lite.safetensors"
]
}
],
@@ -131,7 +131,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -223,7 +223,7 @@
},
"widgets_values": [
"",
"model_cpu_offload"
"model_group_offload"
]
},
{
@@ -261,7 +261,7 @@
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"z_image_bf16.safetensors",
"bf16"
]
},
@@ -300,7 +300,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
"Z-Image-Fun-Controlnet-Union-2.1.safetensors"
]
},
{
@@ -369,8 +369,8 @@
1568,
43,
"fixed",
8,
0,
25,
4.5,
"Flow",
3,
0.8
@@ -0,0 +1,703 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 107,
"last_link_id": 113,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": 110
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": 112
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 104,
"type": "PreviewImage",
"pos": [
911.4377073728218,
418.9988584275326
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 113
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 107,
"type": "MaskToImage",
"pos": [
658.3044275669289,
511.8717365608471
],
"size": [
140,
26
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 111
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
112,
113
]
}
],
"properties": {
"Node name for S&R": "MaskToImage"
}
},
{
"id": 100,
"type": "LoadImage",
"pos": [
323.5443519405259,
489.8702544908114
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
110
]
},
{
"name": "MASK",
"type": "MASK",
"links": [
111
]
}
],
"properties": {
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1766731857414.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1766731857414.png [input]",
"image"
]
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
],
[
110,
100,
0,
99,
4,
"IMAGE"
],
[
111,
100,
1,
107,
0,
"MASK"
],
[
112,
107,
0,
99,
5,
"IMAGE"
],
[
113,
107,
0,
104,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7772383863288174,
"offset": [
-164.75871381690226,
267.25116947501067
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "93aa7b2530dccd1e91c625eee439a5e24f8ffa04",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,704 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 107,
"last_link_id": 113,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": 110
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": 112
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 104,
"type": "PreviewImage",
"pos": [
911.4377073728218,
418.9988584275326
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 113
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 107,
"type": "MaskToImage",
"pos": [
658.3044275669289,
511.8717365608471
],
"size": [
140,
26
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 111
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
112,
113
]
}
],
"properties": {
"Node name for S&R": "MaskToImage"
},
"widgets_values": []
},
{
"id": 100,
"type": "LoadImage",
"pos": [
323.5443519405259,
489.8702544908114
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
110
]
},
{
"name": "MASK",
"type": "MASK",
"links": [
111
]
}
],
"properties": {
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1766731857414.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1766731857414.png [input]",
"image"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1_lite.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
]
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
],
[
110,
100,
0,
99,
4,
"IMAGE"
],
[
111,
100,
1,
107,
0,
"MASK"
],
[
112,
107,
0,
99,
5,
"IMAGE"
],
[
113,
107,
0,
104,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7772383863288174,
"offset": [
248.90036994067935,
733.942567031054
]
},
"frontendVersion": "1.34.9",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "07dd34b942f866d5f95e8b812b6082d359079260",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,504 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 97,
"last_link_id": 83,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1070.207763671875,
-73.63389587402344
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 77
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 95,
"type": "ZImageT2ISampler",
"pos": [
719.3201904296875,
-72.24609375
],
"size": [
280.724609375,
386
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 83
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 75
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 76
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
77
]
}
],
"properties": {
"Node name for S&R": "ZImageT2ISampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
78
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
775.0554809570312,
-470.7688293457031
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 78
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
83
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
75
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
76
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
75,
75,
0,
95,
1,
"STRING_PROMPT"
],
[
76,
73,
0,
95,
2,
"STRING_PROMPT"
],
[
77,
95,
0,
88,
0,
"IMAGE"
],
[
78,
92,
0,
96,
0,
"TransformerModel"
],
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
83,
96,
0,
95,
0,
"FunModels"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
985.5581665039062,
393.7902526855469
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7513148009015777,
"offset": [
598.8157343153007,
736.7507277278353
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"comfy-core": "0.6.0",
"CogVideoX-Fun": "244f11053106af1a58ac25fd0bbb508fd7b89c0f"
}
},
"version": 0.4
}
@@ -0,0 +1,614 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 102,
"last_link_id": 96,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 100,
"type": "LoadImage",
"pos": [
396.48551767952716,
419.158511044569
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
86
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"a7kXeQ5l9Dhspes7q3x3G (1).png",
"image"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 86
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
86,
100,
0,
99,
3,
"IMAGE"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.9594420649225085,
"offset": [
96.69529077203181,
609.5309015132086
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "244f11053106af1a58ac25fd0bbb508fd7b89c0f",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,696 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 106,
"last_link_id": 109,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 109
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 100,
"type": "LoadImage",
"pos": [
281.12436800744575,
417.89046761218935
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
107
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"z-image-turbo_00004_.png",
"image"
]
},
{
"id": 104,
"type": "PreviewImage",
"pos": [
911.4377073728218,
418.9988584275326
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 108
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 106,
"type": "ImageToCanny",
"pos": [
600.6679574832448,
416.8636458672411
],
"size": [
270,
82
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "input_image",
"type": "IMAGE",
"link": 107
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
108,
109
]
}
],
"properties": {
"Node name for S&R": "ImageToCanny"
},
"widgets_values": [
100,
200
]
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
],
[
107,
100,
0,
106,
0,
"IMAGE"
],
[
108,
106,
0,
104,
0,
"IMAGE"
],
[
109,
106,
0,
99,
3,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.5785382099684587,
"offset": [
793.7261950497102,
754.1754224231845
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "93aa7b2530dccd1e91c625eee439a5e24f8ffa04",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,692 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 105,
"last_link_id": 104,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 104
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 104,
"type": "PreviewImage",
"pos": [
844.9628845788926,
422.400403774606
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 103
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 100,
"type": "LoadImage",
"pos": [
281.12436800744575,
417.89046761218935
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
102
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"z-image-turbo_00004_.png",
"image"
]
},
{
"id": 105,
"type": "ImageToDepth",
"pos": [
611.889314416795,
425.1418418025041
],
"size": [
164.7039856092299,
28.074046747697935
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "input_image",
"type": "IMAGE",
"link": 102
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
103,
104
]
}
],
"properties": {
"Node name for S&R": "ImageToDepth"
}
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
],
[
102,
100,
0,
105,
0,
"IMAGE"
],
[
103,
105,
0,
104,
0,
"IMAGE"
],
[
104,
105,
0,
99,
3,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7154376913110498,
"offset": [
365.0760840892105,
597.0698647794829
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "93aa7b2530dccd1e91c625eee439a5e24f8ffa04",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,614 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 102,
"last_link_id": 96,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 100,
"type": "LoadImage",
"pos": [
396.48551767952716,
419.158511044569
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
86
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"a7kXeQ5l9Dhspes7q3x3G (1).png",
"image"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 86
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1_lite.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
]
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
86,
100,
0,
99,
3,
"IMAGE"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7208430239838531,
"offset": [
460.4224504078358,
644.7360602102879
]
},
"frontendVersion": "1.34.9",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "07dd34b942f866d5f95e8b812b6082d359079260",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,692 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 104,
"last_link_id": 99,
"nodes": [
{
"id": 78,
"type": "Note",
"pos": [
18,
-46
],
"size": [
210,
88
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 91,
"type": "LoadZImageTextEncoderModel",
"pos": [
283.53765869140625,
-280.6837463378906
],
"size": [
407.4130859375,
102
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "text_encoder",
"type": "TextEncoderModel",
"links": [
80
]
},
{
"name": "tokenizer",
"type": "Tokenizer",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTextEncoderModel"
},
"widgets_values": [
"qwen_3_4b.safetensors",
"bf16"
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
88
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 97,
"type": "Note",
"pos": [
-354.4680507215508,
-433.6570714778354
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 96,
"type": "CombineZImagePipeline",
"pos": [
790.3572998046875,
-328.7134094238281
],
"size": [
342.5804748535156,
162
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 96
},
{
"name": "vae",
"type": "VAEModel",
"link": 79
},
{
"name": "text_encoder",
"type": "TextEncoderModel",
"link": 80
},
{
"name": "tokenizer",
"type": "Tokenizer",
"link": 81
},
{
"name": "processor",
"shape": 7,
"type": "Processor",
"link": null
},
{
"name": "model_name",
"type": "STRING",
"widget": {
"name": "model_name"
},
"link": 82
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
87
]
}
],
"properties": {
"Node name for S&R": "CombineZImagePipeline"
},
"widgets_values": [
"",
"model_cpu_offload"
]
},
{
"id": 92,
"type": "LoadZImageTransformerModel",
"pos": [
275.9798278808594,
-465.2391052246094
],
"size": [
416.3677673339844,
106.13789367675781
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
95
]
},
{
"name": "model_name",
"type": "STRING",
"links": [
82
]
}
],
"properties": {
"Node name for S&R": "LoadZImageTransformerModel"
},
"widgets_values": [
"z_image_turbo_bf16.safetensors",
"bf16"
]
},
{
"id": 102,
"type": "LoadZImageControlNetInModel",
"pos": [
779.793189390101,
-457.3825558553134
],
"size": [
589.8698159570357,
82
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "transformer",
"type": "TransformerModel",
"link": 95
}
],
"outputs": [
{
"name": "transformer",
"type": "TransformerModel",
"links": [
96
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInModel"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
]
},
{
"id": 99,
"type": "ZImageControlSampler",
"pos": [
727.2482831521481,
-52.41010988674983
],
"size": [
270,
350
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 87
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 88
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 98
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
90
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
},
{
"id": 93,
"type": "LoadZImageVAEModel",
"pos": [
1168.1599508804559,
-314.8650476692169
],
"size": [
377.8583984375,
84.69844055175781
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "vae",
"type": "VAEModel",
"links": [
79
]
}
],
"properties": {
"Node name for S&R": "LoadZImageVAEModel"
},
"widgets_values": [
"ae.safetensors",
"bf16"
]
},
{
"id": 100,
"type": "LoadImage",
"pos": [
281.12436800744575,
417.89046761218935
],
"size": [
270,
314.00000000000006
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
97
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"z-image-turbo_00004_.png",
"image"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1049.1402001998824,
-52.699751832945104
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 90
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 103,
"type": "ImageToPose",
"pos": [
582.6473087858849,
424.6900692435995
],
"size": [
226.09371582945823,
27.59660529340124
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "input_image",
"type": "IMAGE",
"link": 97
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
98,
99
]
}
],
"properties": {
"Node name for S&R": "ImageToPose"
}
},
{
"id": 104,
"type": "PreviewImage",
"pos": [
844.9628845788926,
422.400403774606
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 99
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
}
],
"links": [
[
79,
93,
0,
96,
1,
"VAEModel"
],
[
80,
91,
0,
96,
2,
"TextEncoderModel"
],
[
81,
91,
1,
96,
3,
"Tokenizer"
],
[
82,
92,
1,
96,
5,
"STRING"
],
[
87,
96,
0,
99,
0,
"FunModels"
],
[
88,
75,
0,
99,
1,
"STRING_PROMPT"
],
[
89,
73,
0,
99,
2,
"STRING_PROMPT"
],
[
90,
99,
0,
88,
0,
"IMAGE"
],
[
95,
92,
0,
102,
0,
"TransformerModel"
],
[
96,
102,
0,
96,
0,
"TransformerModel"
],
[
97,
100,
0,
103,
0,
"IMAGE"
],
[
98,
103,
0,
99,
3,
"IMAGE"
],
[
99,
103,
0,
104,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
227.96267700195312,
-546.4359741210938,
1350.4793699732413,
404.87677206390265
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7608917213421558,
"offset": [
217.08766227758116,
385.1943830579828
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "93aa7b2530dccd1e91c625eee439a5e24f8ffa04",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,320 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 91,
"last_link_id": 70,
"nodes": [
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
69
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
68
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1070.207763671875,
-73.63389587402344
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 70
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 80,
"type": "Note",
"pos": [
-424.31362772254084,
-372.4056987182365
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 86,
"type": "LoadZImageModel",
"pos": [
241.10867359909312,
-295.7069265122969
],
"size": [
428.9360739181402,
120.18527437036698
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
67
]
}
],
"properties": {
"Node name for S&R": "LoadZImageModel"
},
"widgets_values": [
"Z-Image-Turbo",
"model_cpu_offload",
"bf16"
]
},
{
"id": 91,
"type": "ZImageT2ISampler",
"pos": [
719.3201904296875,
-72.24609375
],
"size": [
280.724609375,
386
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 67
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 68
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 69
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
70
]
}
],
"properties": {
"Node name for S&R": "ZImageT2ISampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3
]
},
{
"id": 78,
"type": "Note",
"pos": [
17.042007499433538,
-27.473822111441212
],
"size": [
210,
88
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
67,
86,
0,
91,
0,
"FunModels"
],
[
68,
75,
0,
91,
1,
"STRING_PROMPT"
],
[
69,
73,
0,
91,
2,
"STRING_PROMPT"
],
[
70,
91,
0,
88,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
220,
-380,
472,
232
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.6378658119731967,
"offset": [
856.870045195949,
740.927030543633
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "244f11053106af1a58ac25fd0bbb508fd7b89c0f",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
@@ -0,0 +1,431 @@
{
"id": "dcf2fcac-6293-4a86-b30b-f63e420177f2",
"revision": 0,
"last_node_id": 101,
"last_link_id": 92,
"nodes": [
{
"id": 73,
"type": "FunTextBox",
"pos": [
250,
160
],
"size": [
383.7149963378906,
183.83506774902344
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
90
]
}
],
"title": "Negtive Prompt(反向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
]
},
{
"id": 78,
"type": "Note",
"pos": [
17.042007499433538,
-27.473822111441212
],
"size": [
210,
88
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"You can write prompt here\n(你可以在此填写提示词)"
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 75,
"type": "FunTextBox",
"pos": [
250,
-50
],
"size": [
383.54010009765625,
156.71620178222656
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "prompt",
"type": "STRING_PROMPT",
"slot_index": 0,
"links": [
89
]
}
],
"title": "Positive Prompt(正向提示词)",
"properties": {
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
"A photo of Sakura, a 17-year-old high school student from Japan, captured in a candid, high-fidelity cinematic moment on a rainy evening. She is squatting low on the rain-slicked asphalt of an urban sidewalk, holding a transparent vinyl umbrella with a white handle resting over her shoulder in one hand, her other hand resting on her knee. The clear plastic canopy is streaked with rivulets of water and beaded with droplets that catch the ambient city light. A profound, silent interaction defines the scene: Sakura is looking directly downward, her expression gentle and focused, locking eyes with a small black cat sitting on the wet ground in front of her.\n\nSakura has long, lustrous black hair styled in a precise hime cut with blunt bangs across her forehead and sidelocks framing her cheeks, damp strands clinging subtly to her jacket, with a single red ribbon tied on the left side. Her visible pores on her nose, and a soft sheen of moisture on her cheeks. She wears a dark navy sailor-style school uniform (seifuku) featuring a white collar with red linear detailing and a bright red necktie loosely knotted at the chest; a simple black choker encircles her neck. The uniform jacket has oversized sleeves. Her lower body features a short, dark pleated miniskirt that fans slightly over clean white ankle socks that provide a stark contrast to the wet asphalt, ending in dark leather loafers that gleam with moisture.\n\nThe black cat sits upright in a shallow puddle, its short fur slicked by the rain, tilting its head back to stare intently up into Sakura's face, establishing a clear line of sight. The background is anchored by a large, illuminated red vending machine standing against the darkness, its cool bluish-white interior light spilling onto Sakura's profile and the umbrella. The ground reflects the red chassis and the neon streetlights in distorted patches on the wet pavement. Additional cool rain streaks fall through the frame, some caught in sharp focus and others blurred into vertical lines against the background lights. The scene is rendered with a wide-aperture lens creating a shallow depth of field, keeping the girl and cat in sharp focus while softening the background into gentle bokeh, with the texture of fine-grain 35mm film stock.\n"
]
},
{
"id": 96,
"type": "LoadImage",
"pos": [
429.45065831038295,
448.4639992924031
],
"size": [
270,
314
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
91
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"a7kXeQ5l9Dhspes7q3x3G (1).png",
"image"
]
},
{
"id": 86,
"type": "LoadZImageModel",
"pos": [
158.6376150119142,
-352.0410222978062
],
"size": [
428.9360739181402,
120.18527437036698
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
81
]
}
],
"properties": {
"Node name for S&R": "LoadZImageModel"
},
"widgets_values": [
"Z-Image-Turbo",
"model_cpu_offload",
"bf16"
]
},
{
"id": 80,
"type": "Note",
"pos": [
-486.1347709940621,
-416.6940105696127
],
"size": [
598.1623727144193,
233.48501180428053
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {
"text": ""
},
"widgets_values": [
"GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].\nmodel_full_load means that the entire model will be moved to the GPU.\n\nmodel_full_load_and_qfloat8 means that the entire model will be moved to the GPU,\nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nmodel_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.\n\nmodel_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use, \nand the transformer model has been quantized to float8, which can save more GPU memory. \n\nsequential_cpu_offload means that each layer of the model will be moved to the CPU after use, \nresulting in slower speeds but saving a large amount of GPU memory."
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 99,
"type": "LoadZImageControlNetInPipeline",
"pos": [
662.479156335491,
-343.8489854292294
],
"size": [
556.7720385739738,
107.30044919237525
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 81
}
],
"outputs": [
{
"name": "funmodels",
"type": "FunModels",
"links": [
88
]
}
],
"properties": {
"Node name for S&R": "LoadZImageControlNetInPipeline"
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors",
"transformer"
]
},
{
"id": 88,
"type": "PreviewImage",
"pos": [
1070.207763671875,
-73.63389587402344
],
"size": [
366.56134033203125,
415.4429626464844
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 92
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 101,
"type": "ZImageControlSampler",
"pos": [
752.6720492832281,
-61.24351896170549
],
"size": [
270,
350
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "funmodels",
"type": "FunModels",
"link": 88
},
{
"name": "prompt",
"type": "STRING_PROMPT",
"link": 89
},
{
"name": "negative_prompt",
"type": "STRING_PROMPT",
"link": 90
},
{
"name": "control_image",
"shape": 7,
"type": "IMAGE",
"link": 91
},
{
"name": "inpaint_image",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"name": "mask_image",
"shape": 7,
"type": "IMAGE",
"link": null
}
],
"outputs": [
{
"name": "images",
"type": "IMAGE",
"links": [
92
]
}
],
"properties": {
"Node name for S&R": "ZImageControlSampler"
},
"widgets_values": [
1184,
1568,
43,
"fixed",
8,
0,
"Flow",
3,
0.8
]
}
],
"links": [
[
81,
86,
0,
99,
0,
"FunModels"
],
[
88,
99,
0,
101,
0,
"FunModels"
],
[
89,
75,
0,
101,
1,
"STRING_PROMPT"
],
[
90,
73,
0,
101,
2,
"STRING_PROMPT"
],
[
91,
96,
0,
101,
3,
"IMAGE"
],
[
92,
101,
0,
88,
0,
"IMAGE"
]
],
"groups": [
{
"id": 1,
"title": "Load Model",
"bounding": [
137.52894141282107,
-436.3340957855093,
472,
232
],
"color": "#b06634",
"font_size": 24,
"flags": {}
},
{
"id": 2,
"title": "Prompts",
"bounding": [
218,
-127,
450,
483
],
"color": "#3f789e",
"font_size": 24,
"flags": {}
}
],
"config": {},
"extra": {
"ds": {
"scale": 0.7396517503305734,
"offset": [
584.364342724736,
515.7058946883703
]
},
"frontendVersion": "1.36.11",
"workflowRendererVersion": "LG",
"workspace_info": {
"id": "776b62b4-bd17-4ed3-9923-b7aad000b1ea"
},
"node_versions": {
"CogVideoX-Fun": "244f11053106af1a58ac25fd0bbb508fd7b89c0f",
"comfy-core": "0.6.0"
}
},
"version": 0.4
}
+3 -3
View File
@@ -34,7 +34,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -150,8 +150,8 @@
"Node name for S&R": "LoadZImageModel"
},
"widgets_values": [
"Z-Image-Turbo",
"model_cpu_offload",
"Z-Image",
"model_group_offload",
"bf16"
]
},
@@ -34,7 +34,7 @@
"Node name for S&R": "FunTextBox"
},
"widgets_values": [
""
"低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
]
},
{
@@ -160,8 +160,8 @@
"Node name for S&R": "LoadZImageModel"
},
"widgets_values": [
"Z-Image-Turbo",
"model_cpu_offload",
"Z-Image",
"model_group_offload",
"bf16"
]
},
@@ -225,7 +225,7 @@
},
"widgets_values": [
"z_image/z_image_control_2.1.yaml",
"Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors",
"Z-Image-Fun-Controlnet-Union-2.1.safetensors",
"transformer"
]
},
+1 -1
View File
@@ -69,7 +69,7 @@ model_name = "models/Diffusion_Transformer/FLUX.2-dev"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors"
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
vae_path = None
lora_path = None
+1 -1
View File
@@ -69,7 +69,7 @@ model_name = "models/Diffusion_Transformer/FLUX.2-dev"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors"
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
vae_path = None
lora_path = None
@@ -69,7 +69,7 @@ model_name = "models/Diffusion_Transformer/FLUX.2-dev"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors"
transformer_path = "models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors"
vae_path = None
lora_path = None
+2 -2
View File
@@ -160,13 +160,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -56,13 +56,13 @@ compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
model_name = "models/Diffusion_Transformer/Z-Image"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
transformer_path = "models/Personalized_Model/Z-Image-Fun-Controlnet-Union-2.1-8steps.safetensors"
vae_path = None
lora_path = None
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -56,13 +56,13 @@ compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1_lite.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
model_name = "models/Diffusion_Transformer/Z-Image"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
transformer_path = "models/Personalized_Model/Z-Image-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
vae_path = None
lora_path = None
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -56,13 +56,13 @@ compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
model_name = "models/Diffusion_Transformer/Z-Image"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
transformer_path = "models/Personalized_Model/Z-Image-Fun-Controlnet-Union-2.1-8steps.safetensors"
vae_path = None
lora_path = None
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -56,13 +56,13 @@ compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1_lite.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
model_name = "models/Diffusion_Transformer/Z-Image"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
transformer_path = "models/Personalized_Model/Z-Image-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
vae_path = None
lora_path = None
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -0,0 +1,241 @@
import os
import sys
import numpy as np
import torch
from diffusers import FlowMatchEulerDiscreteScheduler
from omegaconf import OmegaConf
from PIL import Image
current_file_path = os.path.abspath(__file__)
project_roots = [os.path.dirname(current_file_path), os.path.dirname(os.path.dirname(current_file_path)), os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))]
for project_root in project_roots:
sys.path.insert(0, project_root) if project_root not in sys.path else None
from videox_fun.dist import set_multi_gpus_devices, shard_model
from videox_fun.models import (AutoencoderKL, AutoTokenizer,
Qwen3ForCausalLM, ZImageControlTransformer2DModel)
from videox_fun.models.cache_utils import get_teacache_coefficients
from videox_fun.pipeline import ZImageControlPipeline
from videox_fun.utils.fm_solvers import FlowDPMSolverMultistepScheduler
from videox_fun.utils.fm_solvers_unipc import FlowUniPCMultistepScheduler
from videox_fun.utils.fp8_optimization import (convert_model_weight_to_float8,
convert_weight_dtype_wrapper)
from videox_fun.utils.lora_utils import merge_lora, unmerge_lora
from videox_fun.utils.utils import (filter_kwargs, get_image_to_video_latent, get_image_latent, get_image,
get_video_to_video_latent,
save_videos_grid)
# GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].
# model_full_load means that the entire model will be moved to the GPU.
#
# model_full_load_and_qfloat8 means that the entire model will be moved to the GPU,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# model_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.
#
# model_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# sequential_cpu_offload means that each layer of the model will be moved to the CPU after use,
# resulting in slower speeds but saving a large amount of GPU memory.
GPU_memory_mode = "model_cpu_offload"
# Multi GPUs config
# Please ensure that the product of ulysses_degree and ring_degree equals the number of GPUs used.
# For example, if you are using 8 GPUs, you can set ulysses_degree = 2 and ring_degree = 4.
# If you are using 1 GPU, you can set ulysses_degree = 1 and ring_degree = 1.
ulysses_degree = 1
ring_degree = 1
# Use FSDP to save more GPU memory in multi gpus.
fsdp_dit = False
fsdp_text_encoder = False
# Compile will give a speedup in fixed resolution and need a little GPU memory.
# The compile_dit is not compatible with the fsdp_dit and sequential_cpu_offload.
compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
vae_path = None
lora_path = None
# Other params
sample_size = [1728, 992]
# Use torch.float16 if GPU does not support torch.bfloat16
# ome graphics cards, such as v100, 2080ti, do not support torch.bfloat16
weight_dtype = torch.bfloat16
control_image = "asset/pose.jpg"
inpaint_image = "asset/8.png"
mask_image = "asset/mask.png"
control_context_scale = 0.75
# Please use as detailed a prompt as possible to describe the object that needs to be generated.
prompt = "画面中央是一位年轻女孩,她拥有一头令人印象深刻的亮紫色长发,发丝在海风中轻盈飘扬,营造出动感而唯美的效果。她的长发两侧各扎着黑色蝴蝶结发饰,增添了几分可爱与俏皮感。女孩身穿一袭纯白色无袖连衣裙,裙摆轻盈飘逸,与她清新的气质完美契合。她的妆容精致自然,淡粉色的唇妆和温柔的眼神流露出恬静优雅的气质。她单手叉腰,姿态自信从容,目光直视镜头,展现出既甜美又不失个性的魅力。背景是一片开阔的海景,湛蓝的海水在阳光照射下波光粼粼,闪烁着钻石般的光芒。天空呈现出清澈的蔚蓝色,点缀着几朵洁白的云朵,营造出晴朗明媚的夏日氛围。画面前景右下角可见粉紫色的小花丛和绿色植物,为整体构图增添了自然生机和色彩层次。整张照片色调明亮清新,紫色头发与白色裙装、蓝色海天形成鲜明而和谐的色彩对比,呈现出一种童话般的浪漫意境,宛如二次元世界与现实海景的完美融合。"
negative_prompt = " "
guidance_scale = 0.00
seed = 43
num_inference_steps = 8
lora_weight = 0.55
save_path = "samples/z-image-t2i-control"
device = set_multi_gpus_devices(ulysses_degree, ring_degree)
config = OmegaConf.load(config_path)
transformer = ZImageControlTransformer2DModel.from_pretrained(
model_name,
subfolder="transformer",
low_cpu_mem_usage=True,
torch_dtype=weight_dtype,
transformer_additional_kwargs=OmegaConf.to_container(config['transformer_additional_kwargs']),
).to(weight_dtype)
if transformer_path is not None:
print(f"From checkpoint: {transformer_path}")
if transformer_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(transformer_path)
else:
state_dict = torch.load(transformer_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = transformer.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get Vae
vae = AutoencoderKL.from_pretrained(
model_name,
subfolder="vae"
).to(weight_dtype)
if vae_path is not None:
print(f"From checkpoint: {vae_path}")
if vae_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(vae_path)
else:
state_dict = torch.load(vae_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = vae.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get tokenizer and text_encoder
tokenizer = AutoTokenizer.from_pretrained(
model_name, subfolder="tokenizer"
)
text_encoder = Qwen3ForCausalLM.from_pretrained(
model_name, subfolder="text_encoder", torch_dtype=weight_dtype,
low_cpu_mem_usage=True,
)
# Get Scheduler
Chosen_Scheduler = scheduler_dict = {
"Flow": FlowMatchEulerDiscreteScheduler,
"Flow_Unipc": FlowUniPCMultistepScheduler,
"Flow_DPM++": FlowDPMSolverMultistepScheduler,
}[sampler_name]
scheduler = Chosen_Scheduler.from_pretrained(
model_name,
subfolder="scheduler"
)
pipeline = ZImageControlPipeline(
vae=vae,
tokenizer=tokenizer,
text_encoder=text_encoder,
transformer=transformer,
scheduler=scheduler,
)
if ulysses_degree > 1 or ring_degree > 1:
from functools import partial
transformer.enable_multi_gpus_inference()
if fsdp_dit:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(transformer.layers))
pipeline.transformer = shard_fn(pipeline.transformer)
print("Add FSDP DIT")
if fsdp_text_encoder:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(text_encoder.model.layers))
text_encoder = shard_fn(text_encoder)
print("Add FSDP TEXT ENCODER")
if compile_dit:
for i in range(len(pipeline.transformer.transformer_blocks)):
pipeline.transformer.transformer_blocks[i] = torch.compile(pipeline.transformer.transformer_blocks[i])
print("Add Compile")
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
pipeline.to(device=device)
generator = torch.Generator(device=device).manual_seed(seed)
if lora_path is not None:
pipeline = merge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
with torch.no_grad():
if inpaint_image is not None:
inpaint_image = get_image_latent(inpaint_image, sample_size=sample_size)[:, :, 0]
else:
inpaint_image = torch.zeros([1, 3, sample_size[0], sample_size[1]])
if mask_image is not None:
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
else:
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
if control_image is not None:
control_image = get_image_latent(control_image, sample_size=sample_size)[:, :, 0]
sample = pipeline(
prompt = prompt,
negative_prompt = negative_prompt,
height = sample_size[0],
width = sample_size[1],
generator = generator,
guidance_scale = guidance_scale,
image = inpaint_image,
mask_image = mask_image,
control_image = control_image,
num_inference_steps = num_inference_steps,
control_context_scale = control_context_scale,
).images
if lora_path is not None:
pipeline = unmerge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
def save_results():
if not os.path.exists(save_path):
os.makedirs(save_path, exist_ok=True)
index = len([path for path in os.listdir(save_path)]) + 1
prefix = str(index).zfill(8)
video_path = os.path.join(save_path, prefix + ".png")
image = sample[0]
image.save(video_path)
if ulysses_degree * ring_degree > 1:
import torch.distributed as dist
if dist.get_rank() == 0:
save_results()
else:
save_results()
@@ -0,0 +1,241 @@
import os
import sys
import numpy as np
import torch
from diffusers import FlowMatchEulerDiscreteScheduler
from omegaconf import OmegaConf
from PIL import Image
current_file_path = os.path.abspath(__file__)
project_roots = [os.path.dirname(current_file_path), os.path.dirname(os.path.dirname(current_file_path)), os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))]
for project_root in project_roots:
sys.path.insert(0, project_root) if project_root not in sys.path else None
from videox_fun.dist import set_multi_gpus_devices, shard_model
from videox_fun.models import (AutoencoderKL, AutoTokenizer,
Qwen3ForCausalLM, ZImageControlTransformer2DModel)
from videox_fun.models.cache_utils import get_teacache_coefficients
from videox_fun.pipeline import ZImageControlPipeline
from videox_fun.utils.fm_solvers import FlowDPMSolverMultistepScheduler
from videox_fun.utils.fm_solvers_unipc import FlowUniPCMultistepScheduler
from videox_fun.utils.fp8_optimization import (convert_model_weight_to_float8,
convert_weight_dtype_wrapper)
from videox_fun.utils.lora_utils import merge_lora, unmerge_lora
from videox_fun.utils.utils import (filter_kwargs, get_image_to_video_latent, get_image_latent, get_image,
get_video_to_video_latent,
save_videos_grid)
# GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].
# model_full_load means that the entire model will be moved to the GPU.
#
# model_full_load_and_qfloat8 means that the entire model will be moved to the GPU,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# model_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.
#
# model_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# sequential_cpu_offload means that each layer of the model will be moved to the CPU after use,
# resulting in slower speeds but saving a large amount of GPU memory.
GPU_memory_mode = "model_cpu_offload"
# Multi GPUs config
# Please ensure that the product of ulysses_degree and ring_degree equals the number of GPUs used.
# For example, if you are using 8 GPUs, you can set ulysses_degree = 2 and ring_degree = 4.
# If you are using 1 GPU, you can set ulysses_degree = 1 and ring_degree = 1.
ulysses_degree = 1
ring_degree = 1
# Use FSDP to save more GPU memory in multi gpus.
fsdp_dit = False
fsdp_text_encoder = False
# Compile will give a speedup in fixed resolution and need a little GPU memory.
# The compile_dit is not compatible with the fsdp_dit and sequential_cpu_offload.
compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1_lite.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
vae_path = None
lora_path = None
# Other params
sample_size = [1728, 992]
# Use torch.float16 if GPU does not support torch.bfloat16
# ome graphics cards, such as v100, 2080ti, do not support torch.bfloat16
weight_dtype = torch.bfloat16
control_image = "asset/pose.jpg"
inpaint_image = "asset/8.png"
mask_image = "asset/mask.png"
control_context_scale = 0.85
# Please use as detailed a prompt as possible to describe the object that needs to be generated.
prompt = "画面中央是一位年轻女孩,她拥有一头令人印象深刻的亮紫色长发,发丝在海风中轻盈飘扬,营造出动感而唯美的效果。她的长发两侧各扎着黑色蝴蝶结发饰,增添了几分可爱与俏皮感。女孩身穿一袭纯白色无袖连衣裙,裙摆轻盈飘逸,与她清新的气质完美契合。她的妆容精致自然,淡粉色的唇妆和温柔的眼神流露出恬静优雅的气质。她单手叉腰,姿态自信从容,目光直视镜头,展现出既甜美又不失个性的魅力。背景是一片开阔的海景,湛蓝的海水在阳光照射下波光粼粼,闪烁着钻石般的光芒。天空呈现出清澈的蔚蓝色,点缀着几朵洁白的云朵,营造出晴朗明媚的夏日氛围。画面前景右下角可见粉紫色的小花丛和绿色植物,为整体构图增添了自然生机和色彩层次。整张照片色调明亮清新,紫色头发与白色裙装、蓝色海天形成鲜明而和谐的色彩对比,呈现出一种童话般的浪漫意境,宛如二次元世界与现实海景的完美融合。"
negative_prompt = " "
guidance_scale = 0.00
seed = 43
num_inference_steps = 8
lora_weight = 0.55
save_path = "samples/z-image-t2i-control"
device = set_multi_gpus_devices(ulysses_degree, ring_degree)
config = OmegaConf.load(config_path)
transformer = ZImageControlTransformer2DModel.from_pretrained(
model_name,
subfolder="transformer",
low_cpu_mem_usage=True,
torch_dtype=weight_dtype,
transformer_additional_kwargs=OmegaConf.to_container(config['transformer_additional_kwargs']),
).to(weight_dtype)
if transformer_path is not None:
print(f"From checkpoint: {transformer_path}")
if transformer_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(transformer_path)
else:
state_dict = torch.load(transformer_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = transformer.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get Vae
vae = AutoencoderKL.from_pretrained(
model_name,
subfolder="vae"
).to(weight_dtype)
if vae_path is not None:
print(f"From checkpoint: {vae_path}")
if vae_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(vae_path)
else:
state_dict = torch.load(vae_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = vae.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get tokenizer and text_encoder
tokenizer = AutoTokenizer.from_pretrained(
model_name, subfolder="tokenizer"
)
text_encoder = Qwen3ForCausalLM.from_pretrained(
model_name, subfolder="text_encoder", torch_dtype=weight_dtype,
low_cpu_mem_usage=True,
)
# Get Scheduler
Chosen_Scheduler = scheduler_dict = {
"Flow": FlowMatchEulerDiscreteScheduler,
"Flow_Unipc": FlowUniPCMultistepScheduler,
"Flow_DPM++": FlowDPMSolverMultistepScheduler,
}[sampler_name]
scheduler = Chosen_Scheduler.from_pretrained(
model_name,
subfolder="scheduler"
)
pipeline = ZImageControlPipeline(
vae=vae,
tokenizer=tokenizer,
text_encoder=text_encoder,
transformer=transformer,
scheduler=scheduler,
)
if ulysses_degree > 1 or ring_degree > 1:
from functools import partial
transformer.enable_multi_gpus_inference()
if fsdp_dit:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(transformer.layers))
pipeline.transformer = shard_fn(pipeline.transformer)
print("Add FSDP DIT")
if fsdp_text_encoder:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(text_encoder.model.layers))
text_encoder = shard_fn(text_encoder)
print("Add FSDP TEXT ENCODER")
if compile_dit:
for i in range(len(pipeline.transformer.transformer_blocks)):
pipeline.transformer.transformer_blocks[i] = torch.compile(pipeline.transformer.transformer_blocks[i])
print("Add Compile")
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
pipeline.to(device=device)
generator = torch.Generator(device=device).manual_seed(seed)
if lora_path is not None:
pipeline = merge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
with torch.no_grad():
if inpaint_image is not None:
inpaint_image = get_image_latent(inpaint_image, sample_size=sample_size)[:, :, 0]
else:
inpaint_image = torch.zeros([1, 3, sample_size[0], sample_size[1]])
if mask_image is not None:
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
else:
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
if control_image is not None:
control_image = get_image_latent(control_image, sample_size=sample_size)[:, :, 0]
sample = pipeline(
prompt = prompt,
negative_prompt = negative_prompt,
height = sample_size[0],
width = sample_size[1],
generator = generator,
guidance_scale = guidance_scale,
image = inpaint_image,
mask_image = mask_image,
control_image = control_image,
num_inference_steps = num_inference_steps,
control_context_scale = control_context_scale,
).images
if lora_path is not None:
pipeline = unmerge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
def save_results():
if not os.path.exists(save_path):
os.makedirs(save_path, exist_ok=True)
index = len([path for path in os.listdir(save_path)]) + 1
prefix = str(index).zfill(8)
video_path = os.path.join(save_path, prefix + ".png")
image = sample[0]
image.save(video_path)
if ulysses_degree * ring_degree > 1:
import torch.distributed as dist
if dist.get_rank() == 0:
save_results()
else:
save_results()
@@ -176,13 +176,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -176,13 +176,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -173,13 +173,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -175,13 +175,13 @@ if compile_dit:
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["img_in", "txt_in", "timestep"], device=device)
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
@@ -0,0 +1,241 @@
import os
import sys
import numpy as np
import torch
from diffusers import FlowMatchEulerDiscreteScheduler
from omegaconf import OmegaConf
from PIL import Image
current_file_path = os.path.abspath(__file__)
project_roots = [os.path.dirname(current_file_path), os.path.dirname(os.path.dirname(current_file_path)), os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))]
for project_root in project_roots:
sys.path.insert(0, project_root) if project_root not in sys.path else None
from videox_fun.dist import set_multi_gpus_devices, shard_model
from videox_fun.models import (AutoencoderKL, AutoTokenizer,
Qwen3ForCausalLM, ZImageControlTransformer2DModel)
from videox_fun.models.cache_utils import get_teacache_coefficients
from videox_fun.pipeline import ZImageControlPipeline
from videox_fun.utils.fm_solvers import FlowDPMSolverMultistepScheduler
from videox_fun.utils.fm_solvers_unipc import FlowUniPCMultistepScheduler
from videox_fun.utils.fp8_optimization import (convert_model_weight_to_float8,
convert_weight_dtype_wrapper)
from videox_fun.utils.lora_utils import merge_lora, unmerge_lora
from videox_fun.utils.utils import (filter_kwargs, get_image_to_video_latent, get_image_latent, get_image,
get_video_to_video_latent,
save_videos_grid)
# GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].
# model_full_load means that the entire model will be moved to the GPU.
#
# model_full_load_and_qfloat8 means that the entire model will be moved to the GPU,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# model_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.
#
# model_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# sequential_cpu_offload means that each layer of the model will be moved to the CPU after use,
# resulting in slower speeds but saving a large amount of GPU memory.
GPU_memory_mode = "model_cpu_offload"
# Multi GPUs config
# Please ensure that the product of ulysses_degree and ring_degree equals the number of GPUs used.
# For example, if you are using 8 GPUs, you can set ulysses_degree = 2 and ring_degree = 4.
# If you are using 1 GPU, you can set ulysses_degree = 1 and ring_degree = 1.
ulysses_degree = 1
ring_degree = 1
# Use FSDP to save more GPU memory in multi gpus.
fsdp_dit = False
fsdp_text_encoder = False
# Compile will give a speedup in fixed resolution and need a little GPU memory.
# The compile_dit is not compatible with the fsdp_dit and sequential_cpu_offload.
compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-8steps.safetensors"
vae_path = None
lora_path = None
# Other params
sample_size = [1728, 992]
# Use torch.float16 if GPU does not support torch.bfloat16
# ome graphics cards, such as v100, 2080ti, do not support torch.bfloat16
weight_dtype = torch.bfloat16
control_image = "asset/pose.jpg"
inpaint_image = None
mask_image = None
control_context_scale = 0.75
# 使用更长的neg prompt如"模糊,突变,变形,失真,画面暗,文本字幕,画面固定,连环画,漫画,线稿,没有主体。",可以增加稳定性
prompt = "画面中央是一位年轻女孩,她拥有一头令人印象深刻的亮紫色长发,发丝在海风中轻盈飘扬,营造出动感而唯美的效果。她的长发两侧各扎着黑色蝴蝶结发饰,增添了几分可爱与俏皮感。女孩身穿一袭纯白色无袖连衣裙,裙摆轻盈飘逸,与她清新的气质完美契合。她的妆容精致自然,淡粉色的唇妆和温柔的眼神流露出恬静优雅的气质。她单手叉腰,姿态自信从容,目光直视镜头,展现出既甜美又不失个性的魅力。背景是一片开阔的海景,湛蓝的海水在阳光照射下波光粼粼,闪烁着钻石般的光芒。天空呈现出清澈的蔚蓝色,点缀着几朵洁白的云朵,营造出晴朗明媚的夏日氛围。画面前景右下角可见粉紫色的小花丛和绿色植物,为整体构图增添了自然生机和色彩层次。整张照片色调明亮清新,紫色头发与白色裙装、蓝色海天形成鲜明而和谐的色彩对比,呈现出一种童话般的浪漫意境,宛如二次元世界与现实海景的完美融合。"
negative_prompt = " "
guidance_scale = 0.00
seed = 43
num_inference_steps = 8
lora_weight = 0.55
save_path = "samples/z-image-t2i-control"
device = set_multi_gpus_devices(ulysses_degree, ring_degree)
config = OmegaConf.load(config_path)
transformer = ZImageControlTransformer2DModel.from_pretrained(
model_name,
subfolder="transformer",
low_cpu_mem_usage=True,
torch_dtype=weight_dtype,
transformer_additional_kwargs=OmegaConf.to_container(config['transformer_additional_kwargs']),
).to(weight_dtype)
if transformer_path is not None:
print(f"From checkpoint: {transformer_path}")
if transformer_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(transformer_path)
else:
state_dict = torch.load(transformer_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = transformer.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get Vae
vae = AutoencoderKL.from_pretrained(
model_name,
subfolder="vae"
).to(weight_dtype)
if vae_path is not None:
print(f"From checkpoint: {vae_path}")
if vae_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(vae_path)
else:
state_dict = torch.load(vae_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = vae.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get tokenizer and text_encoder
tokenizer = AutoTokenizer.from_pretrained(
model_name, subfolder="tokenizer"
)
text_encoder = Qwen3ForCausalLM.from_pretrained(
model_name, subfolder="text_encoder", torch_dtype=weight_dtype,
low_cpu_mem_usage=True,
)
# Get Scheduler
Chosen_Scheduler = scheduler_dict = {
"Flow": FlowMatchEulerDiscreteScheduler,
"Flow_Unipc": FlowUniPCMultistepScheduler,
"Flow_DPM++": FlowDPMSolverMultistepScheduler,
}[sampler_name]
scheduler = Chosen_Scheduler.from_pretrained(
model_name,
subfolder="scheduler"
)
pipeline = ZImageControlPipeline(
vae=vae,
tokenizer=tokenizer,
text_encoder=text_encoder,
transformer=transformer,
scheduler=scheduler,
)
if ulysses_degree > 1 or ring_degree > 1:
from functools import partial
transformer.enable_multi_gpus_inference()
if fsdp_dit:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(transformer.layers))
pipeline.transformer = shard_fn(pipeline.transformer)
print("Add FSDP DIT")
if fsdp_text_encoder:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(text_encoder.model.layers))
text_encoder = shard_fn(text_encoder)
print("Add FSDP TEXT ENCODER")
if compile_dit:
for i in range(len(pipeline.transformer.transformer_blocks)):
pipeline.transformer.transformer_blocks[i] = torch.compile(pipeline.transformer.transformer_blocks[i])
print("Add Compile")
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
pipeline.to(device=device)
generator = torch.Generator(device=device).manual_seed(seed)
if lora_path is not None:
pipeline = merge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
with torch.no_grad():
if inpaint_image is not None:
inpaint_image = get_image_latent(inpaint_image, sample_size=sample_size)[:, :, 0]
else:
inpaint_image = torch.zeros([1, 3, sample_size[0], sample_size[1]])
if mask_image is not None:
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
else:
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
if control_image is not None:
control_image = get_image_latent(control_image, sample_size=sample_size)[:, :, 0]
sample = pipeline(
prompt = prompt,
negative_prompt = negative_prompt,
height = sample_size[0],
width = sample_size[1],
generator = generator,
guidance_scale = guidance_scale,
image = inpaint_image,
mask_image = mask_image,
control_image = control_image,
num_inference_steps = num_inference_steps,
control_context_scale = control_context_scale,
).images
if lora_path is not None:
pipeline = unmerge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
def save_results():
if not os.path.exists(save_path):
os.makedirs(save_path, exist_ok=True)
index = len([path for path in os.listdir(save_path)]) + 1
prefix = str(index).zfill(8)
video_path = os.path.join(save_path, prefix + ".png")
image = sample[0]
image.save(video_path)
if ulysses_degree * ring_degree > 1:
import torch.distributed as dist
if dist.get_rank() == 0:
save_results()
else:
save_results()
@@ -0,0 +1,241 @@
import os
import sys
import numpy as np
import torch
from diffusers import FlowMatchEulerDiscreteScheduler
from omegaconf import OmegaConf
from PIL import Image
current_file_path = os.path.abspath(__file__)
project_roots = [os.path.dirname(current_file_path), os.path.dirname(os.path.dirname(current_file_path)), os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))]
for project_root in project_roots:
sys.path.insert(0, project_root) if project_root not in sys.path else None
from videox_fun.dist import set_multi_gpus_devices, shard_model
from videox_fun.models import (AutoencoderKL, AutoTokenizer,
Qwen3ForCausalLM, ZImageControlTransformer2DModel)
from videox_fun.models.cache_utils import get_teacache_coefficients
from videox_fun.pipeline import ZImageControlPipeline
from videox_fun.utils.fm_solvers import FlowDPMSolverMultistepScheduler
from videox_fun.utils.fm_solvers_unipc import FlowUniPCMultistepScheduler
from videox_fun.utils.fp8_optimization import (convert_model_weight_to_float8,
convert_weight_dtype_wrapper)
from videox_fun.utils.lora_utils import merge_lora, unmerge_lora
from videox_fun.utils.utils import (filter_kwargs, get_image_to_video_latent, get_image_latent, get_image,
get_video_to_video_latent,
save_videos_grid)
# GPU memory mode, which can be chosen in [model_full_load, model_full_load_and_qfloat8, model_cpu_offload, model_cpu_offload_and_qfloat8, sequential_cpu_offload].
# model_full_load means that the entire model will be moved to the GPU.
#
# model_full_load_and_qfloat8 means that the entire model will be moved to the GPU,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# model_cpu_offload means that the entire model will be moved to the CPU after use, which can save some GPU memory.
#
# model_cpu_offload_and_qfloat8 indicates that the entire model will be moved to the CPU after use,
# and the transformer model has been quantized to float8, which can save more GPU memory.
#
# sequential_cpu_offload means that each layer of the model will be moved to the CPU after use,
# resulting in slower speeds but saving a large amount of GPU memory.
GPU_memory_mode = "model_cpu_offload"
# Multi GPUs config
# Please ensure that the product of ulysses_degree and ring_degree equals the number of GPUs used.
# For example, if you are using 8 GPUs, you can set ulysses_degree = 2 and ring_degree = 4.
# If you are using 1 GPU, you can set ulysses_degree = 1 and ring_degree = 1.
ulysses_degree = 1
ring_degree = 1
# Use FSDP to save more GPU memory in multi gpus.
fsdp_dit = False
fsdp_text_encoder = False
# Compile will give a speedup in fixed resolution and need a little GPU memory.
# The compile_dit is not compatible with the fsdp_dit and sequential_cpu_offload.
compile_dit = False
# Config and model path
config_path = "config/z_image/z_image_control_2.1_lite.yaml"
# model path
model_name = "models/Diffusion_Transformer/Z-Image-Turbo"
# Choose the sampler in "Flow", "Flow_Unipc", "Flow_DPM++"
sampler_name = "Flow"
# Load pretrained model if need
transformer_path = "models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1-lite-2601-8steps.safetensors"
vae_path = None
lora_path = None
# Other params
sample_size = [1728, 992]
# Use torch.float16 if GPU does not support torch.bfloat16
# ome graphics cards, such as v100, 2080ti, do not support torch.bfloat16
weight_dtype = torch.bfloat16
control_image = "asset/pose.jpg"
inpaint_image = None
mask_image = None
control_context_scale = 0.85
# 使用更长的neg prompt如"模糊,突变,变形,失真,画面暗,文本字幕,画面固定,连环画,漫画,线稿,没有主体。",可以增加稳定性
prompt = "画面中央是一位年轻女孩,她拥有一头令人印象深刻的亮紫色长发,发丝在海风中轻盈飘扬,营造出动感而唯美的效果。她的长发两侧各扎着黑色蝴蝶结发饰,增添了几分可爱与俏皮感。女孩身穿一袭纯白色无袖连衣裙,裙摆轻盈飘逸,与她清新的气质完美契合。她的妆容精致自然,淡粉色的唇妆和温柔的眼神流露出恬静优雅的气质。她单手叉腰,姿态自信从容,目光直视镜头,展现出既甜美又不失个性的魅力。背景是一片开阔的海景,湛蓝的海水在阳光照射下波光粼粼,闪烁着钻石般的光芒。天空呈现出清澈的蔚蓝色,点缀着几朵洁白的云朵,营造出晴朗明媚的夏日氛围。画面前景右下角可见粉紫色的小花丛和绿色植物,为整体构图增添了自然生机和色彩层次。整张照片色调明亮清新,紫色头发与白色裙装、蓝色海天形成鲜明而和谐的色彩对比,呈现出一种童话般的浪漫意境,宛如二次元世界与现实海景的完美融合。"
negative_prompt = " "
guidance_scale = 0.00
seed = 43
num_inference_steps = 8
lora_weight = 0.55
save_path = "samples/z-image-t2i-control"
device = set_multi_gpus_devices(ulysses_degree, ring_degree)
config = OmegaConf.load(config_path)
transformer = ZImageControlTransformer2DModel.from_pretrained(
model_name,
subfolder="transformer",
low_cpu_mem_usage=True,
torch_dtype=weight_dtype,
transformer_additional_kwargs=OmegaConf.to_container(config['transformer_additional_kwargs']),
).to(weight_dtype)
if transformer_path is not None:
print(f"From checkpoint: {transformer_path}")
if transformer_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(transformer_path)
else:
state_dict = torch.load(transformer_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = transformer.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get Vae
vae = AutoencoderKL.from_pretrained(
model_name,
subfolder="vae"
).to(weight_dtype)
if vae_path is not None:
print(f"From checkpoint: {vae_path}")
if vae_path.endswith("safetensors"):
from safetensors.torch import load_file, safe_open
state_dict = load_file(vae_path)
else:
state_dict = torch.load(vae_path, map_location="cpu")
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = vae.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
# Get tokenizer and text_encoder
tokenizer = AutoTokenizer.from_pretrained(
model_name, subfolder="tokenizer"
)
text_encoder = Qwen3ForCausalLM.from_pretrained(
model_name, subfolder="text_encoder", torch_dtype=weight_dtype,
low_cpu_mem_usage=True,
)
# Get Scheduler
Chosen_Scheduler = scheduler_dict = {
"Flow": FlowMatchEulerDiscreteScheduler,
"Flow_Unipc": FlowUniPCMultistepScheduler,
"Flow_DPM++": FlowDPMSolverMultistepScheduler,
}[sampler_name]
scheduler = Chosen_Scheduler.from_pretrained(
model_name,
subfolder="scheduler"
)
pipeline = ZImageControlPipeline(
vae=vae,
tokenizer=tokenizer,
text_encoder=text_encoder,
transformer=transformer,
scheduler=scheduler,
)
if ulysses_degree > 1 or ring_degree > 1:
from functools import partial
transformer.enable_multi_gpus_inference()
if fsdp_dit:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(transformer.layers))
pipeline.transformer = shard_fn(pipeline.transformer)
print("Add FSDP DIT")
if fsdp_text_encoder:
shard_fn = partial(shard_model, device_id=device, param_dtype=weight_dtype, module_to_wrapper=list(text_encoder.model.layers))
text_encoder = shard_fn(text_encoder)
print("Add FSDP TEXT ENCODER")
if compile_dit:
for i in range(len(pipeline.transformer.transformer_blocks)):
pipeline.transformer.transformer_blocks[i] = torch.compile(pipeline.transformer.transformer_blocks[i])
print("Add Compile")
if GPU_memory_mode == "sequential_cpu_offload":
pipeline.enable_sequential_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_cpu_offload":
pipeline.enable_model_cpu_offload(device=device)
elif GPU_memory_mode == "model_full_load_and_qfloat8":
convert_model_weight_to_float8(transformer, exclude_module_name=["x_pad_token", "cap_pad_token"], device=device)
convert_weight_dtype_wrapper(transformer, weight_dtype)
pipeline.to(device=device)
else:
pipeline.to(device=device)
generator = torch.Generator(device=device).manual_seed(seed)
if lora_path is not None:
pipeline = merge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
with torch.no_grad():
if inpaint_image is not None:
inpaint_image = get_image_latent(inpaint_image, sample_size=sample_size)[:, :, 0]
else:
inpaint_image = torch.zeros([1, 3, sample_size[0], sample_size[1]])
if mask_image is not None:
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
else:
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
if control_image is not None:
control_image = get_image_latent(control_image, sample_size=sample_size)[:, :, 0]
sample = pipeline(
prompt = prompt,
negative_prompt = negative_prompt,
height = sample_size[0],
width = sample_size[1],
generator = generator,
guidance_scale = guidance_scale,
image = inpaint_image,
mask_image = mask_image,
control_image = control_image,
num_inference_steps = num_inference_steps,
control_context_scale = control_context_scale,
).images
if lora_path is not None:
pipeline = unmerge_lora(pipeline, lora_path, lora_weight, device=device, dtype=weight_dtype)
def save_results():
if not os.path.exists(save_path):
os.makedirs(save_path, exist_ok=True)
index = len([path for path in os.listdir(save_path)]) + 1
prefix = str(index).zfill(8)
video_path = os.path.join(save_path, prefix + ".png")
image = sample[0]
image.save(video_path)
if ulysses_degree * ring_degree > 1:
import torch.distributed as dist
if dist.get_rank() == 0:
save_results()
else:
save_results()
-3
View File
@@ -1025,9 +1025,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1086,9 +1086,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
+3 -3
View File
@@ -71,7 +71,7 @@ accelerate launch --mixed_precision="bf16" scripts/flux2_fun/train_control.py \
--enable_bucket \
--low_vram \
--uniform_sampling \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors" \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors" \
--trainable_modules "control" \
--resume_from_checkpoint="latest"
```
@@ -112,7 +112,7 @@ accelerate launch --use_deepspeed --deepspeed_config_file config/zero_stage2_con
--enable_bucket \
--low_vram \
--uniform_sampling \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors" \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors" \
--trainable_modules "control" \
--resume_from_checkpoint="latest"
```
@@ -153,7 +153,7 @@ accelerate launch --mixed_precision="bf16" --use_fsdp --fsdp_auto_wrap_policy TR
--enable_bucket \
--low_vram \
--uniform_sampling \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors" \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors" \
--trainable_modules "control" \
--resume_from_checkpoint="latest"
```
+1 -1
View File
@@ -31,6 +31,6 @@ accelerate launch --mixed_precision="bf16" scripts/flux2_fun/train_control.py \
--enable_bucket \
--low_vram \
--uniform_sampling \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union.safetensors" \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors" \
--trainable_modules "control" \
--resume_from_checkpoint="latest"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,37 @@
export MODEL_NAME="models/Diffusion_Transformer/FLUX.2-dev"
export DATASET_NAME="datasets/internal_datasets/"
export DATASET_META_NAME="datasets/internal_datasets/metadata.json"
# NCCL_IB_DISABLE=1 and NCCL_P2P_DISABLE=1 are used in multi nodes without RDMA.
# export NCCL_IB_DISABLE=1
# export NCCL_P2P_DISABLE=1
NCCL_DEBUG=INFO
accelerate launch --mixed_precision="bf16" scripts/flux2_fun/train_control_distill.py \
--config_path="config/flux2/flux2_control.yaml" \
--pretrained_model_name_or_path=$MODEL_NAME \
--train_data_dir=$DATASET_NAME \
--train_data_meta=$DATASET_META_NAME \
--train_batch_size=1 \
--image_sample_size=1328 \
--gradient_accumulation_steps=1 \
--dataloader_num_workers=8 \
--num_train_epochs=100 \
--checkpointing_steps=50 \
--learning_rate=2e-06 \
--lr_scheduler="constant_with_warmup" \
--lr_warmup_steps=100 \
--seed=42 \
--output_dir="output_dir_flux2_control_CFG_Distill" \
--gradient_checkpointing \
--mixed_precision="bf16" \
--adam_weight_decay=3e-2 \
--adam_epsilon=1e-10 \
--vae_mini_batch=1 \
--max_grad_norm=0.05 \
--enable_bucket \
--low_vram \
--uniform_sampling \
--transformer_path="models/Personalized_Model/FLUX.2-dev-Fun-Controlnet-Union-2602.safetensors" \
--trainable_modules "control" \
--random_hw_adapt \
--resume_from_checkpoint="latest"
-3
View File
@@ -1130,9 +1130,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1039,9 +1039,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -966,9 +966,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -922,9 +922,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
+2
View File
@@ -945,6 +945,8 @@ def main():
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = generator_transformer3d.load_state_dict(state_dict, strict=False)
m, u = real_score_transformer3d.load_state_dict(state_dict, strict=False)
m, u = fake_score_transformer3d.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
assert len(u) == 0
+2 -3
View File
@@ -1007,6 +1007,8 @@ def main():
state_dict = state_dict["state_dict"] if "state_dict" in state_dict else state_dict
m, u = generator_transformer3d.load_state_dict(state_dict, strict=False)
m, u = real_score_transformer3d.load_state_dict(state_dict, strict=False)
m, u = fake_score_transformer3d.load_state_dict(state_dict, strict=False)
print(f"missing keys: {len(m)}, unexpected keys: {len(u)}")
assert len(u) == 0
@@ -1122,9 +1124,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator_fake_score_transformer3d.register_save_state_pre_hook(save_model_hook)
accelerator_fake_score_transformer3d.register_load_state_pre_hook(load_model_hook)
-3
View File
@@ -1059,9 +1059,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -970,9 +970,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1029,9 +1029,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1045,9 +1045,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1169,9 +1169,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator_fake_score_transformer3d.register_save_state_pre_hook(save_model_hook)
accelerator_fake_score_transformer3d.register_load_state_pre_hook(load_model_hook)
-3
View File
@@ -1111,9 +1111,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1095,9 +1095,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1059,9 +1059,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -1074,9 +1074,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
-3
View File
@@ -946,9 +946,6 @@ def main():
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
accelerator.register_save_state_pre_hook(save_model_hook)
accelerator.register_load_state_pre_hook(load_model_hook)
if args.gradient_checkpointing:
transformer3d.enable_gradient_checkpointing()
+2 -2
View File
@@ -1,4 +1,4 @@
export MODEL_NAME="models/Diffusion_Transformer/Z-Image-Turbo"
export MODEL_NAME="models/Diffusion_Transformer/Z-Image"
export DATASET_NAME="datasets/internal_datasets/"
export DATASET_META_NAME="datasets/internal_datasets/metadata.json"
# NCCL_IB_DISABLE=1 and NCCL_P2P_DISABLE=1 are used in multi nodes without RDMA.
@@ -31,5 +31,5 @@ accelerate launch --mixed_precision="bf16" scripts/z_image_fun/train_control.py
--enable_bucket \
--uniform_sampling \
--add_inpaint_info \
--transformer_path="models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1.safetensors" \
--transformer_path="models/Personalized_Model/Z-Image-Fun-Controlnet-Union-2.1.safetensors" \
--trainable_modules "control"
@@ -1659,6 +1659,8 @@ def main():
if args.low_vram and not args.enable_text_encoder_in_dataloader:
text_encoder.to('cpu')
torch.cuda.empty_cache()
if args.low_vram:
real_score_transformer3d = real_score_transformer3d.to(accelerator.device)
with accelerator.accumulate(generator_transformer3d):
def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
@@ -0,0 +1,35 @@
export MODEL_NAME="models/Diffusion_Transformer/Z-Image-Turbo"
export DATASET_NAME="datasets/internal_datasets/"
export DATASET_META_NAME="datasets/internal_datasets/metadata.json"
# NCCL_IB_DISABLE=1 and NCCL_P2P_DISABLE=1 are used in multi nodes without RDMA.
# export NCCL_IB_DISABLE=1
# export NCCL_P2P_DISABLE=1
NCCL_DEBUG=INFO
accelerate launch --mixed_precision="bf16" scripts/z_image_fun/train_control.py \
--config_path="config/z_image/z_image_control_2.1.yaml" \
--pretrained_model_name_or_path=$MODEL_NAME \
--train_data_dir=$DATASET_NAME \
--train_data_meta=$DATASET_META_NAME \
--train_batch_size=1 \
--image_sample_size=1328 \
--gradient_accumulation_steps=1 \
--dataloader_num_workers=8 \
--num_train_epochs=100 \
--checkpointing_steps=50 \
--learning_rate=2e-05 \
--lr_scheduler="constant_with_warmup" \
--lr_warmup_steps=100 \
--seed=42 \
--output_dir="output_dir_z_image_control" \
--gradient_checkpointing \
--mixed_precision="bf16" \
--adam_weight_decay=3e-2 \
--adam_epsilon=1e-10 \
--vae_mini_batch=1 \
--max_grad_norm=0.05 \
--enable_bucket \
--uniform_sampling \
--add_inpaint_info \
--transformer_path="models/Personalized_Model/Z-Image-Turbo-Fun-Controlnet-Union-2.1.safetensors" \
--trainable_modules "control"
@@ -28,6 +28,7 @@ from .flux2_transformer2d import (Flux2SingleTransformerBlock,
Flux2Transformer2DModel,
Flux2TransformerBlock)
VIDEOX_OFFLOAD_VACE_LATENTS = os.environ.get("VIDEOX_OFFLOAD_VACE_LATENTS", False)
class Flux2ControlTransformerBlock(Flux2TransformerBlock):
def __init__(
@@ -58,8 +59,16 @@ class Flux2ControlTransformerBlock(Flux2TransformerBlock):
all_c = list(torch.unbind(c))
c = all_c.pop(-1)
if VIDEOX_OFFLOAD_VACE_LATENTS:
c = c.to(x.device)
encoder_hidden_states, c = super().forward(c, **kwargs)
c_skip = self.after_proj(c)
if VIDEOX_OFFLOAD_VACE_LATENTS:
c_skip = c_skip.to("cpu")
c = c.to("cpu")
all_c += [c_skip, c]
c = torch.stack(all_c)
return encoder_hidden_states, c
@@ -82,7 +91,11 @@ class BaseFlux2TransformerBlock(Flux2TransformerBlock):
def forward(self, hidden_states, hints=None, context_scale=1.0, **kwargs):
encoder_hidden_states, hidden_states = super().forward(hidden_states, **kwargs)
if self.block_id is not None:
hidden_states = hidden_states + hints[self.block_id] * context_scale
if VIDEOX_OFFLOAD_VACE_LATENTS:
hidden_states = hidden_states + hints[self.block_id].to(hidden_states.device) * context_scale
else:
hidden_states = hidden_states + hints[self.block_id] * context_scale
return encoder_hidden_states, hidden_states
@@ -40,7 +40,7 @@ from .z_image_transformer2d import (ZImageTransformer2DModel, FinalLayer,
ADALN_EMBED_DIM = 256
SEQ_MULTI_OF = 32
VIDEOX_OFFLOAD_VACE_LATENTS = os.environ.get("VIDEOX_OFFLOAD_VACE_LATENTS", False)
class ZImageControlTransformerBlock(ZImageTransformerBlock):
def __init__(
@@ -72,8 +72,16 @@ class ZImageControlTransformerBlock(ZImageTransformerBlock):
all_c = list(torch.unbind(c))
c = all_c.pop(-1)
if VIDEOX_OFFLOAD_VACE_LATENTS:
c = c.to(x.device)
c = super().forward(c, **kwargs)
c_skip = self.after_proj(c)
if VIDEOX_OFFLOAD_VACE_LATENTS:
c_skip = c_skip.to("cpu")
c = c.to("cpu")
all_c += [c_skip, c]
c = torch.stack(all_c)
return c
@@ -97,8 +105,12 @@ class BaseZImageTransformerBlock(ZImageTransformerBlock):
def forward(self, hidden_states, hints=None, context_scale=1.0, **kwargs):
hidden_states = super().forward(hidden_states, **kwargs)
if self.block_id is not None:
hidden_states = hidden_states + hints[self.block_id] * context_scale
if VIDEOX_OFFLOAD_VACE_LATENTS:
hidden_states = hidden_states + hints[self.block_id].to(hidden_states.device) * context_scale
else:
hidden_states = hidden_states + hints[self.block_id] * context_scale
return hidden_states
class ZImageControlTransformer2DModel(ZImageTransformer2DModel):
@register_to_config
+27 -1
View File
@@ -621,11 +621,13 @@ class Flux2Pipeline(DiffusionPipeline):
self,
image: Optional[Union[List[PIL.Image.Image], PIL.Image.Image]] = None,
prompt: Union[str, List[str]] = None,
negative_prompt: Union[str, List[str]] = None,
height: Optional[int] = None,
width: Optional[int] = None,
num_inference_steps: int = 50,
sigmas: Optional[List[float]] = None,
guidance_scale: Optional[float] = 4.0,
true_cfg_scale: Optional[float] = 1.0,
num_images_per_prompt: int = 1,
generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
latents: Optional[torch.Tensor] = None,
@@ -734,6 +736,8 @@ class Flux2Pipeline(DiffusionPipeline):
batch_size = prompt_embeds.shape[0]
device = self._execution_device
has_neg_prompt = negative_prompt is not None
do_true_cfg = true_cfg_scale > 1 and has_neg_prompt
if comfyui_progressbar:
from comfy.utils import ProgressBar
pbar = ProgressBar(num_inference_steps + 2)
@@ -747,6 +751,15 @@ class Flux2Pipeline(DiffusionPipeline):
max_sequence_length=max_sequence_length,
text_encoder_out_layers=text_encoder_out_layers,
)
if do_true_cfg:
negative_prompt_embeds, negative_text_ids = self.encode_prompt(
prompt=negative_prompt,
prompt_embeds=None,
device=device,
num_images_per_prompt=num_images_per_prompt,
max_sequence_length=max_sequence_length,
text_encoder_out_layers=text_encoder_out_layers,
)
# 4. process images
if image is not None and not isinstance(image, list):
@@ -854,9 +867,22 @@ class Flux2Pipeline(DiffusionPipeline):
joint_attention_kwargs=self._attention_kwargs,
return_dict=False,
)[0]
noise_pred = noise_pred[:, : latents.size(1) :]
if do_true_cfg:
neg_noise_pred = self.transformer(
hidden_states=latent_model_input, # (B, image_seq_len, C)
timestep=timestep / 1000,
guidance=guidance,
encoder_hidden_states=negative_prompt_embeds,
txt_ids=negative_text_ids, # B, text_seq_len, 4
img_ids=latent_image_ids, # B, image_seq_len, 4
joint_attention_kwargs=self._attention_kwargs,
return_dict=False,
)[0]
neg_noise_pred = neg_noise_pred[:, : latents.size(1) :]
noise_pred = neg_noise_pred + true_cfg_scale * (noise_pred - neg_noise_pred)
# compute the previous noisy sample x_t -> x_t-1
latents_dtype = latents.dtype
latents = self.scheduler.step(noise_pred, t, latents, return_dict=False)[0]
+30 -1
View File
@@ -626,6 +626,7 @@ class Flux2ControlPipeline(DiffusionPipeline):
def __call__(
self,
prompt: Union[str, List[str]] = None,
negative_prompt: Union[str, List[str]] = None,
height: Optional[int] = None,
width: Optional[int] = None,
@@ -638,6 +639,7 @@ class Flux2ControlPipeline(DiffusionPipeline):
num_inference_steps: int = 50,
sigmas: Optional[List[float]] = None,
guidance_scale: Optional[float] = 4.0,
true_cfg_scale: Optional[float] = 1.0,
num_images_per_prompt: int = 1,
generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
latents: Optional[torch.Tensor] = None,
@@ -758,6 +760,9 @@ class Flux2ControlPipeline(DiffusionPipeline):
height = height or self.default_sample_size * self.vae_scale_factor
width = width or self.default_sample_size * self.vae_scale_factor
num_channels_latents = self.transformer.config.in_channels // 4
has_neg_prompt = negative_prompt is not None
do_true_cfg = true_cfg_scale > 1 and has_neg_prompt
# Prepare mask latent variables
if mask_image is not None:
@@ -813,6 +818,15 @@ class Flux2ControlPipeline(DiffusionPipeline):
max_sequence_length=max_sequence_length,
text_encoder_out_layers=text_encoder_out_layers,
)
if do_true_cfg:
negative_prompt_embeds, negative_text_ids = self.encode_prompt(
prompt=negative_prompt,
prompt_embeds=None,
device=device,
num_images_per_prompt=num_images_per_prompt,
max_sequence_length=max_sequence_length,
text_encoder_out_layers=text_encoder_out_layers,
)
# 4. process images
if image is not None and not isinstance(image, list):
@@ -933,9 +947,24 @@ class Flux2ControlPipeline(DiffusionPipeline):
control_context_scale=control_context_scale,
return_dict=False,
)[0]
noise_pred = noise_pred[:, : latents.size(1) :]
if do_true_cfg:
neg_noise_pred = self.transformer(
hidden_states=latent_model_input, # (B, image_seq_len, C)
timestep=timestep / 1000,
guidance=guidance,
encoder_hidden_states=negative_prompt_embeds,
txt_ids=negative_text_ids, # B, text_seq_len, 4
img_ids=latent_image_ids, # B, image_seq_len, 4
joint_attention_kwargs=self._attention_kwargs,
control_context=control_context_input,
control_context_scale=control_context_scale,
return_dict=False,
)[0]
neg_noise_pred = neg_noise_pred[:, : latents.size(1) :]
noise_pred = neg_noise_pred + true_cfg_scale * (noise_pred - neg_noise_pred)
# compute the previous noisy sample x_t -> x_t-1
latents_dtype = latents.dtype
latents = self.scheduler.step(noise_pred, t, latents, return_dict=False)[0]