当前位置:AIGC资讯 > AIGC > 正文

stable-diffusion 3 体验部署流程(ComfyUI)

环境准备

下载及简介

git clone https://huggingface.co/stabilityai/stable-diffusion-3-medium
SD3 checkpoints:

sd3_medium_incl_clips.safetensors (5.5GB) sd3_medium_incl_clips_t5xxlfp8.safetensors (10.1GB) sd3_medium.safetensors (4.3GB)

前两个可以像 ComfyUI 中的任何常规checkpoints一样使用。这两个checkpoints之间的区别在于,第一个仅包含 2 个文本编码器:CLIP-L 和 CLIP-G,第二个包含 3 个:CLIP-L、CLIP-G 和 T5XXL。第三个模型不包含文本编码器,必须单独加载它们才能使用该文件。

模型保存

把如下三个模型放在 ComfyUI/models/checkpoints/ 目录中(可以选择其中一个模型体验)

sd3_medium_incl_clips.safetensors sd3_medium_incl_clips_t5xxlfp8.safetensors sd3_medium.safetensors
文本编码器保存

从text_encoders目录下载文本编码器,选择其中的一个文件保存到ComfyUI/models/clip/目录中:

clip_g.safetensors clip_l.safetensors t5xxl_fp8_e4m3fn.safetensors t5xxl_fp16.safetensors

ComfyUI 测试体验

打开comfyui 界面 导入脚本并执行:

