import{s as Ae,o as Qe,n as xe}from"../chunks/scheduler.8c3d61f6.js";import{S as ze,i as De,g as p,s as i,r as u,A as et,h as c,f as n,c as r,j as W,u as _,x as w,k as B,y as m,a as s,v as h,d as b,t as v,w as y}from"../chunks/index.da70eac4.js";import{T as Ve}from"../chunks/Tip.1d9b8c37.js";import{D as re}from"../chunks/Docstring.6b390b9a.js";import{C as Oe}from"../chunks/CodeBlock.00a903b3.js";import{E as Xe}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as Ge,E as tt}from"../chunks/EditOnGithub.1e64e623.js";function nt($){let o,f='Check out the <a href="https://huggingface.co/kandinsky-community" rel="nofollow">Kandinsky Community</a> organization on the Hub for the official model checkpoints for tasks like text-to-image, image-to-image, and inpainting.';return{c(){o=p("p"),o.innerHTML=f},l(l){o=c(l,"P",{"data-svelte-h":!0}),w(o)!=="svelte-1nfky5i"&&(o.innerHTML=f)},m(l,d){s(l,o,d)},p:xe,d(l){l&&n(o)}}}function ot($){let o,f='Make sure to check out the schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-components-across-pipelines">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){o=p("p"),o.innerHTML=f},l(l){o=c(l,"P",{"data-svelte-h":!0}),w(o)!=="svelte-1rr33yw"&&(o.innerHTML=f)},m(l,d){s(l,o,d)},p:xe,d(l){l&&n(o)}}}function at($){let o,f="Examples:",l,d,g;return d=new Oe({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTMlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMHBob3RvZ3JhcGglMjBvZiUyMHRoZSUyMGluc2lkZSUyMG9mJTIwYSUyMHN1YndheSUyMHRyYWluLiUyMFRoZXJlJTIwYXJlJTIwcmFjY29vbnMlMjBzaXR0aW5nJTIwb24lMjB0aGUlMjBzZWF0cy4lMjBPbmUlMjBvZiUyMHRoZW0lMjBpcyUyMHJlYWRpbmclMjBhJTIwbmV3c3BhcGVyLiUyMFRoZSUyMHdpbmRvdyUyMHNob3dzJTIwdGhlJTIwY2l0eSUyMGluJTIwdGhlJTIwYmFja2dyb3VuZC4lMjIlMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCgwKSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = AutoPipelineForText2Image.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A photograph of the inside of a subway train. There are raccoons sitting on the seats. One of them is reading a newspaper. The window shows the city in the background.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt, num_inference_steps=<span class="hljs-number">25</span>, generator=generator).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){o=p("p"),o.textContent=f,l=i(),u(d.$$.fragment)},l(a){o=c(a,"P",{"data-svelte-h":!0}),w(o)!=="svelte-kvfsh7"&&(o.textContent=f),l=r(a),_(d.$$.fragment,a)},m(a,k){s(a,o,k),s(a,l,k),h(d,a,k),g=!0},p:xe,i(a){g||(b(d.$$.fragment,a),g=!0)},o(a){v(d.$$.fragment,a),g=!1},d(a){a&&(n(o),n(l)),y(d,a)}}}function st($){let o,f="Examples:",l,d,g;return d=new Oe({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JJbWFnZTJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0zJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBwYWludGluZyUyMG9mJTIwdGhlJTIwaW5zaWRlJTIwb2YlMjBhJTIwc3Vid2F5JTIwdHJhaW4lMjB3aXRoJTIwdGlueSUyMHJhY2Nvb25zLiUyMiUwQWltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGa2FuZGluc2t5MyUyRnQyaS5wbmclMjIlMEEpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmNwdSUyMikubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMHN0cmVuZ3RoJTNEMC43NSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyNSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvcikuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = AutoPipelineForImage2Image.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A painting of the inside of a subway train with tiny raccoons.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky3/t2i.png&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt, image=image, strength=<span class="hljs-number">0.75</span>, num_inference_steps=<span class="hljs-number">25</span>, generator=generator).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){o=p("p"),o.textContent=f,l=i(),u(d.$$.fragment)},l(a){o=c(a,"P",{"data-svelte-h":!0}),w(o)!=="svelte-kvfsh7"&&(o.textContent=f),l=r(a),_(d.$$.fragment,a)},m(a,k){s(a,o,k),s(a,l,k),h(d,a,k),g=!0},p:xe,i(a){g||(b(d.$$.fragment,a),g=!0)},o(a){v(d.$$.fragment,a),g=!1},d(a){a&&(n(o),n(l)),y(d,a)}}}function it($){let o,f,l,d,g,a,k,Ne='Kandinsky 3 is created by <a href="https://github.com/oriBetelgeuse" rel="nofollow">Vladimir Arkhipkin</a>,<a href="https://github.com/NastyaMittseva" rel="nofollow">Anastasia Maltseva</a>,<a href="https://github.com/boomb0om" rel="nofollow">Igor Pavlov</a>,<a href="https://github.com/anvilarth" rel="nofollow">Andrei Filatov</a>,<a href="https://github.com/cene555" rel="nofollow">Arseniy Shakhmatov</a>,<a href="https://github.com/kuznetsoffandrey" rel="nofollow">Andrey Kuznetsov</a>,<a href="https://github.com/denndimitrov" rel="nofollow">Denis Dimitrov</a>, <a href="https://github.com/zeinsh" rel="nofollow">Zein Shaheen</a>',de,L,We="The description from it’s GitHub page:",pe,F,Be="<em>Kandinsky 3.0 is an open-source text-to-image diffusion model built upon the Kandinsky2-x model family. In comparison to its predecessors, enhancements have been made to the text understanding and visual quality of the model, achieved by increasing the size of the text encoder and Diffusion U-Net models, respectively.</em>",ce,R,Le="Its architecture includes 3 main components:",me,E,Fe='<li><a href="https://huggingface.co/google/flan-ul2" rel="nofollow">FLAN-UL2</a>, which is an encoder decoder model based on the T5 architecture.</li> <li>New U-Net architecture featuring BigGAN-deep blocks doubles depth while maintaining the same number of parameters.</li> <li>Sber-MoVQGAN is a decoder proven to have superior results in image restoration.</li>',ge,H,Re='The original codebase can be found at <a href="https://github.com/ai-forever/Kandinsky-3" rel="nofollow">ai-forever/Kandinsky-3</a>.',fe,Z,ue,K,_e,S,he,x,Y,Ie,M,q,$e,ee,Ee="Function invoked when calling the pipeline for generation.",Me,C,Te,G,V,Pe,te,He="Encodes the prompt into text encoder hidden states.",be,X,ve,I,O,je,T,A,Je,ne,Se="Function invoked when calling the pipeline for generation.",Ue,N,Ze,P,Q,Ke,oe,Ye="Encodes the prompt into text encoder hidden states.",Ce,ae,qe=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. If not defined, one has to pass <code>negative_prompt_embeds</code>. instead.
Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is less than <code>1</code>).
prompt_embeds (<code>torch.Tensor</code>, <em>optional</em>):
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.
negative_prompt_embeds (<code>torch.Tensor</code>, <em>optional</em>):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.
attention_mask (<code>torch.Tensor</code>, <em>optional</em>):
Pre-generated attention mask. Must provide if passing <code>prompt_embeds</code> directly.
negative_attention_mask (<code>torch.Tensor</code>, <em>optional</em>):
Pre-generated negative attention mask. Must provide if passing <code>negative_prompt_embeds</code> directly.`,ye,z,ke,le,we;return g=new Ge({props:{title:"Kandinsky 3",local:"kandinsky-3",headingTag:"h1"}}),Z=new Ve({props:{$$slots:{default:[nt]},$$scope:{ctx:$}}}),K=new Ve({props:{$$slots:{default:[ot]},$$scope:{ctx:$}}}),S=new Ge({props:{title:"Kandinsky3Pipeline",local:"diffusers.Kandinsky3Pipeline",headingTag:"h2"}}),Y=new re({props:{name:"class diffusers.Kandinsky3Pipeline",anchor:"diffusers.Kandinsky3Pipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": Kandinsky3UNet"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3.py#L50"}}),q=new re({props:{name:"__call__",anchor:"diffusers.Kandinsky3Pipeline.__call__",parameters:[{name:"prompt",val:": Union = None"},{name:"num_inference_steps",val:": int = 25"},{name:"guidance_scale",val:": float = 3.0"},{name:"negative_prompt",val:": Union = None"},{name:"num_images_per_prompt",val:": Optional = 1"},{name:"height",val:": Optional = 1024"},{name:"width",val:": Optional = 1024"},{name:"generator",val:": Union = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"negative_attention_mask",val:": Optional = None"},{name:"output_type",val:": Optional = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"latents",val:" = None"},{name:"callback_on_step_end",val:": Optional = None"},{name:"callback_on_step_end_tensor_inputs",val:": List = ['latents']"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.Kandinsky3Pipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 3.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated attention mask. Must provide if passing <code>prompt_embeds</code> directly.`,name:"attention_mask"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative attention mask. Must provide if passing <code>negative_prompt_embeds</code> directly.`,name:"negative_attention_mask"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.Tensor)</code>.`,name:"callback"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.Kandinsky3Pipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3.py#L325",returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),C=new Xe({props:{anchor:"diffusers.Kandinsky3Pipeline.__call__.example",$$slots:{default:[at]},$$scope:{ctx:$}}}),V=new re({props:{name:"encode_prompt",anchor:"diffusers.Kandinsky3Pipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"_cut_context",val:" = False"},{name:"attention_mask",val:": Optional = None"},{name:"negative_attention_mask",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"prompt"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. If not defined, one has to pass <code>negative_prompt_embeds</code>. instead.
Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated attention mask. Must provide if passing <code>prompt_embeds</code> directly.`,name:"attention_mask"},{anchor:"diffusers.Kandinsky3Pipeline.encode_prompt.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative attention mask. Must provide if passing <code>negative_prompt_embeds</code> directly.`,name:"negative_attention_mask"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3.py#L82"}}),X=new Ge({props:{title:"Kandinsky3Img2ImgPipeline",local:"diffusers.Kandinsky3Img2ImgPipeline",headingTag:"h2"}}),O=new re({props:{name:"class diffusers.Kandinsky3Img2ImgPipeline",anchor:"diffusers.Kandinsky3Img2ImgPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": Kandinsky3UNet"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py#L65"}}),A=new re({props:{name:"__call__",anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__",parameters:[{name:"prompt",val:": Union = None"},{name:"image",val:": Union = None"},{name:"strength",val:": float = 0.3"},{name:"num_inference_steps",val:": int = 25"},{name:"guidance_scale",val:": float = 3.0"},{name:"negative_prompt",val:": Union = None"},{name:"num_images_per_prompt",val:": Optional = 1"},{name:"generator",val:": Union = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"negative_attention_mask",val:": Optional = None"},{name:"output_type",val:": Optional = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": Optional = None"},{name:"callback_on_step_end_tensor_inputs",val:": List = ['latents']"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.Tensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.Tensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Indicates extent to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code> is used as a
starting point and more noise is added the higher the <code>strength</code>. The number of denoising steps depends
on the amount of noise initially added. When <code>strength</code> is 1, added noise is maximum and the denoising
process runs for the full number of iterations specified in <code>num_inference_steps</code>. A value of 1
essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 3.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated attention mask. Must provide if passing <code>prompt_embeds</code> directly.`,name:"attention_mask"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative attention mask. Must provide if passing <code>negative_prompt_embeds</code> directly.`,name:"negative_attention_mask"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a list of all tensors as specified by
<code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py#L401",returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),N=new Xe({props:{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.example",$$slots:{default:[st]},$$scope:{ctx:$}}}),Q=new re({props:{name:"encode_prompt",anchor:"diffusers.Kandinsky3Img2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"_cut_context",val:" = False"},{name:"attention_mask",val:": Optional = None"},{name:"negative_attention_mask",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky3Img2ImgPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py#L107"}}),z=new tt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/kandinsky3.md"}}),{c(){o=p("meta"),f=i(),l=p("p"),d=i(),u(g.$$.fragment),a=i(),k=p("p"),k.innerHTML=Ne,de=i(),L=p("p"),L.textContent=We,pe=i(),F=p("p"),F.innerHTML=Be,ce=i(),R=p("p"),R.textContent=Le,me=i(),E=p("ol"),E.innerHTML=Fe,ge=i(),H=p("p"),H.innerHTML=Re,fe=i(),u(Z.$$.fragment),ue=i(),u(K.$$.fragment),_e=i(),u(S.$$.fragment),he=i(),x=p("div"),u(Y.$$.fragment),Ie=i(),M=p("div"),u(q.$$.fragment),$e=i(),ee=p("p"),ee.textContent=Ee,Me=i(),u(C.$$.fragment),Te=i(),G=p("div"),u(V.$$.fragment),Pe=i(),te=p("p"),te.textContent=He,be=i(),u(X.$$.fragment),ve=i(),I=p("div"),u(O.$$.fragment),je=i(),T=p("div"),u(A.$$.fragment),Je=i(),ne=p("p"),ne.textContent=Se,Ue=i(),u(N.$$.fragment),Ze=i(),P=p("div"),u(Q.$$.fragment),Ke=i(),oe=p("p"),oe.textContent=Ye,Ce=i(),ae=p("p"),ae.innerHTML=qe,ye=i(),u(z.$$.fragment),ke=i(),le=p("p"),this.h()},l(e){const t=et("svelte-u9bgzb",document.head);o=c(t,"META",{name:!0,content:!0}),t.forEach(n),f=r(e),l=c(e,"P",{}),W(l).forEach(n),d=r(e),_(g.$$.fragment,e),a=r(e),k=c(e,"P",{"data-svelte-h":!0}),w(k)!=="svelte-zgs18q"&&(k.innerHTML=Ne),de=r(e),L=c(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-11fcrak"&&(L.textContent=We),pe=r(e),F=c(e,"P",{"data-svelte-h":!0}),w(F)!=="svelte-j37ij6"&&(F.innerHTML=Be),ce=r(e),R=c(e,"P",{"data-svelte-h":!0}),w(R)!=="svelte-14pgcke"&&(R.textContent=Le),me=r(e),E=c(e,"OL",{"data-svelte-h":!0}),w(E)!=="svelte-szx3ox"&&(E.innerHTML=Fe),ge=r(e),H=c(e,"P",{"data-svelte-h":!0}),w(H)!=="svelte-1ewkyn"&&(H.innerHTML=Re),fe=r(e),_(Z.$$.fragment,e),ue=r(e),_(K.$$.fragment,e),_e=r(e),_(S.$$.fragment,e),he=r(e),x=c(e,"DIV",{class:!0});var j=W(x);_(Y.$$.fragment,j),Ie=r(j),M=c(j,"DIV",{class:!0});var J=W(M);_(q.$$.fragment,J),$e=r(J),ee=c(J,"P",{"data-svelte-h":!0}),w(ee)!=="svelte-v78lg8"&&(ee.textContent=Ee),Me=r(J),_(C.$$.fragment,J),J.forEach(n),Te=r(j),G=c(j,"DIV",{class:!0});var D=W(G);_(V.$$.fragment,D),Pe=r(D),te=c(D,"P",{"data-svelte-h":!0}),w(te)!=="svelte-16q0ax1"&&(te.textContent=He),D.forEach(n),j.forEach(n),be=r(e),_(X.$$.fragment,e),ve=r(e),I=c(e,"DIV",{class:!0});var U=W(I);_(O.$$.fragment,U),je=r(U),T=c(U,"DIV",{class:!0});var se=W(T);_(A.$$.fragment,se),Je=r(se),ne=c(se,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-v78lg8"&&(ne.textContent=Se),Ue=r(se),_(N.$$.fragment,se),se.forEach(n),Ze=r(U),P=c(U,"DIV",{class:!0});var ie=W(P);_(Q.$$.fragment,ie),Ke=r(ie),oe=c(ie,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-16q0ax1"&&(oe.textContent=Ye),Ce=r(ie),ae=c(ie,"P",{"data-svelte-h":!0}),w(ae)!=="svelte-1jhxv5m"&&(ae.innerHTML=qe),ie.forEach(n),U.forEach(n),ye=r(e),_(z.$$.fragment,e),ke=r(e),le=c(e,"P",{}),W(le).forEach(n),this.h()},h(){B(o,"name","hf:doc:metadata"),B(o,"content",rt),B(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){m(document.head,o),s(e,f,t),s(e,l,t),s(e,d,t),h(g,e,t),s(e,a,t),s(e,k,t),s(e,de,t),s(e,L,t),s(e,pe,t),s(e,F,t),s(e,ce,t),s(e,R,t),s(e,me,t),s(e,E,t),s(e,ge,t),s(e,H,t),s(e,fe,t),h(Z,e,t),s(e,ue,t),h(K,e,t),s(e,_e,t),h(S,e,t),s(e,he,t),s(e,x,t),h(Y,x,null),m(x,Ie),m(x,M),h(q,M,null),m(M,$e),m(M,ee),m(M,Me),h(C,M,null),m(x,Te),m(x,G),h(V,G,null),m(G,Pe),m(G,te),s(e,be,t),h(X,e,t),s(e,ve,t),s(e,I,t),h(O,I,null),m(I,je),m(I,T),h(A,T,null),m(T,Je),m(T,ne),m(T,Ue),h(N,T,null),m(I,Ze),m(I,P),h(Q,P,null),m(P,Ke),m(P,oe),m(P,Ce),m(P,ae),s(e,ye,t),h(z,e,t),s(e,ke,t),s(e,le,t),we=!0},p(e,[t]){const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),Z.$set(j);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),K.$set(J);const D={};t&2&&(D.$$scope={dirty:t,ctx:e}),C.$set(D);const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),N.$set(U)},i(e){we||(b(g.$$.fragment,e),b(Z.$$.fragment,e),b(K.$$.fragment,e),b(S.$$.fragment,e),b(Y.$$.fragment,e),b(q.$$.fragment,e),b(C.$$.fragment,e),b(V.$$.fragment,e),b(X.$$.fragment,e),b(O.$$.fragment,e),b(A.$$.fragment,e),b(N.$$.fragment,e),b(Q.$$.fragment,e),b(z.$$.fragment,e),we=!0)},o(e){v(g.$$.fragment,e),v(Z.$$.fragment,e),v(K.$$.fragment,e),v(S.$$.fragment,e),v(Y.$$.fragment,e),v(q.$$.fragment,e),v(C.$$.fragment,e),v(V.$$.fragment,e),v(X.$$.fragment,e),v(O.$$.fragment,e),v(A.$$.fragment,e),v(N.$$.fragment,e),v(Q.$$.fragment,e),v(z.$$.fragment,e),we=!1},d(e){e&&(n(f),n(l),n(d),n(a),n(k),n(de),n(L),n(pe),n(F),n(ce),n(R),n(me),n(E),n(ge),n(H),n(fe),n(ue),n(_e),n(he),n(x),n(be),n(ve),n(I),n(ye),n(ke),n(le)),n(o),y(g,e),y(Z,e),y(K,e),y(S,e),y(Y),y(q),y(C),y(V),y(X,e),y(O),y(A),y(N),y(Q),y(z,e)}}}const rt='{"title":"Kandinsky 3","local":"kandinsky-3","sections":[{"title":"Kandinsky3Pipeline","local":"diffusers.Kandinsky3Pipeline","sections":[],"depth":2},{"title":"Kandinsky3Img2ImgPipeline","local":"diffusers.Kandinsky3Img2ImgPipeline","sections":[],"depth":2}],"depth":1}';function lt($){return Qe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends ze{constructor(o){super(),De(this,o,lt,it,Ae,{})}}export{_t as component};
