ComfyUI - 使用 ComfyUI 部署与测试 FLUX.1 图像生成模型 教程

欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/141201307

免责声明:本文来源于个人知识与公开资料,仅用于学术交流,欢迎讨论,不支持转载。


FLUX.1 是由 Black Forest Labs 推出的文本到图像生成模型,已成为 AI 绘画领域的高品质模型。该模型由 Stability AI 的前核心成员开发,具备强大的生成能力和高质量的图像输出。目前,Flux 的相关模型:

  • Flux & AE 模型:https://huggingface.co/black-forest-labs/FLUX.1-dev
  • CLIP 模型:https://huggingface.co/stabilityai/stable-diffusion-3-medium

FP8 模型地址:https://huggingface.co/Kijai/flux-fp8/tree/main

安装 HuggingFace 下载工具,使用镜像下载速度明显加快:

export HF_ENDPOINT="https://hf-mirror.com"
pip install -U huggingface_hub hf-transfer

下载 HuggingFace 脚本,如下:

huggingface-cli download --token [your toekn] black-forest-labs/FLUX.1-dev --local-dir FLUX.1-dev --include "flux1-dev.safetensors" 
huggingface-cli download --token [your toekn] black-forest-labs/FLUX.1-dev --local-dir FLUX.1-dev --include "ae.safetensors"
huggingface-cli download --token [your toekn] stabilityai/stable-diffusion-3-medium --local-dir stable-diffusion-3-medium 

下载之前需要申请权限,Token 地址来源于:https://huggingface.co/settings/tokens,全部勾选即可生成。

其中,完全版是 FP16 的版本 flux1-dev.safetensors,大约 23G,即:

FLUX.1-dev/flux1-dev.safetensors 
bypy upload flux1-dev.safetensors /stable_diffusion/flux_data/flux1-dev.safetensors

AE 模型:

FLUX.1-dev/ae.safetensors

CLIP 是两个模型:

stable-diffusion-3-medium/text_encoders/clip_l.safetensors
stable-diffusion-3-medium/text_encoders/t5xxl_fp16.safetensors

将 Flux 的相关模型,放入相应的位置:

ComfyUI/models/unet/flux1-dev.safetensors
ComfyUI/models/vae/ae.safetensors
ComfyUI/models/clip/clip_l.safetensors
ComfyUI/models/clip/t5xxl_fp16.safetensors

搭建 Flux 流程:

Pipeline

相关提示词:

A queen sits on a throne, looking at the camera with arrogance, legs crossed, wearing high heels and white stockings.
The palace is bright, highlighting the queen’s majesty.
Low POV (Point of View), tilted shot from below.

Image

A Chinese queen sits on a very high throne in bright palace, looking at the camera, legs crossed, wearing golden high heels and black stockings.
very low POV, tilted shot from below.

Image

A woman empress of China sits on a very high throne in the bright palace. She is looking at the camera, legs crossed, wearing golden high heels and black stockings.
very low POV, tilted shot from very below.
very high quality.

Image
原图:
Image
重绘图像:
Image
ComfyUI Pipeline Json

