class_docstr: 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.)
  
  Args:
      text_encoder ([`MultilingualCLIP`]):
          Frozen text-encoder.
      tokenizer ([`XLMRobertaTokenizer`]):
          Tokenizer of class
      scheduler (Union[`DDIMScheduler`,`DDPMScheduler`]):
          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.
      prior_prior ([`PriorTransformer`]):
          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](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer).
      prior_scheduler ([`UnCLIPScheduler`]):
          A scheduler to be used in combination with `prior` to generate image embedding.
docstr: Function invoked when calling the pipeline for generation.
  
  Args:
      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](https://arxiv.org/abs/2207.12598).
          `guidance_scale` is defined as `w` of equation 2. of [Imagen
          Paper](https://arxiv.org/pdf/2205.11487.pdf). 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](https://arxiv.org/abs/2207.12598).
          `guidance_scale` is defined as `w` of equation 2. of [Imagen
          Paper](https://arxiv.org/pdf/2205.11487.pdf). 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)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
          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 [`~pipelines.ImagePipelineOutput`] instead of a plain tuple.
  
  Examples:
  
  Returns:
      [`~pipelines.ImagePipelineOutput`] or `tuple`
docstr_tok: ["Function","invoked","when","calling","the","pipeline","for","generation",".","Args",":","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","]","(","https",":","\/\/arxiv.org\/abs\/2207.12598",")",".","`","guidance_scale","`","is","defined","as","`","w","`","of","equation","2.","of","[","Imagen","Paper","]","(","https",":","\/\/arxiv.org\/pdf\/2205.11487.pdf",")",".","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","]","(","https",":","\/\/arxiv.org\/abs\/2207.12598",")",".","`","guidance_scale","`","is","defined","as","`","w","`","of","equation","2.","of","[","Imagen","Paper","]","(","https",":","\/\/arxiv.org\/pdf\/2205.11487.pdf",")",".","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",")","]","(","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.Generator.html",")","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","[","`","~pipelines.ImagePipelineOutput","`","]","instead","of","a","plain","tuple",".","Examples",":","Returns",":","[","`","~pipelines.ImagePipelineOutput","`","]","or","`","tuple","`"]
code: def __call__(
      self,
      prompt: Union[str, List[str]],
      negative_prompt: Optional[Union[str, List[str]]] = 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: Optional[
          Union[torch.Generator, List[torch.Generator]]
      ] = None,
      latents: Optional[torch.FloatTensor] = None,
      output_type: Optional[str] = "pil",
      callback: Optional[
          Callable[[int, int, torch.FloatTensor], None]
      ] = None,
      callback_steps: int = 1,
      return_dict: bool = True,
  ):
      """
      Function invoked when calling the pipeline for generation.
  
      Args:
          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](https://arxiv.org/abs/2207.12598).
              `guidance_scale` is defined as `w` of equation 2. of [Imagen
              Paper](https://arxiv.org/pdf/2205.11487.pdf). 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](https://arxiv.org/abs/2207.12598).
              `guidance_scale` is defined as `w` of equation 2. of [Imagen
              Paper](https://arxiv.org/pdf/2205.11487.pdf). 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)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
              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 [`~pipelines.ImagePipelineOutput`] instead of a plain tuple.
  
      Examples:
  
      Returns:
          [`~pipelines.ImagePipelineOutput`] or `tuple`
      """
      prior_outputs = self.prior_pipe(
          prompt=prompt,
          negative_prompt=negative_prompt,
          num_images_per_prompt=num_images_per_prompt,
          num_inference_steps=prior_num_inference_steps,
          generator=generator,
          latents=latents,
          guidance_scale=prior_guidance_scale,
          output_type="pt",
          return_dict=False,
      )
      image_embeds = prior_outputs[0]
      negative_image_embeds = prior_outputs[1]
  
      prompt = (
          [prompt] if not isinstance(prompt, (list, tuple)) else prompt
      )
  
      if (
          len(prompt) < image_embeds.shape[0]
          and image_embeds.shape[0] % len(prompt) == 0
      ):
          prompt = (image_embeds.shape[0] // len(prompt)) * prompt
  
      outputs = self.decoder_pipe(
          prompt=prompt,
          image_embeds=image_embeds,
          negative_image_embeds=negative_image_embeds,
          width=width,
          height=height,
          num_inference_steps=num_inference_steps,
          generator=generator,
          guidance_scale=guidance_scale,
          output_type=output_type,
          callback=callback,
          callback_steps=callback_steps,
          return_dict=return_dict,
      )
      return outputs
  
imports: from typing import Callable, List, Optional, Union
  import PIL.Image
  import torch
  from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionModelWithProjection, XLMRobertaTokenizer
  from ...models import PriorTransformer, UNet2DConditionModel, VQModel
  from ...schedulers import DDIMScheduler, DDPMScheduler, UnCLIPScheduler
  from ...utils import replace_example_docstring
  from ..pipeline_utils import DiffusionPipeline
  from .pipeline_kandinsky import KandinskyPipeline
  from .pipeline_kandinsky_img2img import KandinskyImg2ImgPipeline
  from .pipeline_kandinsky_inpaint import KandinskyInpaintPipeline
  from .pipeline_kandinsky_prior import KandinskyPriorPipeline
  from .text_encoder import MultilingualCLIP
label_desc: Use image node_id 6 for calling the KandinskyCombinedPipeline obj's underlying member method code with example usage: obj.__call__(prompt, negative_prompt, num_inference_steps, guidance_scale, num_images_per_prompt, height, width, prior_guidance_scale, prior_num_inference_steps, generator, latents, output_type, callback, callback_steps, return_dict) and returns: outputs