(beautiful girl:1.2), (long silver hair, blue eyes), (wearing elegant white dress), (in a magical forest at sunset), (soft lighting, glowing fireflies), (studio quality, highly detailed, digital painting, artstation trending)
这种分层结构让模型更容易理解你的意图,减少歧义。
负面提示词同样重要,它能帮我们过滤掉不想要的内容。但要注意:
不要过度使用负面词,会影响生成质量
针对具体问题添加特定负面词
常见负面词可以保存为预设
我的常用负面提示词模板:
low quality, blurry, distorted anatomy, extra limbs, mutated hands, poorly drawn face
通过()和[]可以调整关键词的权重:
(word:1.2) - 增加20%权重
[word:0.8] - 减少20%权重
嵌套使用可以更精细控制,如((word))相当于(word:1.1)
示例:
A (beautiful:1.3) landscape with [mountains:0.9] and ((lush green forests))
下面是一个使用Python调用Stable Diffusion的示例,展示如何组合提示词:
from diffusers import StableDiffusionPipeline import torch # 初始化模型 pipe = StableDiffusionPipeline.from_pretrained( "runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16 ).to("cuda") # 定义分层提示词 subject = "(portrait of a beautiful woman:1.2), (long wavy hair, green eyes)" environment = "(in a futuristic city at night), (neon lights, rain)" # 组合提示词 prompt = f"{subject}, {environment}, {style}" negative_prompt = "blurry, low quality, deformed, extra limbs" # 生成图像 image = pipe( prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=30, guidance_scale=7.5 ).images[0] image.save("cyberpunk_portrait.png")
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/252774.html