从0到1,AI我来了- (7)AI应用-ComfyUI-II(进阶)

2024-09-09 07:20
文章标签 进阶 ai 应用 ii 我来 comfyui

本文主要是介绍从0到1,AI我来了- (7)AI应用-ComfyUI-II(进阶),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

        上篇comfyUI 入门 ,了解了TA是个啥,这篇,我们通过ComfyUI 及其相关Lora 模型,生成一些更惊艳的图片。这篇主要了解这些内容:

        1、哪里获取模型?

        2、实践如何画一个美女?

        3、附录:

              1)相关SD(稳定扩散模型的组成部分)
              2)模型放置目录(重要)

       

1、哪里获取comfyUI 所需模型?

        说几个常用的:

        地址1:https://huggingface.co/models

        地址2:https://www.liblib.art/

        地址3:Comfy Workflows images page

        地址4:https://civitai.com/

        

2、实践如何画一个美女?

        先看效果图:

        怎么实现的呢?请参考如下流程:

        从这里 下载 工作流:Bikini Girl v2

        整体流程:①先下载workflow JSON 文件=》②下载所需模型(如下图)=》③模型放置对于目录=》启动comfyUI

        ①工作流文件下载:下图左上角下载,也可下载我的 (如本文可下载文件)

        ② 模型下载相关模型:下图Models ,挨个下载   

        ③按要求放置模型到指定位置:可以参考我的(附录2)

        ④启动ComfyUI ,执行 Queue Prompt,等待即可

Note: 不加Naked ,对身体不好。

3、附录

1)相关SD(稳定扩散模型的组成部分) 解释

Components of a Stable Diffusion Model稳定扩散模型的组成部分

Stable Diffusion isn't just one large, single model. Instead, it's made up of various components and models that collaborate to generate images from text.Stable Diffusion

不仅仅是一个大型的单一模型。相反,它由各种组件和模型组成,这些组件和模型协同工作以从文本生成图像。

Model files are large .ckpt or .safetensors files obtained from repositories such as HuggingFace or CivitAI. These files contain the weights for three different models:模型文件很大.ckpt,或者.safetensors是从 HuggingFace 或 CivitAI 等存储库获取的文件。这些文件包含三种不同模型的权重:

  1. CLIP - a model to convert text prompt to a compressed format that the UNET model can understandCLIP - 将文本提示转换为 UNET 模型可以理解的压缩格式的模型
  2. MODEL - the main Stable Diffusion model, also known as UNET. Generates a compressed imageMODEL - 主要的 Stable Diffusion 模型,也称为 UNET。生成压缩图像
  3. VAE - Decodes the compressed image to a normal-looking imageVAE - 将压缩的图像解码为外观正常的图像

(UNET模型是一种用于图像分割的深度学习架构)

①CheckpointLoader 检查点加载器 

In the default ComfyUI workflow, the CheckpointLoader serves as a representation of the model files. It allows users to select a checkpoint to load and displays three different outputs: MODELCLIP, and VAE.在默认的 ComfyUI 工作流中,CheckpointLoader 用作模型文件的表示。它允许用户选择要加载的检查点,并显示三种不同的输出: MODEL 、 CLIP 和 VAE 。

CheckpointLoader

① CLIP Model CLIP 模型 

The CLIP model is connected to CLIPTextEncode nodes. CLIP, acting as a text encoder, converts text to a format understandable by the main MODEL.CLIP 模型连接到 CLIPTextEncode 节点。CLIP 充当文本编码器,将文本转换为主 MODEL 可以理解的格式。

CLIPTextEncode

②Stable Diffusion MODEL (aka UNET)2. 稳定扩散模型(又名 UNET)

In Stable Diffusion, image generation involves a sampler, represented by the sampler node in ComfyUI. The sampler takes the main Stable Diffusion MODEL, positive and negative prompts encoded by CLIP, and a Latent Image as inputs. The Latent Image is an empty image since we are generating an image from text (txt2img).在 Stable Diffusion 中,图像生成涉及一个采样器,由 ComfyUI 中的 sampler 节点表示。采样器采用主要的 Stable Diffusion MODEL、CLIP 编码的正负提示以及 Latent Image 作为输入。Latent Image 是一个空图像,因为我们是从文本 (txt2img) 生成图像。

Sampler

The sampler adds noise to the input latent image and denoises it using the main MODEL. Gradual denoising, guided by encoded prompts, is the process through which Stable Diffusion generates images.采样器将噪声添加到输入的潜在图像中,并使用主 MODEL 对其进行去噪。在编码提示的引导下,逐渐降噪是 Stable Diffusion 生成图像的过程。

③VAE Model VAE 模型 

The third model used in Stable Diffusion is the VAE, responsible for translating an image from latent space to pixel space. Latent space is the format understood by the main MODEL, while pixel space is the format recognizable by image viewers.稳定扩散 中使用的第三个模型是 VAE,负责将图像从潜在空间转换为像素空间。潜在空间是主 MODEL 可以理解的格式,而像素空间是图像查看器可识别的格式。

VAEDecode

The VAEDecode node takes the latent image from the sampler as input and outputs a regular image. This image is then saved to a PNG file using the SaveImage node.VAEDecode 节点将采样器中的潜在图像作为输入,并输出常规图像。然后,使用 SaveImage 节点将此图像保存为 PNG 文件。

2)

