NipGeihou's blog NipGeihou's blog
  • Java

    • 开发规范
    • 进阶笔记
    • 微服务
    • 快速开始
    • 设计模式
  • 其他

    • Golang
    • Python
    • Drat
  • Redis
  • MongoDB
  • 数据结构与算法
  • 计算机网络
  • 应用

    • Grafana
    • Prometheus
  • 容器与编排

    • KubeSphere
    • Kubernetes
    • Docker Compose
    • Docker
  • 组网

    • TailScale
    • WireGuard
  • 密码生成器
  • 英文单词生成器
🍳烹饪
🧑‍💻关于
  • 分类
  • 标签
  • 归档

NipGeihou

我见青山多妩媚,料青山见我应如是
  • Java

    • 开发规范
    • 进阶笔记
    • 微服务
    • 快速开始
    • 设计模式
  • 其他

    • Golang
    • Python
    • Drat
  • Redis
  • MongoDB
  • 数据结构与算法
  • 计算机网络
  • 应用

    • Grafana
    • Prometheus
  • 容器与编排

    • KubeSphere
    • Kubernetes
    • Docker Compose
    • Docker
  • 组网

    • TailScale
    • WireGuard
  • 密码生成器
  • 英文单词生成器
🍳烹饪
🧑‍💻关于
  • 分类
  • 标签
  • 归档
  • LLM

  • 分享

    • FLUX模型
      • 配置
      • 介绍模型
      • 硬件配置
      • 版本
      • 下载ComfyUI
      • 下载FULX模型
      • 浅用ComfyUI&FULX
      • 学习ComfyUI
      • 安装ComfyUI Manager
        • 安装插件
      • LoRA
      • 工作流社区
      • 图生图
  • AI
  • 分享
NipGeihou
2024-08-13
目录

FLUX模型

# 配置

# 介绍模型

Black Forest Labs - Frontier AI Lab (opens new window)

原 SD 作者团队发布,一句话背景很强。

# 硬件配置

CPU	Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
RAM	32G 2400MHz
GPU	NVIDIA GeForce RTX 2060 SUPER 8G

# 版本

FLUX.1 [pro] FLUX.1 [dev] FLUX.1 [schnell]
排名 1 2 3
本地允许 不支持 支持 支持
商用 需授权 需授权 Apache2.0

本文以 FLUX.1 [dev] 为例操作

# 下载 ComfyUI

Releases · comfyanonymous/ComfyUI (opens new window)

ComfyUI 是一个功能强大、高度模块化的 Stable Diffusion 图形用户界面和后端系统,它允许用户通过链接不同的节点来构建复杂的图像生成工作流程。这些节点可以包括各种任务,如加载检查点模型、输入提示、指定采样器等。已然成为超越 Automatic1111 Web UI 成为最主流的 UI 工具

  • 需要安装在性能主机中运行
  • 下载最新版 ComfyUI_windows_portable_nvidia.7z
  • 解压
  • 运行 run_nvidia_gpu.bat 启动服务
  • 成功运行后会打开 http://127.0.0.1:8188/

笔记

如果想要在外部访问,则需编辑 run_nvidia_gpu.bat 添加 --listen

# 下载 FULX 模型

参考:Flux Examples | ComfyUI_examples (opens new window)

  • 由于硬件限制,这里我下载的是 flux1-dev-fp8.safetensors

    • huggingface:flux1-dev-fp8.safetensors · Comfy-Org/flux1-dev at main (opens new window)
    • hf-mirror:Comfy-Org/flux1-dev · HF Mirror (opens new window)
  • 将下载好的 flux1-dev-fp8.safetensors 复制到 ComfyUI_windows_portable\ComfyUI\models\checkpoints

关于ComfyUI的models目录

  • checkpoints:大模型文件
  • controlnet:ControlNet 模型文件
  • embeddings:词嵌入(Embeddings)模型文件
  • loras:LoRA 模型文件
  • vae:VAE 模型文件

# 浅用 ComfyUI&FULX

参考:ComfyUI 全球爆红,AI 绘画进入 “工作流时代”?做最好懂的 Comfy UI 入门教程:Stable Diffusion 专业节点式界面新手教学_哔哩哔哩_bilibili (opens new window)

image-20240813162757754

  • 然后将 Flux Examples | ComfyUI_examples (opens new window) 中的上图,拖拽到 ComfyUI 的窗口即可得到一个工作流。
    • 无法拖拽的话,可以把图片保存到本地,再 load 加载
  • 点击 comfyui 右下方的 Queue Prompt 就会根据示例参数生成一张图片,实测耗时 8 分钟 【更新版本后 2 分钟不到】
  • 生成的图片会存放在 ComfyUI\output

img

# 学习 ComfyUI

