text
stringlengths
0
5.54k
weighting. If not provided, negative_prompt_embeds will be generated from negative_prompt input
argument.
output_type (str, optional, defaults to "pil") β€”
The output format of the generate image. Choose between
PIL: PIL.Image.Image or np.array.
return_dict (bool, optional, defaults to True) β€”
Whether or not to return a StableDiffusionPipelineOutput instead of a
plain tuple.
callback (Callable, optional) β€”
A function that will be called every callback_steps steps during inference. The function will be
called with the following arguments: callback(step: int, timestep: int, latents: torch.FloatTensor).
callback_steps (int, optional, defaults to 1) β€”
The frequency at which the callback function will be called. If not specified, the callback will be
called at every step.
cross_attention_kwargs (dict, optional) β€”
A kwargs dictionary that if specified is passed along to the AttnProcessor as defined under
self.processor in
diffusers.cross_attention.
Returns
StableDiffusionPipelineOutput or tuple
StableDiffusionPipelineOutput if return_dict is True, otherwise a tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of bools denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the safety_checker`.
Function invoked when calling the pipeline for generation.
Examples:
Copied
>>> import torch
>>> from diffusers import StableDiffusionPipeline
>>> pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
>>> pipe = pipe.to("cuda")
>>> prompt = "a photo of an astronaut riding a horse on mars"
>>> image = pipe(prompt).images[0]
enable_attention_slicing
<
source
>
(
slice_size: typing.Union[str, int, NoneType] = 'auto'
)
Parameters
slice_size (str or int, optional, defaults to "auto") β€”
When "auto", halves the input to the attention heads, so attention will be computed in two steps. If
"max", maxium amount of memory will be saved by running only one slice at a time. If a number is
provided, uses as many slices as attention_head_dim // slice_size. In this case, attention_head_dim
must be a multiple of slice_size.
Enable sliced attention computation.
When this option is enabled, the attention module will split the input tensor in slices, to compute attention
in several steps. This is useful to save some memory in exchange for a small speed decrease.
disable_attention_slicing
<
source
>
(
)
Disable sliced attention computation. If enable_attention_slicing was previously invoked, this method will go
back to computing attention in one step.
enable_vae_slicing
<
source
>
(
)