赞
踩
在云端部署或是本地简单调用Diffusers实现图像生成时,在huggingface diffusers官网,Github官网或是网上各种讲解均未有效给出在Pipeline中可添加的参数。在一行行调试代码的过程中,终于在diffusers源码中找到了对于pipeline中可输入参数的解释,如下:
str
or List[str]
, optional):prompt_embeds
.int
, optional, defaults to self.unet.config.sample_size * self.vae_scale_factor
):int
, optional, defaults to self.unet.config.sample_size * self.vae_scale_factor
):int
, optional, defaults to 50):float
, optional, defaults to 7.5):prompt
at the expense of lower image quality. Guidance scale is enabled when guidance_scale > 1
.str
or List[str]
, optional):negative_prompt_embeds
instead. Ignored when not using guidance (guidance_scale < 1
).int
, optional, defaults to 1):float
, optional, defaults to 0.0):~schedulers.DDIMScheduler
], and is ignored in other schedulers.torch.Generator
or List[torch.Generator]
, optional):torch.Generator
to maketorch.FloatTensor
, optional):generator
.torch.FloatTensor
, optional):prompt
input argument.torch.FloatTensor
, optional):negative_prompt_embeds
are generated from the negative_prompt
input argument.str
, optional, defaults to "pil"
):PIL.Image
or np.array
.bool
, optional, defaults to True
):~pipelines.stable_diffusion.StableDiffusionPipelineOutput
] instead of aCallable
, optional):callback_steps
steps during inference. The function is called with thecallback(step: int, timestep: int, latents: torch.FloatTensor)
.int
, optional, defaults to 1):callback
function is called. If not specified, the callback is called atdict
, optional):AttentionProcessor
] as defined inself.processor
.float
, optional, defaults to 0.7):在这其中,我们主要用的比较多的是:
其他的属性就不太常用到了
pipeline文件在:diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py 546行左右
实例:
from diffusers import StableDiffusionPipeline
import torc
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id)
pipe.to("cuda")
image = pipe("An image of a squirrel in Picasso style",height=768,width=768,guidance_scale=7).images[0]
image.save("squirrel.png")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。