Showing posts with label stablediffusion. Show all posts
Showing posts with label stablediffusion. Show all posts

Friday, 16 May 2025

秒会 AI 绘图提示词技巧 - Master AI Art Prompts in Seconds (ComfyUI/StableDiffusion)

 

掌握提示词,玩转 ComfyUI/StableDiffusion,人人都是艺术家!- Grasp prompt words, conquer ComfyUI/StableDiffusion, and unleash your inner artist!

官网解释文档:
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features

谁说 AI 绘图很难?掌握几个关键技巧,你的提示词立马变强!下面这份"傻瓜式"指南让你秒变提示词高手!

1. 默认权重与提示词长度控制

  • 用法:每个提示词默认权重为1,总词数建议≤75(实际受CLIP模型76token限制)。

  • 好处:避免模型计算过载,提升生成效率。

  • 极值:最小权重0(无效词),理论最大权重无限制但实际需保持总和合理。

  • 计算示例(sunflower:1.5) 将权重提升50%,相当于 ((sunflower)) 嵌套一层小括号。


2. 括号权重控制

  • 小括号 ( )

    • 用法:每层增加10%权重,如 (word)=1.1,((word))=1.21。

    • 替代语法:(word:1.3) 直接指定权重为1.3,避免多层嵌套。

  • 中括号 [ ]

    • 用法:每层减少10%权重,如 [word]=0.9,[[word]]=0.81。

  • 大括号 { }

    • 用法:混合使用时可自定义权重叠加逻辑,但需手动计算。

  • 注意:仅小括号支持冒号语法直接指定权重值。

  • 示例:如果我们要生成一张包含 “red flower” 和 “blue sky” 的图片,并且希望 “red flower” 更加突出,可以写成 “(red flower:1.5) blue sky”,这样 “red flower” 在生成图像时会得到更多的关注。


3. LoRA模型调用

  • 用法<lora:模型文件名:强度乘数>,如 <lora:smiling:0.8>。(假设有一个名为 “smiling” 的 LoRA 文件,这样图像中微笑表情会被突出)

  • 好处:微调特定风格,兼容UNet和CLIP模型。

  • 极值:乘数建议0~1(可超1, 但极易失真)。

  • 要求:需将LoRA文件放入指定目录(通常为 models/Lora)。


4. 连接符(下划线)

  • 用法:用下划线连接词组,如 banana_bread

  • 好处:强制CLIP分词器将词组视为整体,避免歧义(如不连接可能拆分为"banana"和"bread")。

  • 替代方案:引号包裹词组 "banana bread" 也可达到类似效果。