pwd
/opt/tech/git/ComfyUI/models
❯ tree ./
./
├── checkpoints
│   ├── juggernaut_reborn.safetensors
│   ├── put_checkpoints_here
│   └── v1-5-pruned-emaonly.ckpt
├── clip
│   └── put_clip_or_text_encoder_models_here
├── clip_vision
│   └── put_clip_vision_models_here
├── configs
│   ├── anything_v3.yaml
│   ├── v1-inference.yaml
│   ├── v1-inference_clip_skip_2.yaml
│   ├── v1-inference_clip_skip_2_fp16.yaml
│   ├── v1-inference_fp16.yaml
│   ├── v1-inpainting-inference.yaml
│   ├── v2-inference-v.yaml
│   ├── v2-inference-v_fp32.yaml
│   ├── v2-inference.yaml
│   ├── v2-inference_fp32.yaml
│   └── v2-inpainting-inference.yaml
├── controlnet
│   ├── control_v11f1e_sd15_tile.pth
│   ├── control_v11f1e_sd15_tile_fp16.safetensors
│   ├── controlnet11Models_openpose.safetensors
│   └── put_controlnets_and_t2i_here
├── diffusers
│   └── put_diffusers_models_here
├── diffusion_models
│   └── put_diffusion_model_files_here
├── embeddings
│   ├── JuggernautNegative-neg.pt
│   └── put_embeddings_or_textual_inversion_concepts_here
├── gligen
│   └── put_gligen_models_here
├── hypernetworks
│   └── put_hypernetworks_here
├── loras
│   ├── JuggerCineXL2.safetensors
│   ├── add-detail-xl.safetensors
│   ├── add_detail.safetensors
│   ├── juggernaut_reborn.safetensors
│   └── put_loras_here
├── mmdets
│   └── bbox
├── onnx
├── photomaker
│   └── put_photomaker_models_here
├── sams
│   └── sam_vit_b_01ec64.pth
├── style_models
│   └── put_t2i_style_model_here
├── ultralytics
│   ├── bbox
│   │   └── hand_yolov8s.pt
│   └── segm
├── unet
│   └── put_unet_files_here
├── upscale_models
│   ├── 4x_NMKD-Superscale-SP_178000_G.pth
│   └── put_esrgan_and_other_upscale_models_here
├── vae
│   └── put_vae_here
└── vae_approx└── put_taesd_encoder_pth_and_taesd_decoder_pth_here

     

这篇关于从0到1,AI我来了- (7)AI应用-ComfyUI-II(进阶)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1150518

相关文章

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

Spring AI集成DeepSeek的详细步骤

《SpringAI集成DeepSeek的详细步骤》DeepSeek作为一款卓越的国产AI模型,越来越多的公司考虑在自己的应用中集成,对于Java应用来说,我们可以借助SpringAI集成DeepSe... 目录DeepSeek 介绍Spring AI 是什么?1、环境准备2、构建项目2.1、pom依赖2.2

Deepseek R1模型本地化部署+API接口调用详细教程(释放AI生产力)

《DeepseekR1模型本地化部署+API接口调用详细教程(释放AI生产力)》本文介绍了本地部署DeepSeekR1模型和通过API调用将其集成到VSCode中的过程,作者详细步骤展示了如何下载和... 目录前言一、deepseek R1模型与chatGPT o1系列模型对比二、本地部署步骤1.安装oll

Spring AI Alibaba接入大模型时的依赖问题小结

《SpringAIAlibaba接入大模型时的依赖问题小结》文章介绍了如何在pom.xml文件中配置SpringAIAlibaba依赖,并提供了一个示例pom.xml文件,同时,建议将Maven仓... 目录(一)pom.XML文件:(二)application.yml配置文件(一)pom.xml文件:首

SpringBoot整合DeepSeek实现AI对话功能

《SpringBoot整合DeepSeek实现AI对话功能》本文介绍了如何在SpringBoot项目中整合DeepSeekAPI和本地私有化部署DeepSeekR1模型,通过SpringAI框架简化了... 目录Spring AI版本依赖整合DeepSeek API key整合本地化部署的DeepSeek

5分钟获取deepseek api并搭建简易问答应用

《5分钟获取deepseekapi并搭建简易问答应用》本文主要介绍了5分钟获取deepseekapi并搭建简易问答应用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需... 目录1、获取api2、获取base_url和chat_model3、配置模型参数方法一:终端中临时将加

JavaScript中的isTrusted属性及其应用场景详解

《JavaScript中的isTrusted属性及其应用场景详解》在现代Web开发中,JavaScript是构建交互式应用的核心语言,随着前端技术的不断发展,开发者需要处理越来越多的复杂场景,例如事件... 目录引言一、问题背景二、isTrusted 属性的来源与作用1. isTrusted 的定义2. 为

PyCharm接入DeepSeek实现AI编程的操作流程

《PyCharm接入DeepSeek实现AI编程的操作流程》DeepSeek是一家专注于人工智能技术研发的公司,致力于开发高性能、低成本的AI模型,接下来,我们把DeepSeek接入到PyCharm中... 目录引言效果演示创建API key在PyCharm中下载Continue插件配置Continue引言

Python调用另一个py文件并传递参数常见的方法及其应用场景

《Python调用另一个py文件并传递参数常见的方法及其应用场景》:本文主要介绍在Python中调用另一个py文件并传递参数的几种常见方法,包括使用import语句、exec函数、subproce... 目录前言1. 使用import语句1.1 基本用法1.2 导入特定函数1.3 处理文件路径2. 使用ex

Python进阶之Excel基本操作介绍

《Python进阶之Excel基本操作介绍》在现实中,很多工作都需要与数据打交道,Excel作为常用的数据处理工具,一直备受人们的青睐,本文主要为大家介绍了一些Python中Excel的基本操作,希望... 目录概述写入使用 xlwt使用 XlsxWriter读取修改概述在现实中,很多工作都需要与数据打交