text stringlengths 0 5.54k |
|---|
eta (float, optional, defaults to 0.0) β |
Corresponds to parameter eta (Ξ·) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to |
schedulers.DDIMScheduler, will be ignored for others. |
generator (torch.Generator, optional) β |
One or a list of torch generator(s) |
to make generation deterministic. |
latents (torch.FloatTensor, optional) β |
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image |
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents |
tensor will ge generated by sampling using the supplied random generator. |
prompt_embeds (torch.FloatTensor, optional) β |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not |
provided, text embeddings will be generated from prompt input argument. |
negative_prompt_embeds (torch.FloatTensor, optional) β |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt |
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. |
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 safe... |
Function invoked when calling the pipeline for generation. |
Examples: |
Copied |
>>> import requests |
>>> from PIL import Image |
>>> from io import BytesIO |
>>> from diffusers import StableDiffusionUpscalePipeline |
>>> import torch |
>>> # load model and scheduler |
>>> model_id = "stabilityai/stable-diffusion-x4-upscaler" |
>>> pipeline = StableDiffusionUpscalePipeline.from_pretrained( |
... model_id, revision="fp16", torch_dtype=torch.float16 |
... ) |
>>> pipeline = pipeline.to("cuda") |
>>> # let's download an image |
>>> url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png" |
>>> response = requests.get(url) |
>>> low_res_img = Image.open(BytesIO(response.content)).convert("RGB") |
>>> low_res_img = low_res_img.resize((128, 128)) |
>>> prompt = "a white cat" |
>>> upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0] |
>>> upscaled_image.save("upsampled_cat.png") |
enable_attention_slicing |
< |
source |
> |
( |
slice_size: typing.Union[str, int, NoneType] = 'auto' |
) |
Parameters |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.