5. Prompt Editing(分步控制)

  • 语法:(注意to 是一个:from是两个::

    • [a:0.8]:表示元素 “a” 在生成过程中只在 0.8(即 80%)的步骤之后起作用。比如说: [balls:0.8] on the ground 相比于 [balls:0.1] on the ground, 前一个提示词生成的球的数量就会比较少,因为它只在最后20%的时候起作用。

    • [a::0.7]:表示元素 “a” 在生成过程中前 0.7(即 70%)的步骤起作用,之后的30%的生成步骤不起作用。比如说: [balls::0.7] on the ground 相比于 [balls::0.1] on the ground, 前一个提示词生成的球的数量就会比较多,因为它在生成过程前70%的部分起作用。

    • [a:b:16]:表示在第 16 步时,将元素 “a” 替换为元素 “b”。比如说: [cat:dog:10] 表示前10步画猫,后10步改画狗。最后的结果,会融合猫狗的特点,生成新的图片。

  • 好处:精细控制不同生成阶段的画面变化。

  • 极值:步数需≤总生成步数(默认20,可以自定义)。


6. 交替词(动态切换)

  • 用法:使用 [word1|word2|word3] 这样的语法,可以让模型在每一步生成时从列表中选择一个词。这可以用来创造在不同概念之间平滑过渡或混合的效果,或者引入一些随机性和多样性。

  • 好处:每一步随机选择其中一个词,生成混合特征。

  • 示例:a painting in the style of [van gogh|monet|picasso]:生成的画作风格会在梵高、莫奈、毕加索之间交替。


7. 4GB显存支持

  • 启用方式:启动参数添加 --medvram--lowvram

  • 原理:牺牲生成速度,分批处理模型计算以减少显存占用。

  • 限制

    • 分辨率可能受限(如≤512x512)。

    • 部分功能(如高清修复)需关闭。

  • 兼容显卡:NVIDIA 4GB+(如GTX 1650、RTX 3050)。

示例:python main.py --lowvram,python main.py --medvram,也可以两个一起用。

Sunday, 27 October 2024

ComfyUI & Stable Diffusion: The Ultimate Resource Hack - 1 Minute to Sync Models and Nodes - ComfyUI & Stable Diffusion:资源黑客终极指南 - 1分钟同步模型和节点

Stop Wasting, Start Syncing! - 停止浪费,开始同步!

Fed up with the hassle of double-dipping into model installations? Dive into our 60-second hack to sync ComfyUI with your local Stable Diffusion WebUI, sparing you the agony of redundant setups. We'll show you how to effortlessly glide through model, node, CLIP, VAE, and Lora configurations, turning your dual UI woes into a thing of the past. Plus, for path-confused AI artists, we've got the config file right here, ready for a quick tweak and roll.

Ready to unleash the power of your AI art tools without the clutter? First, hunt down that hidden gem in your ComfyUI folder—the 'extra_model_paths.yaml.example' file. Change its file name to ‘extra_model_paths.yaml’, and boom, you're in the game. Fire up your favorite text editor, or if you're feeling commando, dive into the terminal (Mac/Linux) or command prompt (Windows). Tweaking this configuration file to harness the magic of Stable Diffusion WebUI models, nodes, CLIP, VAE, and Lora, all from the cozy confines of your ComfyUI. The specific configuration file can refer to the following example.
# Rename this to extra_model_paths.yaml and ComfyUI will load it


# config for a1111 ui

a111:

    base_path: /Users/your_username/stable-diffusion-webui/  # 指向Stable Diffusion WebUI的安装路径

    checkpoints: models/Stable-diffusion  # Stable Diffusion模型的路径

    configs: models/Stable-diffusion  # Stable Diffusion配置文件的路径

    vae: models/VAE  # VAE模型路径

    loras: |

         models/Lora  # Lora模型路径

         models/LyCORIS  # LyCORIS模型路径(如果有的话)

    upscale_models: |

         models/ESRGAN  # ESRGAN模型路径

         models/RealESRGAN  # RealESRGAN模型路径

         models/SwinIR  # SwinIR模型路径

    embeddings: embeddings  # 文本嵌入路径

    hypernetworks: models/hypernetworks  # 超网络模型路径

    controlnet: models/ControlNet  # ControlNet模型路径


# config for comfyui

comfyui:

    base_path: /Users/your_username/ComfyUI/  # ComfyUI的安装路径

    checkpoints: /Users/your_username/stable-diffusion-webui/models/Stable-diffusion  # 指向A1111安装目录下的Stable Diffusion模型

    clip: /Users/your_username/stable-diffusion-webui/models/clip/  # 指向A1111的CLIP模型路径

    clip_vision: /Users/your_username/stable-diffusion-webui/models/clip_vision/  # CLIP视觉模型路径

    configs: /Users/your_username/stable-diffusion-webui/models/configs/  # Stable Diffusion的配置文件路径

    controlnet: /Users/your_username/stable-diffusion-webui/models/ControlNet/  # 指向ControlNet模型的路径

    embeddings: /Users/your_username/stable-diffusion-webui/embeddings/  # 嵌入模型路径

    loras: /Users/your_username/stable-diffusion-webui/models/Lora/  # Lora模型路径

    upscale_models: /Users/your_username/stable-diffusion-webui/models/upscale_models/  # 指向超分辨率模型路径

    vae: /Users/your_username/stable-diffusion-webui/models/VAE/  # VAE模型路径


All paths must be absolute paths to where the actual files are located on your system. - 所有路径必须是你系统上实际文件所在的绝对路径。


Sunday, 20 October 2024

Level Up Your AI Art Game: A Beginner's Guide to ComfyUI Manager - ComfyUI Manager:小白也能轻松玩转AI绘画的秘密武器

Ditch the command line, embrace the visual! - 告别枯燥命令行,用可视化方式释放你的创造力



Are you dreaming of creating a one-of-a-kind AI artwork but feel overwhelmed by the hassle of installing plugins? Don’t worry—ComfyUI Manager is here to save the day! Think of it as your personal AI art assistant, taking care of all the boring stuff so you can focus on being creative.

Why do you need ComfyUI Manager?

No more download confusion: Still struggling with where to put your downloaded plugins? ComfyUI Manager organizes everything for you—hassle-free.

Say goodbye to waiting: It supports downloading multiple plugins at once, so no more tedious one-by-one downloads.

One-click updates: Plugin updates used to be a headache, but now it’s as simple as hitting a button. Stay up-to-date with ease!

How to use ComfyUI Manager:

1.Installation: Download ComfyUI Manager and place it in the ComfyUI/custom_nodes folder, then restart ComfyUI.

2.Launch: Find the Manager button in ComfyUI’s toolbar and click to open.

3.Install plugins:

Custom Nodes Manager: Install all sorts of custom nodes to expand ComfyUI’s functionality.

Model Manager: Install models and VAEs to enrich your creative toolbox.

Install via Git URL: Directly install plugins from GitHub—quick and easy.

      4. Batch install: When importing a new workflow, ComfyUI Manager automatically detects missing plugins and offers a one-click installation option.

5. One-click updates: Regularly click the “Update All” button to keep everything fresh and current.

Pro tips:

What’s a VAE? VAE stands for Variational Autoencoder, a neural network that generates new images (basically, a model for making art).

What’s a GitHub URL? GitHub is a code hosting platform where many ComfyUI plugins are stored.
By the way, if you install models or VAEs using ComfyUI Manager, you don’t need to restart ComfyUI. Just click the Refresh button in the main menu to use them.

In summary:

ComfyUI Manager is like the ultimate toolbox for your AI art journey, making everything smoother and more enjoyable. Whether you’re a newbie or a pro, you’ll find it incredibly helpful. So what are you waiting for? Give it a try now!