{
  "last_node_id": 66,
  "last_link_id": 110,
  "nodes": [
    {
      "id": 8,
      "type": "UNETLoader",
      "pos": [
        -372,
        -138
      ],
      "size": {
        "0": 315,
        "1": 82
      },
      "flags": {},
      "order": 0,
      "mode": 0,
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "links": [
            73
          ],
          "shape": 3,
          "label": "模型",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "UNETLoader"
      },
      "widgets_values": [
        "flux1-dev.safetensors",
        "default"
      ]
    },
    {
      "id": 9,
      "type": "DualCLIPLoader",
      "pos": [
        -372,
        164
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 1,
      "mode": 0,
      "outputs": [
        {
          "name": "CLIP",
          "type": "CLIP",
          "links": [
            81
          ],
          "shape": 3,
          "label": "CLIP",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "DualCLIPLoader"
      },
      "widgets_values": [
        "t5xxl_fp16.safetensors",
        "clip_l.safetensors",
        "flux"
      ]
    },
    {
      "id": 12,
      "type": "CLIPTextEncodeFlux",
      "pos": [
        5,
        165
      ],
      "size": {
        "0": 246.04954528808594,
        "1": 111.51980590820312
      },
      "flags": {},
      "order": 11,
      "mode": 0,
      "inputs": [
        {
          "name": "clip",
          "type": "CLIP",
          "link": 81,
          "label": "CLIP"
        },
        {
          "name": "clip_l",
          "type": "STRING",
          "link": 34,
          "widget": {
            "name": "clip_l"
          },
          "label": "CLIP_L",
          "slot_index": 1
        },
        {
          "name": "t5xxl",
          "type": "STRING",
          "link": 35,
          "widget": {
            "name": "t5xxl"
          },
          "label": "T5XXL"
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            14
          ],
          "shape": 3,
          "label": "条件",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "CLIPTextEncodeFlux"
      },
      "widgets_values": [
        "A queen sits on a throne, looking at the camera with arrogance, legs crossed, wearing high heels and black stockings.\nLow POV, tilted shot from below.\nThe palace is bathed in natural light.",
        "A queen sits on a throne, looking at the camera with arrogance, legs crossed, wearing high heels and black stockings.\nLow POV, tilted shot from below.\nThe palace is bathed in natural light.",
        3.5,
        true,
        true
      ]
    },
    {
      "id": 15,
      "type": "LatentFromBatch",
      "pos": [
        317,
        135
      ],
      "size": {
        "0": 315,
        "1": 82
      },
      "flags": {},
      "order": 9,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 13,
          "label": "Latent"
        }
      ],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [
            18
          ],
          "shape": 3,
          "label": "Latent",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "LatentFromBatch"
      },
      "widgets_values": [
        0,
        1
      ]
    },
    {
      "id": 5,
      "type": "EmptyLatentImage",
      "pos": [
        -372,
        -291
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 2,
      "mode": 0,
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [
            13
          ],
          "shape": 3,
          "label": "Latent",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "EmptyLatentImage"
      },
      "widgets_values": [
        1280,
        800,
        1
      ]
    },
    {
      "id": 16,
      "type": "BasicScheduler",
      "pos": [
        317,
        279
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 12,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 79,
          "label": "模型"
        }
      ],
      "outputs": [
        {
          "name": "SIGMAS",
          "type": "SIGMAS",
          "links": [
            20
          ],
          "shape": 3,
          "label": "Sigmas",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "BasicScheduler"
      },
      "widgets_values": [
        "normal",
        25,
        1
      ]
    },
    {
      "id": 11,
      "type": "ModelSamplingFlux",
      "pos": [
        -372,
        -10
      ],
      "size": {
        "0": 315,
        "1": 130
      },
      "flags": {},
      "order": 8,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 73,
          "label": "模型"
        }
      ],
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "links": [
            78,
            79,
            99
          ],
          "shape": 3,
          "label": "模型",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ModelSamplingFlux"
      },
      "widgets_values": [
        1.15,
        0.5,
        1024,
        1024
      ]
    },
    {
      "id": 61,
      "type": "Reroute",
      "pos": [
        997,
        -64
      ],
      "size": [
        75,
        26
      ],
      "flags": {},
      "order": 13,
      "mode": 0,
      "inputs": [
        {
          "name": "",
          "type": "*",
          "link": 99
        }
      ],
      "outputs": [
        {
          "name": "",
          "type": "MODEL",
          "links": [
            100
          ],
          "slot_index": 0
        }
      ],
      "properties": {
        "showOutputText": false,
        "horizontal": false
      }
    },
    {
      "id": 17,
      "type": "BasicGuider",
      "pos": [
        317,
        -58
      ],
      "size": {
        "0": 241.79998779296875,
        "1": 46
      },
      "flags": {},
      "order": 14,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 78,
          "label": "模型"
        },
        {
          "name": "conditioning",
          "type": "CONDITIONING",
          "link": 14,
          "label": "条件"
        }
      ],
      "outputs": [
        {
          "name": "GUIDER",
          "type": "GUIDER",
          "links": [
            17,
            101
          ],
          "shape": 3,
          "label": "引导",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "BasicGuider"
      }
    },
    {
      "id": 14,
      "type": "KSamplerSelect",
      "pos": [
        317,
        29
      ],
      "size": {
        "0": 315,
        "1": 58
      },
      "flags": {},
      "order": 3,
      "mode": 0,
      "outputs": [
        {
          "name": "SAMPLER",
          "type": "SAMPLER",
          "links": [
            19,
            103
          ],
          "shape": 3,
          "label": "采样器",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "KSamplerSelect"
      },
      "widgets_values": [
        "euler"
      ]
    },
    {
      "id": 19,
      "type": "VAEDecode",
      "pos": [
        717,
        -64
      ],
      "size": {
        "0": 210,
        "1": 46
      },
      "flags": {
        "collapsed": false
      },
      "order": 17,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 93,
          "label": "Latent"
        },
        {
          "name": "vae",
          "type": "VAE",
          "link": 22,
          "label": "VAE"
        }
      ],
      "outputs": [
        {
          "name": "IMAGE",
          "type": "IMAGE",
          "links": [
            89
          ],
          "shape": 3,
          "label": "图像",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "VAEDecode"
      }
    },
    {
      "id": 10,
      "type": "VAELoader",
      "pos": [
        -372,
        321
      ],
      "size": {
        "0": 315,
        "1": 58
      },
      "flags": {},
      "order": 4,
      "mode": 0,
      "outputs": [
        {
          "name": "VAE",
          "type": "VAE",
          "links": [
            22,
            104
          ],
          "shape": 3,
          "slot_index": 0,
          "label": "VAE"
        }
      ],
      "properties": {
        "Node name for S&R": "VAELoader"
      },
      "widgets_values": [
        "flux_ae.safetensors"
      ]
    },
    {
      "id": 63,
      "type": "Reroute",
      "pos": [
        999,
        -33
      ],
      "size": [
        75,
        26
      ],
      "flags": {},
      "order": 10,
      "mode": 0,
      "inputs": [
        {
          "name": "",
          "type": "*",
          "link": 104
        }
      ],
      "outputs": [
        {
          "name": "",
          "type": "VAE",
          "links": [
            105
          ],
          "slot_index": 0
        }
      ],
      "properties": {
        "showOutputText": false,
        "horizontal": false
      }
    },
    {
      "id": 62,
      "type": "VAEDecode",
      "pos": [
        1135,
        92
      ],
      "size": {
        "0": 210,
        "1": 46
      },
      "flags": {
        "collapsed": false
      },
      "order": 21,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 106,
          "label": "Latent"
        },
        {
          "name": "vae",
          "type": "VAE",
          "link": 105,
          "label": "VAE"
        }
      ],
      "outputs": [
        {
          "name": "IMAGE",
          "type": "IMAGE",
          "links": [
            107
          ],
          "shape": 3,
          "label": "图像",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "VAEDecode"
      }
    },
    {
      "id": 66,
      "type": "RandomNoise",
      "pos": [
        1458,
        -350
      ],
      "size": {
        "0": 315,
        "1": 82
      },
      "flags": {},
      "order": 5,
      "mode": 0,
      "outputs": [
        {
          "name": "NOISE",
          "type": "NOISE",
          "links": [
            110
          ],
          "shape": 3,
          "label": "噪波生成",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "RandomNoise"
      },
      "widgets_values": [
        858548031216041,
        "randomize"
      ]
    },
    {
      "id": 18,
      "type": "SamplerCustomAdvanced",
      "pos": [
        713,
        -219
      ],
      "size": {
        "0": 355.20001220703125,
        "1": 106
      },
      "flags": {},
      "order": 16,
      "mode": 0,
      "inputs": [
        {
          "name": "noise",
          "type": "NOISE",
          "link": 16,
          "label": "噪波生成"
        },
        {
          "name": "guider",
          "type": "GUIDER",
          "link": 17,
          "label": "引导"
        },
        {
          "name": "sampler",
          "type": "SAMPLER",
          "link": 19,
          "label": "采样器"
        },
        {
          "name": "sigmas",
          "type": "SIGMAS",
          "link": 20,
          "label": "Sigmas"
        },
        {
          "name": "latent_image",
          "type": "LATENT",
          "link": 18,
          "label": "Latent"
        }
      ],
      "outputs": [
        {
          "name": "output",
          "type": "LATENT",
          "links": [
            93,
            108
          ],
          "shape": 3,
          "label": "输出",
          "slot_index": 0
        },
        {
          "name": "denoised_output",
          "type": "LATENT",
          "links": [],
          "shape": 3,
          "label": "降噪输出",
          "slot_index": 1
        }
      ],
      "properties": {
        "Node name for S&R": "SamplerCustomAdvanced"
      },
      "color": "#322",
      "bgcolor": "#533"
    },
    {
      "id": 13,
      "type": "RandomNoise",
      "pos": [
        317,
        -186
      ],
      "size": {
        "0": 315,
        "1": 82
      },
      "flags": {},
      "order": 6,
      "mode": 0,
      "outputs": [
        {
          "name": "NOISE",
          "type": "NOISE",
          "links": [
            16
          ],
          "shape": 3,
          "label": "噪波生成",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "RandomNoise"
      },
      "widgets_values": [
        3,
        "fixed"
      ]
    },
    {
      "id": 37,
      "type": "StringFunction|pysssss",
      "pos": [
        -373,
        442
      ],
      "size": {
        "0": 403.92303466796875,
        "1": 274
      },
      "flags": {},
      "order": 7,
      "mode": 0,
      "outputs": [
        {
          "name": "STRING",
          "type": "STRING",
          "links": [
            34,
            35
          ],
          "shape": 3,
          "label": "字符串",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "StringFunction|pysssss"
      },
      "widgets_values": [
        "append",
        "yes",
        "A woman empress of China sits on a very high throne in the bright palace. She is looking at the camera, legs crossed, wearing golden high heels and black stockings.\n",
        "very low POV, tilted shot from very below.\nvery high quality.",
        "",
        "A woman empress of China sits on a very high throne in the bright palace. She is looking at the camera, legs crossed, wearing golden high heels and black stockings.\n, very low POV, tilted shot from very below.\nvery high quality."
      ]
    },
    {
      "id": 65,
      "type": "LatentUpscaleBy",
      "pos": [
        1127,
        -350
      ],
      "size": {
        "0": 315,
        "1": 82
      },
      "flags": {},
      "order": 18,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 108,
          "label": "Latent"
        }
      ],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [
            109
          ],
          "shape": 3,
          "label": "Latent",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "LatentUpscaleBy"
      },
      "widgets_values": [
        "nearest-exact",
        1.5
      ]
    },
    {
      "id": 59,
      "type": "SamplerCustomAdvanced",
      "pos": [
        1126,
        -219
      ],
      "size": {
        "0": 355.20001220703125,
        "1": 106
      },
      "flags": {},
      "order": 20,
      "mode": 0,
      "inputs": [
        {
          "name": "noise",
          "type": "NOISE",
          "link": 110,
          "label": "噪波生成"
        },
        {
          "name": "guider",
          "type": "GUIDER",
          "link": 101,
          "label": "引导"
        },
        {
          "name": "sampler",
          "type": "SAMPLER",
          "link": 103,
          "label": "采样器"
        },
        {
          "name": "sigmas",
          "type": "SIGMAS",
          "link": 98,
          "label": "Sigmas"
        },
        {
          "name": "latent_image",
          "type": "LATENT",
          "link": 109,
          "label": "Latent"
        }
      ],
      "outputs": [
        {
          "name": "output",
          "type": "LATENT",
          "links": [
            106
          ],
          "shape": 3,
          "label": "输出",
          "slot_index": 0
        },
        {
          "name": "denoised_output",
          "type": "LATENT",
          "links": [],
          "shape": 3,
          "label": "降噪输出",
          "slot_index": 1
        }
      ],
      "properties": {
        "Node name for S&R": "SamplerCustomAdvanced"
      },
      "color": "#322",
      "bgcolor": "#533"
    },
    {
      "id": 60,
      "type": "BasicScheduler",
      "pos": [
        1130,
        -63
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 15,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 100,
          "label": "模型",
          "slot_index": 0
        }
      ],
      "outputs": [
        {
          "name": "SIGMAS",
          "type": "SIGMAS",
          "links": [
            98
          ],
          "shape": 3,
          "label": "Sigmas",
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "BasicScheduler"
      },
      "widgets_values": [
        "normal",
        20,
        0.5
      ]
    },
    {
      "id": 7,
      "type": "PreviewImage",
      "pos": [
        716,
        30
      ],
      "size": {
        "0": 359.57421875,
        "1": 249.54296875
      },
      "flags": {},
      "order": 19,
      "mode": 0,
      "inputs": [
        {
          "name": "images",
          "type": "IMAGE",
          "link": 89,
          "label": "图像"
        }
      ],
      "properties": {
        "Node name for S&R": "PreviewImage"
      }
    },
    {
      "id": 64,
      "type": "PreviewImage",
      "pos": [
        1137,
        190
      ],
      "size": {
        "0": 359.57421875,
        "1": 249.54296875
      },
      "flags": {},
      "order": 22,
      "mode": 0,
      "inputs": [
        {
          "name": "images",
          "type": "IMAGE",
          "link": 107,
          "label": "图像"
        }
      ],
      "properties": {
        "Node name for S&R": "PreviewImage"
      }
    }
  ],
  "links": [
    [
      13,
      5,
      0,
      15,
      0,
      "LATENT"
    ],
    [
      14,
      12,
      0,
      17,
      1,
      "CONDITIONING"
    ],
    [
      16,
      13,
      0,
      18,
      0,
      "NOISE"
    ],
    [
      17,
      17,
      0,
      18,
      1,
      "GUIDER"
    ],
    [
      18,
      15,
      0,
      18,
      4,
      "LATENT"
    ],
    [
      19,
      14,
      0,
      18,
      2,
      "SAMPLER"
    ],
    [
      20,
      16,
      0,
      18,
      3,
      "SIGMAS"
    ],
    [
      22,
      10,
      0,
      19,
      1,
      "VAE"
    ],
    [
      34,
      37,
      0,
      12,
      1,
      "STRING"
    ],
    [
      35,
      37,
      0,
      12,
      2,
      "STRING"
    ],
    [
      73,
      8,
      0,
      11,
      0,
      "MODEL"
    ],
    [
      78,
      11,
      0,
      17,
      0,
      "MODEL"
    ],
    [
      79,
      11,
      0,
      16,
      0,
      "MODEL"
    ],
    [
      81,
      9,
      0,
      12,
      0,
      "CLIP"
    ],
    [
      89,
      19,
      0,
      7,
      0,
      "IMAGE"
    ],
    [
      93,
      18,
      0,
      19,
      0,
      "LATENT"
    ],
    [
      98,
      60,
      0,
      59,
      3,
      "SIGMAS"
    ],
    [
      99,
      11,
      0,
      61,
      0,
      "*"
    ],
    [
      100,
      61,
      0,
      60,
      0,
      "MODEL"
    ],
    [
      101,
      17,
      0,
      59,
      1,
      "GUIDER"
    ],
    [
      103,
      14,
      0,
      59,
      2,
      "SAMPLER"
    ],
    [
      104,
      10,
      0,
      63,
      0,
      "*"
    ],
    [
      105,
      63,
      0,
      62,
      1,
      "VAE"
    ],
    [
      106,
      59,
      0,
      62,
      0,
      "LATENT"
    ],
    [
      107,
      62,
      0,
      64,
      0,
      "IMAGE"
    ],
    [
      108,
      18,
      0,
      65,
      0,
      "LATENT"
    ],
    [
      109,
      65,
      0,
      59,
      4,
      "LATENT"
    ],
    [
      110,
      66,
      0,
      59,
      0,
      "NOISE"
    ]
  ],
  "groups": [],
  "config": {},
  "extra": {
    "ds": {
      "scale": 1.4864362802414455,
      "offset": [
        -818.3005016409714,
        -63.35849743821387
      ]
    }
  },
  "version": 0.4
}
  • 13
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CarolineSpike

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值