text
stringlengths
0
5.54k
The canonincal unCLIP prior to approximate the image embedding from the text embedding. prior_image_encoder (CLIPVisionModelWithProjection) β€”
Frozen image-encoder. prior_text_encoder (CLIPTextModelWithProjection) β€”
Frozen text-encoder. prior_tokenizer (CLIPTokenizer) β€”
Tokenizer of class
CLIPTokenizer. prior_scheduler (UnCLIPScheduler) β€”
A scheduler to be used in combination with prior to generate image embedding. prior_image_processor (CLIPImageProcessor) β€”
A image_processor to be used to preprocess image from clip. Combined Pipeline for text-to-image generation using Kandinsky This model inherits from DiffusionPipeline. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) __call__ < source > ( prompt: Union negative_prompt: Union = None num_inference_steps: int = 100 guidance_scale: float = 4.0 num_images_per_prompt: int = 1 height: int = 512 width: int = 512 prior_guidance_scale: float = 4.0 prior_num_inference_steps: int = 25 generator: Union = None latents: Optional = None output_type: Optional = 'pil' callback: Optional = None callback_steps: int = 1 return_dict: bool = True prior_callback_on_step_end: Optional = None prior_callback_on_step_end_tensor_inputs: List = ['latents'] callback_on_step_end: Optional = None callback_on_step_end_tensor_inputs: List = ['latents'] ) β†’ ImagePipelineOutput or tuple Parameters prompt (str or List[str]) β€”
The prompt or prompts to guide the image generation. negative_prompt (str or List[str], optional) β€”
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if guidance_scale is less than 1). num_images_per_prompt (int, optional, defaults to 1) β€”
The number of images to generate per prompt. num_inference_steps (int, optional, defaults to 100) β€”
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference. height (int, optional, defaults to 512) β€”
The height in pixels of the generated image. width (int, optional, defaults to 512) β€”
The width in pixels of the generated image. prior_guidance_scale (float, optional, defaults to 4.0) β€”
Guidance scale as defined in Classifier-Free Diffusion Guidance.
guidance_scale is defined as w of equation 2. of Imagen
Paper. Guidance scale is enabled by setting guidance_scale > 1. Higher guidance scale encourages to generate images that are closely linked to the text prompt,
usually at the expense of lower image quality. prior_num_inference_steps (int, optional, defaults to 100) β€”
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference. guidance_scale (float, optional, defaults to 4.0) β€”
Guidance scale as defined in Classifier-Free Diffusion Guidance.
guidance_scale is defined as w of equation 2. of Imagen
Paper. Guidance scale is enabled by setting guidance_scale > 1. Higher guidance scale encourages to generate images that are closely linked to the text prompt,
usually at the expense of lower image quality. generator (torch.Generator or List[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. output_type (str, optional, defaults to "pil") β€”
The output format of the generate image. Choose between: "pil" (PIL.Image.Image), "np"
(np.array) or "pt" (torch.Tensor). return_dict (bool, optional, defaults to True) β€”
Whether or not to return a ImagePipelineOutput instead of a plain tuple. prior_callback_on_step_end (Callable, optional) β€”
A function that calls at the end of each denoising steps during the inference of the prior pipeline.
The function is called with the following arguments: prior_callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict). prior_callback_on_step_end_tensor_inputs (List, optional) β€”
The list of tensor inputs for the prior_callback_on_step_end function. The tensors specified in the
list will be passed as callback_kwargs argument. You will only be able to include variables listed in
the ._callback_tensor_inputs attribute of your prior pipeline class. callback_on_step_end (Callable, optional) β€”
A function that calls at the end of each denoising steps during the inference of the decoder pipeline.
The function is called with the following arguments: callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict). callback_kwargs will include a list of all tensors
as specified by callback_on_step_end_tensor_inputs. callback_on_step_end_tensor_inputs (List, optional) β€”
The list of tensor inputs for the callback_on_step_end function. The tensors specified in the list
will be passed as callback_kwargs argument. You will only be able to include variables listed in the
._callback_tensor_inputs attribute of your pipeline class. Returns
ImagePipelineOutput or tuple
Function invoked when calling the pipeline for generation. Examples: Copied from diffusers import AutoPipelineForText2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained(
"kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload()
prompt = "A lion in galaxies, spirals, nebulae, stars, smoke, iridescent, intricate detail, octane render, 8k"
image = pipe(prompt=prompt, num_inference_steps=25).images[0] enable_sequential_cpu_offload < source > ( gpu_id = 0 ) Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
torch.device('meta') and loaded to GPU only when their specific submodule has its forwardmethod called. Note that offloading happens on a submodule basis. Memory savings are higher than withenable_model_cpu_offload`, but performance is lower. KandinskyV22ControlnetPipeline class diffusers.KandinskyV22ControlnetPipeline < source > ( unet: UNet2DConditionModel scheduler: DDPMScheduler movq: VQModel ) Parameters scheduler (DDIMScheduler) β€”
A scheduler to be used in combination with unet to generate image latents. unet (UNet2DConditionModel) β€”
Conditional U-Net architecture to denoise the image embedding. movq (VQModel) β€”
MoVQ Decoder to generate the image from the latents. Pipeline for text-to-image generation using Kandinsky This model inherits from DiffusionPipeline. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) __call__ < source > ( image_embeds: Union negative_image_embeds: Union hint: FloatTensor height: int = 512 width: int = 512 num_inference_steps: int = 100 guidance_scale: float = 4.0 num_images_per_prompt: int = 1 generator: Union = None latents: Optional = None output_type: Optional = 'pil' callback: Optional = None callback_steps: int = 1 return_dict: bool = True ) β†’ ImagePipelineOutput or tuple Parameters prompt (str or List[str]) β€”
The prompt or prompts to guide the image generation. hint (torch.FloatTensor) β€”
The controlnet condition. image_embeds (torch.FloatTensor or List[torch.FloatTensor]) β€”
The clip image embeddings for text prompt, that will be used to condition the image generation. negative_image_embeds (torch.FloatTensor or List[torch.FloatTensor]) β€”
The clip image embeddings for negative text prompt, will be used to condition the image generation. negative_prompt (str or List[str], optional) β€”
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if guidance_scale is less than 1). height (int, optional, defaults to 512) β€”
The height in pixels of the generated image. width (int, optional, defaults to 512) β€”
The width in pixels of the generated image. num_inference_steps (int, optional, defaults to 100) β€”
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference. guidance_scale (float, optional, defaults to 4.0) β€”
Guidance scale as defined in Classifier-Free Diffusion Guidance.
guidance_scale is defined as w of equation 2. of Imagen
Paper. Guidance scale is enabled by setting guidance_scale > 1. Higher guidance scale encourages to generate images that are closely linked to the text prompt,
usually at the expense of lower image quality. num_images_per_prompt (int, optional, defaults to 1) β€”
The number of images to generate per prompt. generator (torch.Generator or List[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. output_type (str, optional, defaults to "pil") β€”
The output format of the generate image. Choose between: "pil" (PIL.Image.Image), "np"
(np.array) or "pt" (torch.Tensor). callback (Callable, optional) β€”
A function that calls every callback_steps steps during inference. The function is 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 is called. If not specified, the callback is called at
every step. return_dict (bool, optional, defaults to True) β€”
Whether or not to return a ImagePipelineOutput instead of a plain tuple. Returns
ImagePipelineOutput or tuple
Function invoked when calling the pipeline for generation. Examples: KandinskyV22PriorEmb2EmbPipeline class diffusers.KandinskyV22PriorEmb2EmbPipeline < source > ( prior: PriorTransformer image_encoder: CLIPVisionModelWithProjection text_encoder: CLIPTextModelWithProjection tokenizer: CLIPTokenizer scheduler: UnCLIPScheduler image_processor: CLIPImageProcessor ) Parameters prior (PriorTransformer) β€”
The canonincal unCLIP prior to approximate the image embedding from the text embedding. image_encoder (CLIPVisionModelWithProjection) β€”
Frozen image-encoder. text_encoder (CLIPTextModelWithProjection) β€”
Frozen text-encoder. tokenizer (CLIPTokenizer) β€”
Tokenizer of class
CLIPTokenizer. scheduler (UnCLIPScheduler) β€”
A scheduler to be used in combination with prior to generate image embedding. Pipeline for generating image prior for Kandinsky This model inherits from DiffusionPipeline. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) __call__ < source > ( prompt: Union image: Union strength: float = 0.3 negative_prompt: Union = None num_images_per_prompt: int = 1 num_inference_steps: int = 25 generator: Union = None guidance_scale: float = 4.0 output_type: Optional = 'pt' return_dict: bool = True ) β†’ KandinskyPriorPipelineOutput or tuple Parameters prompt (str or List[str]) β€”
The prompt or prompts to guide the image generation. strength (float, optional, defaults to 0.8) β€”