在进行进一步的使用前,需要对 ComfyUI 的使用有更深入的了解。

  • 清空工作流:右下角的 Clear

  • 右键, Add Node - loaders - Load Checkpoint 添加一个 Checkpoint(大模型)节点 ,也就是示例的第一个节点。

    • ckpt_name:选择模型
    • 输出端口:
      • MODEL
      • CLIP:对比性语言 - 图像预训练
      • VAE
  • 右键, Add Node - conditioning - CLIP Text Encode(Prompt) 添加一个(正面) 提示词节点

    • 可以 Ctrl + C/V 在复制一个作为负面提示词
  • 右键, Add Node - latent - Empty Latent Image 添加一个 空白Latent图像 节点

    • width、height、batch_size(生成数量)
  • 右键, Add Node - sampling - KSampler 添加一个 K采样器节点 ;

入端口
  • model:模型加载器
  • positive:正向提示词
  • negative:反向提示词
  • latent_image:空白 Latent 图像
选项
  • seed(种子)
  • control_after_generate:
    • fixed:固定种子
    • increment:增加(生成后种子 + 1)
    • decrement:减少(生成后种子 - 1)
    • randomize:随机种子
  • steps(步数)
  • cfg(相关性)
  • sampler_name:采样方法
    • dpmpp_2m:常用
  • scheduler:调度器
    • karras:常用
  • denoise
  • 右键, Add Node - latent - VAE Decode 添加一个 VAE编码器节点 ,用来将 latent 向量转为图片
    • 入端口的 vae 可从 Checkpoint(大模型)节点 中获取
  • 右键, Add Node - image - Save Image 添加一个 保存图片节点

# 安装 ComfyUI Manager

ltdrdata/ComfyUI-Manager: ComfyUI-Manager is an extension designed to enhance the usability of ComfyUI. It offers management functions to install, remove, disable, and enable various custom nodes of ComfyUI. Furthermore, this extension provides a hub feature and convenience functions to access a wide range of information within ComfyUI. (opens new window)

ComfyUI-Manager 是一个旨在增强 ComfyUI 可用性的扩展。它提供了安装、删除、禁用和启用 ComfyUI 各种自定义节点的管理功能。

cd ComfyUI\custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# 重启ComfyUI
  • 成功安装后,ComfyUI 右下角出现 Manager 按钮
  • 点击 Update ComfyUI 可更新,下方 Restart

# 安装插件

以安装监控工具 Crystools 为例

  • Custom Nodes Manager
  • ,搜索 Crystools
  • install
  • 按提示 restart

# LoRA

LoRA,全称为 Low-Rank Adaptation,是一种用于微调大型预训练模型的技术,特别是在自然语言处理(NLP)领域。

笔记

可以理解是一个风格化的调整

  • 可在 Civitai Models | Discover Free Stable Diffusion Models (opens new window) 找到各种 LoRA
  • 但需要主要匹配对应的模型

image-20240813202325634

以本文使用的 Flux.1 Dev 为例

  • 还是以上面的示例工作流为例,将正向提示词替换为下面,得到下图
RAW photo, delicate, best quality, (intricate details:1.3), hyper detail, finely detailed, colorful, 1girl, solo, 8k uhd, film grain, (studio lighting:1.2), (Fujifilm XT3), (photorealistic:1.3), (detailed skin:1.2),1 girl,cute, solo,beautiful detailed sky,detailed cafe,dating,(nose blush),(smile:1.15),(closed mouth), middle breasts,beautiful detailed eyes, daylight, wet, rain, (short hair:1.2),floating hair NovaFrogStyle, full body,turtleneck,ribbed sweater,see-through,wet clothes

img

  • XLabs Flux Realism LoRA - Converted for Comfyui | Stable Diffusion LoRA | Civitai (opens new window),下载;这个 lora 能让生成的图片更加真实

  • 下载 flux_realism_lora.safetensors 到 ComfyUI\models\loras ;重启

image-20240813203516785

  • 右键, Add Node - loaders - Load LoRA 添加一个 LoRA节点 ;也可通过双击空白处,弹出框中搜索添加
  • 将 LoRA 节点添加在 Checkpoint 节点的后面,原 checkpoint 节点的出端口 model、clip 指向 lora 节点,再从 lora 节点指出原 checkpoint 出端口连接的节点

img

笔记

额,感觉还不如之前……

在调整

  • 将 ksampler node 调整 sampler_name: dpmpp_2m 、 scheduler: sgm_uniform

  • 提示词改为

analog photo, asian,kpop idol,delicate, best quality, (intricate details:1.3), hyper detail, finely detailed, colorful, 1girl, solo, 8k uhd, film grain, (studio lighting:1.2), (Fujifilm XT3), (photorealistic:1.3), (detailed skin:1.2),1 girl,cute, solo,beautiful detailed sky,detailed cafe,dating,(nose blush),(smile:1.15),(closed mouth), middle breasts,beautiful detailed eyes, daylight, wet, rain, (short hair:1.2),floating hair NovaFrogStyle, full body,turtleneck,ribbed sweater,see-through,wet clothes

img

# 工作流社区

  • ComfyUI Workflows - Developer Community (opens new window)

# 图生图

参考:

上次更新: 2024/08/25, 02:09:30
Prompt Engineering

← Prompt Engineering

最近更新
01
iSCSI服务搭建
05-10
02
磁盘管理与文件系统
05-02
03
网络测试 - iperf3
05-02
更多文章>
Theme by Vdoing | Copyright © 2018-2025 NipGeihou | 友情链接
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式