我正在使用扩散器修复管道调整 python 脚本以实现自定义视频生成想法。
我想逐渐改变提示中某些单词的权重。
据我所知,prompt_embeds 正是我所需要的。
我不知道如何定义这个论点。有人可以举个例子吗?
我知道有一些框架可以在其中使用以下语法为某些单词添加权重:
“这是一个 SD 提示,在最后一个(单词:1.5)上增加了 50% 的权重”
这也是一个很好的解决方案,但这不适用于扩散器。StableDiffusionInpaintPipeline
来自 Compel 库的原始回购示例:
from diffusers import StableDiffusionPipeline
from compel import Compel
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
compel = Compel(tokenizer=pipeline.tokenizer, text_encoder=pipeline.text_encoder)
# upweight "ball"
prompt = "a cat playing with a ball++ in the forest"
conditioning = compel.build_conditioning_tensor(prompt)
# or: conditioning = compel([prompt])
# generate image
images = pipeline(prompt_embeds=conditioning, num_inference_steps=20).images
images[0].save("image.jpg")
所以,如您所见,您应该添加
++
,或--
,或-----
等。
对于您的情况,它就像"This is a SD prompt with plus 50% weight added to the last word+++++"
。你也可以增加\减少子提示:A rich and descriptive (a subprompt goes here)++++ prompt
.