import{s as Xe,o as Oe,n as ke}from"../chunks/scheduler.182ea377.js";import{S as Qe,i as ze,g as p,s as i,r as _,A as De,h as c,f as o,c as r,j as F,u as h,x as w,k as W,y as m,a as s,v as b,d as v,t as y,w as k}from"../chunks/index.abf12888.js";import{T as qe}from"../chunks/Tip.230e2334.js";import{D as ie}from"../chunks/Docstring.93f6f462.js";import{C as Ve}from"../chunks/CodeBlock.57fe6e13.js";import{E as Ee}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as Ke}from"../chunks/Heading.16916d63.js";function Ae($){let n,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(){n=p("p"),n.innerHTML=f},l(l){n=c(l,"P",{"data-svelte-h":!0}),w(n)!=="svelte-1nfky5i"&&(n.innerHTML=f)},m(l,d){s(l,n,d)},p:ke,d(l){l&&o(n)}}}function et($){let n,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(){n=p("p"),n.innerHTML=f},l(l){n=c(l,"P",{"data-svelte-h":!0}),w(n)!=="svelte-1rr33yw"&&(n.innerHTML=f)},m(l,d){s(l,n,d)},p:ke,d(l){l&&o(n)}}}function tt($){let n,f="Examples:",l,d,g;return d=new Ve({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTMlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMHBob3RvZ3JhcGglMjBvZiUyMHRoZSUyMGluc2lkZSUyMG9mJTIwYSUyMHN1YndheSUyMHRyYWluLiUyMFRoZXJlJTIwYXJlJTIwcmFjY29vbnMlMjBzaXR0aW5nJTIwb24lMjB0aGUlMjBzZWF0cy4lMjBPbmUlMjBvZiUyMHRoZW0lMjBpcyUyMHJlYWRpbmclMjBhJTIwbmV3c3BhcGVyLiUyMFRoZSUyMHdpbmRvdyUyMHNob3dzJTIwdGhlJTIwY2l0eSUyMGluJTIwdGhlJTIwYmFja2dyb3VuZC4lMjIlMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCgwKSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQ=",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-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">&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(){n=p("p"),n.textContent=f,l=i(),_(d.$$.fragment)},l(a){n=c(a,"P",{"data-svelte-h":!0}),w(n)!=="svelte-kvfsh7"&&(n.textContent=f),l=r(a),h(d.$$.fragment,a)},m(a,u){s(a,n,u),s(a,l,u),b(d,a,u),g=!0},p:ke,i(a){g||(v(d.$$.fragment,a),g=!0)},o(a){y(d.$$.fragment,a),g=!1},d(a){a&&(o(n),o(l)),k(d,a)}}}function nt($){let n,f="Examples:",l,d,g;return d=new Ve({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JJbWFnZTJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0zJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBwYWludGluZyUyMG9mJTIwdGhlJTIwaW5zaWRlJTIwb2YlMjBhJTIwc3Vid2F5JTIwdHJhaW4lMjB3aXRoJTIwdGlueSUyMHJhY2Nvb25zLiUyMiUwQWltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSglMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGa2FuZGluc2t5MyUyRnQyaS5wbmclMjIpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmNwdSUyMikubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMHN0cmVuZ3RoJTNEMC43NSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyNSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvcikuaW1hZ2VzJTVCMCU1RA==",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-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">&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-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky3/t2i.png&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, 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(){n=p("p"),n.textContent=f,l=i(),_(d.$$.fragment)},l(a){n=c(a,"P",{"data-svelte-h":!0}),w(n)!=="svelte-kvfsh7"&&(n.textContent=f),l=r(a),h(d.$$.fragment,a)},m(a,u){s(a,n,u),s(a,l,u),b(d,a,u),g=!0},p:ke,i(a){g||(v(d.$$.fragment,a),g=!0)},o(a){y(d.$$.fragment,a),g=!1},d(a){a&&(o(n),o(l)),k(d,a)}}}function ot($){let n,f,l,d,g,a,u,Ce='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>',le,L,Ge="The description from it’s Github page:",de,B,Ne="<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>",pe,R,Fe="Its architecture includes 3 main components:",ce,H,We='<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>',me,S,Le='The original codebase can be found at <a href="https://github.com/ai-forever/Kandinsky-3" rel="nofollow">ai-forever/Kandinsky-3</a>.',ge,Z,fe,K,ue,Y,_e,x,q,we,M,E,xe,A,Be="Function invoked when calling the pipeline for generation.",Ie,C,$e,G,V,Me,ee,Re="Encodes the prompt into text encoder hidden states.",he,X,be,I,O,Te,T,Q,Pe,te,He="Function invoked when calling the pipeline for generation.",Ue,N,Je,P,z,je,ne,Se="Encodes the prompt into text encoder hidden states.",Ze,oe,Ye=`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.FloatTensor</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.FloatTensor</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.FloatTensor</code>, <em>optional</em>):
Pre-generated attention mask. Must provide if passing <code>prompt_embeds</code> directly.
negative_attention_mask (<code>torch.FloatTensor</code>, <em>optional</em>):
Pre-generated negative attention mask. Must provide if passing <code>negative_prompt_embeds</code> directly.`,ve,re,ye;return g=new Ke({props:{title:"Kandinsky 3",local:"kandinsky-3",headingTag:"h1"}}),Z=new qe({props:{$$slots:{default:[Ae]},$$scope:{ctx:$}}}),K=new qe({props:{$$slots:{default:[et]},$$scope:{ctx:$}}}),Y=new Ke({props:{title:"Kandinsky3Pipeline",local:"diffusers.Kandinsky3Pipeline",headingTag:"h2"}}),q=new ie({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#L49"}}),E=new ie({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.FloatTensor</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.FloatTensor</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.FloatTensor</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.FloatTensor</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.FloatTensor)</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#L338",returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/ddim#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),C=new Ee({props:{anchor:"diffusers.Kandinsky3Pipeline.__call__.example",$$slots:{default:[tt]},$$scope:{ctx:$}}}),V=new ie({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.FloatTensor</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.FloatTensor</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.FloatTensor</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.FloatTensor</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#L95"}}),X=new Ke({props:{title:"Kandinsky3Img2ImgPipeline",local:"diffusers.Kandinsky3Img2ImgPipeline",headingTag:"h2"}}),O=new ie({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#L62"}}),Q=new ie({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.FloatTensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.FloatTensor]</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.FloatTensor</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.FloatTensor</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.FloatTensor</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.FloatTensor</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#L412",returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/ddim#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),N=new Ee({props:{anchor:"diffusers.Kandinsky3Img2ImgPipeline.__call__.example",$$slots:{default:[nt]},$$scope:{ctx:$}}}),z=new ie({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#L118"}}),{c(){n=p("meta"),f=i(),l=p("p"),d=i(),_(g.$$.fragment),a=i(),u=p("p"),u.innerHTML=Ce,le=i(),L=p("p"),L.textContent=Ge,de=i(),B=p("p"),B.innerHTML=Ne,pe=i(),R=p("p"),R.textContent=Fe,ce=i(),H=p("ol"),H.innerHTML=We,me=i(),S=p("p"),S.innerHTML=Le,ge=i(),_(Z.$$.fragment),fe=i(),_(K.$$.fragment),ue=i(),_(Y.$$.fragment),_e=i(),x=p("div"),_(q.$$.fragment),we=i(),M=p("div"),_(E.$$.fragment),xe=i(),A=p("p"),A.textContent=Be,Ie=i(),_(C.$$.fragment),$e=i(),G=p("div"),_(V.$$.fragment),Me=i(),ee=p("p"),ee.textContent=Re,he=i(),_(X.$$.fragment),be=i(),I=p("div"),_(O.$$.fragment),Te=i(),T=p("div"),_(Q.$$.fragment),Pe=i(),te=p("p"),te.textContent=He,Ue=i(),_(N.$$.fragment),Je=i(),P=p("div"),_(z.$$.fragment),je=i(),ne=p("p"),ne.textContent=Se,Ze=i(),oe=p("p"),oe.innerHTML=Ye,ve=i(),re=p("p"),this.h()},l(e){const t=De("svelte-u9bgzb",document.head);n=c(t,"META",{name:!0,content:!0}),t.forEach(o),f=r(e),l=c(e,"P",{}),F(l).forEach(o),d=r(e),h(g.$$.fragment,e),a=r(e),u=c(e,"P",{"data-svelte-h":!0}),w(u)!=="svelte-zgs18q"&&(u.innerHTML=Ce),le=r(e),L=c(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-1rsvssg"&&(L.textContent=Ge),de=r(e),B=c(e,"P",{"data-svelte-h":!0}),w(B)!=="svelte-j37ij6"&&(B.innerHTML=Ne),pe=r(e),R=c(e,"P",{"data-svelte-h":!0}),w(R)!=="svelte-14pgcke"&&(R.textContent=Fe),ce=r(e),H=c(e,"OL",{"data-svelte-h":!0}),w(H)!=="svelte-1vuv5s5"&&(H.innerHTML=We),me=r(e),S=c(e,"P",{"data-svelte-h":!0}),w(S)!=="svelte-1ewkyn"&&(S.innerHTML=Le),ge=r(e),h(Z.$$.fragment,e),fe=r(e),h(K.$$.fragment,e),ue=r(e),h(Y.$$.fragment,e),_e=r(e),x=c(e,"DIV",{class:!0});var U=F(x);h(q.$$.fragment,U),we=r(U),M=c(U,"DIV",{class:!0});var J=F(M);h(E.$$.fragment,J),xe=r(J),A=c(J,"P",{"data-svelte-h":!0}),w(A)!=="svelte-v78lg8"&&(A.textContent=Be),Ie=r(J),h(C.$$.fragment,J),J.forEach(o),$e=r(U),G=c(U,"DIV",{class:!0});var D=F(G);h(V.$$.fragment,D),Me=r(D),ee=c(D,"P",{"data-svelte-h":!0}),w(ee)!=="svelte-16q0ax1"&&(ee.textContent=Re),D.forEach(o),U.forEach(o),he=r(e),h(X.$$.fragment,e),be=r(e),I=c(e,"DIV",{class:!0});var j=F(I);h(O.$$.fragment,j),Te=r(j),T=c(j,"DIV",{class:!0});var ae=F(T);h(Q.$$.fragment,ae),Pe=r(ae),te=c(ae,"P",{"data-svelte-h":!0}),w(te)!=="svelte-v78lg8"&&(te.textContent=He),Ue=r(ae),h(N.$$.fragment,ae),ae.forEach(o),Je=r(j),P=c(j,"DIV",{class:!0});var se=F(P);h(z.$$.fragment,se),je=r(se),ne=c(se,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-16q0ax1"&&(ne.textContent=Se),Ze=r(se),oe=c(se,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-kyx1qm"&&(oe.innerHTML=Ye),se.forEach(o),j.forEach(o),ve=r(e),re=c(e,"P",{}),F(re).forEach(o),this.h()},h(){W(n,"name","hf:doc:metadata"),W(n,"content",at),W(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(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,n),s(e,f,t),s(e,l,t),s(e,d,t),b(g,e,t),s(e,a,t),s(e,u,t),s(e,le,t),s(e,L,t),s(e,de,t),s(e,B,t),s(e,pe,t),s(e,R,t),s(e,ce,t),s(e,H,t),s(e,me,t),s(e,S,t),s(e,ge,t),b(Z,e,t),s(e,fe,t),b(K,e,t),s(e,ue,t),b(Y,e,t),s(e,_e,t),s(e,x,t),b(q,x,null),m(x,we),m(x,M),b(E,M,null),m(M,xe),m(M,A),m(M,Ie),b(C,M,null),m(x,$e),m(x,G),b(V,G,null),m(G,Me),m(G,ee),s(e,he,t),b(X,e,t),s(e,be,t),s(e,I,t),b(O,I,null),m(I,Te),m(I,T),b(Q,T,null),m(T,Pe),m(T,te),m(T,Ue),b(N,T,null),m(I,Je),m(I,P),b(z,P,null),m(P,je),m(P,ne),m(P,Ze),m(P,oe),s(e,ve,t),s(e,re,t),ye=!0},p(e,[t]){const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),Z.$set(U);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 j={};t&2&&(j.$$scope={dirty:t,ctx:e}),N.$set(j)},i(e){ye||(v(g.$$.fragment,e),v(Z.$$.fragment,e),v(K.$$.fragment,e),v(Y.$$.fragment,e),v(q.$$.fragment,e),v(E.$$.fragment,e),v(C.$$.fragment,e),v(V.$$.fragment,e),v(X.$$.fragment,e),v(O.$$.fragment,e),v(Q.$$.fragment,e),v(N.$$.fragment,e),v(z.$$.fragment,e),ye=!0)},o(e){y(g.$$.fragment,e),y(Z.$$.fragment,e),y(K.$$.fragment,e),y(Y.$$.fragment,e),y(q.$$.fragment,e),y(E.$$.fragment,e),y(C.$$.fragment,e),y(V.$$.fragment,e),y(X.$$.fragment,e),y(O.$$.fragment,e),y(Q.$$.fragment,e),y(N.$$.fragment,e),y(z.$$.fragment,e),ye=!1},d(e){e&&(o(f),o(l),o(d),o(a),o(u),o(le),o(L),o(de),o(B),o(pe),o(R),o(ce),o(H),o(me),o(S),o(ge),o(fe),o(ue),o(_e),o(x),o(he),o(be),o(I),o(ve),o(re)),o(n),k(g,e),k(Z,e),k(K,e),k(Y,e),k(q),k(E),k(C),k(V),k(X,e),k(O),k(Q),k(N),k(z)}}}const at='{"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 st($){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gt extends Qe{constructor(n){super(),ze(this,n,st,ot,Xe,{})}}export{gt as component};