{
  "last_node_id": 272,
  "last_link_id": 599,
  "nodes": [
    {
      "id": 11,
      "type": "TripleCLIPLoader",
      "pos": [
        -1885,
        -49
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 0,
      "mode": 0,
      "outputs": [
        {
          "name": "CLIP",
          "type": "CLIP",
          "links": [
            5,
            94
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "TripleCLIPLoader"
      },
      "widgets_values": [
        "clip_g.safetensors",
        "clip_l.safetensors",
        "t5xxl_fp8_e4m3fn.safetensors"
      ]
    },
    {
      "id": 71,
      "type": "CLIPTextEncode",
      "pos": [
        -1869.2871546875003,
        560.071803930664
      ],
      "size": {
        "0": 380.4615783691406,
        "1": 102.07693481445312
      },
      "flags": {},
      "order": 6,
      "mode": 0,
      "inputs": [
        {
          "name": "clip",
          "type": "CLIP",
          "link": 94
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            93,
            580
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "title": "CLIP Text Encode (Negative Prompt)",
      "properties": {
        "Node name for S&R": "CLIPTextEncode"
      },
      "widgets_values": [
        "bad quality, poor quality, doll, disfigured, jpg, toy, bad anatomy, missing limbs, missing fingers, 3d, cgi"
      ],
      "color": "#322",
      "bgcolor": "#533"
    },
    {
      "id": 68,
      "type": "ConditioningSetTimestepRange",
      "pos": [
        -1010,
        167
      ],
      "size": {
        "0": 317.4000244140625,
        "1": 82
      },
      "flags": {},
      "order": 10,
      "mode": 0,
      "inputs": [
        {
          "name": "conditioning",
          "type": "CONDITIONING",
          "link": 90
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            91
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ConditioningSetTimestepRange"
      },
      "widgets_values": [
        0.1,
        1
      ]
    },
    {
      "id": 70,
      "type": "ConditioningSetTimestepRange",
      "pos": [
        -1006,
        314
      ],
      "size": {
        "0": 317.4000244140625,
        "1": 82
      },
      "flags": {},
      "order": 8,
      "mode": 0,
      "inputs": [
        {
          "name": "conditioning",
          "type": "CONDITIONING",
          "link": 93,
          "slot_index": 0
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            92
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ConditioningSetTimestepRange"
      },
      "widgets_values": [
        0,
        0.1
      ]
    },
    {
      "id": 67,
      "type": "ConditioningZeroOut",
      "pos": [
        -1370,
        337
      ],
      "size": {
        "0": 211.60000610351562,
        "1": 26
      },
      "flags": {},
      "order": 9,
      "mode": 0,
      "inputs": [
        {
          "name": "conditioning",
          "type": "CONDITIONING",
          "link": 580
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            90
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ConditioningZeroOut"
      }
    },
    {
      "id": 266,
      "type": "Note",
      "pos": [
        -2352,
        576
      ],
      "size": {
        "0": 308.061279296875,
        "1": 102.86902618408203
      },
      "flags": {},
      "order": 1,
      "mode": 0,
      "properties": {
        "text": ""
      },
      "widgets_values": [
        "Resolution should be around 1 megapixel and width/height must be multiple of 64"
      ],
      "color": "#432",
      "bgcolor": "#653"
    },
    {
      "id": 13,
      "type": "ModelSamplingSD3",
      "pos": [
        -974,
        -220
      ],
      "size": {
        "0": 315,
        "1": 58
      },
      "flags": {
        "collapsed": false
      },
      "order": 7,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 565
        }
      ],
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "links": [
            591
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ModelSamplingSD3"
      },
      "widgets_values": [
        3
      ]
    },
    {
      "id": 69,
      "type": "ConditioningCombine",
      "pos": [
        -662,
        165
      ],
      "size": {
        "0": 228.39999389648438,
        "1": 46
      },
      "flags": {},
      "order": 11,
      "mode": 0,
      "inputs": [
        {
          "name": "conditioning_1",
          "type": "CONDITIONING",
          "link": 91
        },
        {
          "name": "conditioning_2",
          "type": "CONDITIONING",
          "link": 92
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            592
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "ConditioningCombine"
      }
    },
    {
      "id": 233,
      "type": "PreviewImage",
      "pos": [
        535.1143750722272,
        -147.92548481673106
      ],
      "size": {
        "0": 604.7489624023438,
        "1": 592.15576171875
      },
      "flags": {},
      "order": 14,
      "mode": 0,
      "inputs": [
        {
          "name": "images",
          "type": "IMAGE",
          "link": 599
        }
      ],
      "properties": {
        "Node name for S&R": "PreviewImage"
      }
    },
    {
      "id": 231,
      "type": "VAEDecode",
      "pos": [
        141,
        -177
      ],
      "size": {
        "0": 210,
        "1": 46
      },
      "flags": {},
      "order": 13,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 596
        },
        {
          "name": "vae",
          "type": "VAE",
          "link": 557
        }
      ],
      "outputs": [
        {
          "name": "IMAGE",
          "type": "IMAGE",
          "links": [
            599
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "VAEDecode"
      }
    },
    {
      "id": 252,
      "type": "CheckpointLoaderSimple",
      "pos": [
        -2314,
        -203
      ],
      "size": {
        "0": 746.7357788085938,
        "1": 98
      },
      "flags": {},
      "order": 2,
      "mode": 0,
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "links": [
            565
          ],
          "shape": 3,
          "slot_index": 0
        },
        {
          "name": "CLIP",
          "type": "CLIP",
          "links": [],
          "shape": 3,
          "slot_index": 1
        },
        {
          "name": "VAE",
          "type": "VAE",
          "links": [
            557
          ],
          "shape": 3,
          "slot_index": 2
        }
      ],
      "properties": {
        "Node name for S&R": "CheckpointLoaderSimple"
      },
      "widgets_values": [
        "sdv3/2b_1024/sd3_medium.safetensors"
      ]
    },
    {
      "id": 271,
      "type": "KSampler",
      "pos": [
        -269,
        -179
      ],
      "size": {
        "0": 315,
        "1": 446
      },
      "flags": {},
      "order": 12,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 591
        },
        {
          "name": "positive",
          "type": "CONDITIONING",
          "link": 595
        },
        {
          "name": "negative",
          "type": "CONDITIONING",
          "link": 592
        },
        {
          "name": "latent_image",
          "type": "LATENT",
          "link": 593
        },
        {
          "name": "seed",
          "type": "INT",
          "link": 597,
          "widget": {
            "name": "seed"
          },
          "slot_index": 4
        }
      ],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [
            596
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "KSampler"
      },
      "widgets_values": [
        945512652412924,
        "fixed",
        28,
        4.5,
        "dpmpp_2m",
        "sgm_uniform",
        1
      ]
    },
    {
      "id": 135,
      "type": "EmptySD3LatentImage",
      "pos": [
        -2352,
        438
      ],
      "size": {
        "0": 315,
        "1": 106
      },
      "flags": {},
      "order": 3,
      "mode": 0,
      "inputs": [],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [
            593
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "EmptySD3LatentImage"
      },
      "widgets_values": [
        1024,
        1024,
        1
      ]
    },
    {
      "id": 6,
      "type": "CLIPTextEncode",
      "pos": [
        -1876.2871546875003,
        284.0718039306641
      ],
      "size": {
        "0": 389.06927490234375,
        "1": 207.84902954101562
      },
      "flags": {},
      "order": 5,
      "mode": 0,
      "inputs": [
        {
          "name": "clip",
          "type": "CLIP",
          "link": 5
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "links": [
            595
          ],
          "shape": 3,
          "slot_index": 0
        }
      ],
      "properties": {
        "Node name for S&R": "CLIPTextEncode"
      },
      "widgets_values": [
        "a female character with long, flowing hair that appears to be made of ethereal, swirling patterns resembling the Northern Lights or Aurora Borealis. The background is dominated by deep blues and purples, creating a mysterious and dramatic atmosphere. The character's face is serene, with pale skin and striking features. She wears a dark-colored outfit with subtle patterns. The overall style of the artwork is reminiscent of fantasy or supernatural genres"
      ],
      "color": "#232",
      "bgcolor": "#353"
    },
    {
      "id": 272,
      "type": "PrimitiveNode",
      "pos": [
        -2342,
        278
      ],
      "size": {
        "0": 210,
        "1": 82
      },
      "flags": {},
      "order": 4,
      "mode": 0,
      "outputs": [
        {
          "name": "INT",
          "type": "INT",
          "links": [
            597
          ],
          "slot_index": 0,
          "widget": {
            "name": "seed"
          }
        }
      ],
      "title": "Seed",
      "properties": {
        "Run widget replace on values": false
      },
      "widgets_values": [
        945512652412924,
        "fixed"
      ]
    }
  ],
  "links": [
    [
      5,
      11,
      0,
      6,
      0,
      "CLIP"
    ],
    [
      90,
      67,
      0,
      68,
      0,
      "CONDITIONING"
    ],
    [
      91,
      68,
      0,
      69,
      0,
      "CONDITIONING"
    ],
    [
      92,
      70,
      0,
      69,
      1,
      "CONDITIONING"
    ],
    [
      93,
      71,
      0,
      70,
      0,
      "CONDITIONING"
    ],
    [
      94,
      11,
      0,
      71,
      0,
      "CLIP"
    ],
    [
      557,
      252,
      2,
      231,
      1,
      "VAE"
    ],
    [
      565,
      252,
      0,
      13,
      0,
      "MODEL"
    ],
    [
      580,
      71,
      0,
      67,
      0,
      "CONDITIONING"
    ],
    [
      591,
      13,
      0,
      271,
      0,
      "MODEL"
    ],
    [
      592,
      69,
      0,
      271,
      2,
      "CONDITIONING"
    ],
    [
      593,
      135,
      0,
      271,
      3,
      "LATENT"
    ],
    [
      595,
      6,
      0,
      271,
      1,
      "CONDITIONING"
    ],
    [
      596,
      271,
      0,
      231,
      0,
      "LATENT"
    ],
    [
      597,
      272,
      0,
      271,
      4,
      "INT"
    ],
    [
      599,
      231,
      0,
      233,
      0,
      "IMAGE"
    ]
  ],
  "groups": [
    {
      "title": "Load Models",
      "bounding": [
        -2410,
        -339,
        969,
        488
      ],
      "color": "#3f789e",
      "font_size": 24
    },
    {
      "title": "Input",
      "bounding": [
        -2409,
        181,
        972,
        523
      ],
      "color": "#3f789e",
      "font_size": 24
    },
    {
      "title": "Output",
      "bounding": [
        464,
        -273,
        741,
        814
      ],
      "color": "#3f789e",
      "font_size": 24
    }
  ],
  "config": {},
  "extra": {},
  "version": 0.4
}

测试结果展示





【Qinghub Studio 】更适合开发人员的低代码开源开发平台
【QingHub企业级应用统一部署】
【QingHub企业级应用开发管理】
【QingHub演示】
【https://qingplus.cn】

更新时间 2024-06-17