import{S as Ho,i as Bo,s as Wo,e as o,k as d,w as v,t as s,M as Ro,c as n,d as a,m as f,a as i,x as P,h as r,b as l,G as e,g as c,y as w,q as y,o as D,B as k,v as Yo,L as Ko}from"../../../../chunks/vendor-hf-doc-builder.js";import{D as ot}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as Vo}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as nt}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Jo}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Qo(it){let m,j,b,g,E;return g=new Vo({props:{code:`import torch
from diffusers import StableDiffusionPanoramaPipeline, DDIMScheduler

model_ckpt = "stabilityai/stable-diffusion-2-base"
scheduler = DDIMScheduler.from_pretrained(model_ckpt, subfolder="scheduler")
pipe = StableDiffusionPanoramaPipeline.from_pretrained(
    model_ckpt, scheduler=scheduler, torch_dtype=torch.float16
)

pipe = pipe.to("cuda")

prompt = "a photo of the dolomites"
image = pipe(prompt).images[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPanoramaPipeline, DDIMScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span>model_ckpt = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-base&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = DDIMScheduler.from_pretrained(model_ckpt, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPanoramaPipeline.from_pretrained(
<span class="hljs-meta">... </span>    model_ckpt, scheduler=scheduler, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of the dolomites&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){m=o("p"),j=s("Examples:"),b=d(),v(g.$$.fragment)},l(u){m=n(u,"P",{});var S=i(m);j=r(S,"Examples:"),S.forEach(a),b=f(u),P(g.$$.fragment,u)},m(u,S){c(u,m,S),e(m,j),c(u,b,S),w(g,u,S),E=!0},p:Ko,i(u){E||(y(g.$$.fragment,u),E=!0)},o(u){D(g.$$.fragment,u),E=!1},d(u){u&&a(m),u&&a(b),k(g,u)}}}function Xo(it){let m,j,b,g,E,u,S,Ce,St,st,C,G,Ae,K,Tt,Me,It,rt,J,Q,Ct,At,lt,_e,Mt,dt,be,Lt,ft,ve,Ot,pt,$,Pe,X,qt,Nt,jt,we,Z,Gt,Ut,Ft,ye,ee,zt,Vt,Ht,De,te,Bt,Wt,ct,A,U,Le,ae,Rt,Oe,Yt,ut,F,qe,M,Ne,Kt,Jt,je,Qt,Xt,ke,Zt,ea,Ge,L,Ue,oe,ta,aa,Fe,ze,oa,na,ne,ie,ia,sa,ht,O,z,Ve,se,ra,He,la,mt,re,gt,q,V,Be,le,da,We,fa,_t,h,de,pa,Re,ca,ua,fe,ha,$e,ma,ga,_a,x,ba,Ye,va,Pa,Ke,wa,ya,Je,Da,ka,$a,T,pe,xa,Qe,Ea,Sa,H,Ta,B,ce,Ia,ue,Ca,Xe,Aa,Ma,La,W,he,Oa,N,qa,Ze,Na,ja,et,Ga,Ua,Fa,I,me,za,tt,Va,Ha,at,Ba,bt;return u=new nt({}),K=new nt({}),ae=new nt({}),se=new nt({}),re=new Vo({props:{code:`import torch
from diffusers import StableDiffusionPanoramaPipeline, DDIMScheduler

model_ckpt = "stabilityai/stable-diffusion-2-base"
scheduler = DDIMScheduler.from_pretrained(model_ckpt, subfolder="scheduler")
pipe = StableDiffusionPanoramaPipeline.from_pretrained(model_ckpt, scheduler=scheduler, torch_dtype=torch.float16)

pipe = pipe.to("cuda")

prompt = "a photo of the dolomites"
image = pipe(prompt).images[0]
image.save("dolomites.png")`,highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPanoramaPipeline, DDIMScheduler

model_ckpt = <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-base&quot;</span>
scheduler = DDIMScheduler.from_pretrained(model_ckpt, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
pipe = StableDiffusionPanoramaPipeline.from_pretrained(model_ckpt, scheduler=scheduler, torch_dtype=torch.float16)

pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;a photo of the dolomites&quot;</span>
image = pipe(prompt).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;dolomites.png&quot;</span>)`}}),le=new nt({}),de=new ot({props:{name:"class diffusers.StableDiffusionPanoramaPipeline",anchor:"diffusers.StableDiffusionPanoramaPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPanoramaPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.16.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.16.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. The original work
on Multi Diffsion used the <a href="/docs/diffusers/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py#L51"}}),pe=new ot({props:{name:"__call__",anchor:"diffusers.StableDiffusionPanoramaPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": typing.Optional[int] = 512"},{name:"width",val:": typing.Optional[int] = 2048"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": typing.Optional[int] = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512 &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The width in pixels of the generated image. The width is kept to a high number because the
pipeline is supposed to be used for generating panorama-like images.`,name:"width"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#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.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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/v0.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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 <a href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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.StableDiffusionPanoramaPipeline.__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/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py#L458",returnDescription:`
<p><a
  href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),H=new Jo({props:{anchor:"diffusers.StableDiffusionPanoramaPipeline.__call__.example",$$slots:{default:[Qo]},$$scope:{ctx:it}}}),ce=new ot({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionPanoramaPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py#L139"}}),he=new ot({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionPanoramaPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py#L147"}}),me=new ot({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionPanoramaPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py#L129"}}),{c(){m=o("meta"),j=d(),b=o("h1"),g=o("a"),E=o("span"),v(u.$$.fragment),S=d(),Ce=o("span"),St=s("MultiDiffusion: Fusing Diffusion Paths for Controlled Image Generation"),st=d(),C=o("h2"),G=o("a"),Ae=o("span"),v(K.$$.fragment),Tt=d(),Me=o("span"),It=s("Overview"),rt=d(),J=o("p"),Q=o("a"),Ct=s("MultiDiffusion: Fusing Diffusion Paths for Controlled Image Generation"),At=s(" by Omer Bar-Tal, Lior Yariv, Yaron Lipman, and Tali Dekel."),lt=d(),_e=o("p"),Mt=s("The abstract of the paper is the following:"),dt=d(),be=o("p"),Lt=s("*Recent advances in text-to-image generation with diffusion models present transformative capabilities in image quality. However, user controllability of the generated image, and fast adaptation to new tasks still remains an open challenge, currently mostly addressed by costly and long re-training and fine-tuning or ad-hoc adaptations to specific image generation tasks. In this work, we present MultiDiffusion, a unified framework that enables versatile and controllable image generation, using a pre-trained text-to-image diffusion model, without any further training or finetuning. At the center of our approach is a new generation process, based on an optimization task that binds together multiple diffusion generation processes with a shared set of parameters or constraints. We show that MultiDiffusion can be readily applied to generate high quality and diverse images that adhere to user-provided controls, such as desired aspect ratio (e.g., panorama), and spatial guiding signals, ranging from tight segmentation masks to bounding boxes."),ft=d(),ve=o("p"),Ot=s("Resources:"),pt=d(),$=o("ul"),Pe=o("li"),X=o("a"),qt=s("Project Page"),Nt=s("."),jt=d(),we=o("li"),Z=o("a"),Gt=s("Paper"),Ut=s("."),Ft=d(),ye=o("li"),ee=o("a"),zt=s("Original Code"),Vt=s("."),Ht=d(),De=o("li"),te=o("a"),Bt=s("Demo"),Wt=s("."),ct=d(),A=o("h2"),U=o("a"),Le=o("span"),v(ae.$$.fragment),Rt=d(),Oe=o("span"),Yt=s("Available Pipelines:"),ut=d(),F=o("table"),qe=o("thead"),M=o("tr"),Ne=o("th"),Kt=s("Pipeline"),Jt=d(),je=o("th"),Qt=s("Tasks"),Xt=d(),ke=o("th"),Zt=s("Demo"),ea=d(),Ge=o("tbody"),L=o("tr"),Ue=o("td"),oe=o("a"),ta=s("StableDiffusionPanoramaPipeline"),aa=d(),Fe=o("td"),ze=o("em"),oa=s("Text-Guided Panorama View Generation"),na=d(),ne=o("td"),ie=o("a"),ia=s("\u{1F917} Space"),sa=s(")"),ht=d(),O=o("h2"),z=o("a"),Ve=o("span"),v(se.$$.fragment),ra=d(),He=o("span"),la=s("Usage example"),mt=d(),v(re.$$.fragment),gt=d(),q=o("h2"),V=o("a"),Be=o("span"),v(le.$$.fragment),da=d(),We=o("span"),fa=s("StableDiffusionPanoramaPipeline"),_t=d(),h=o("div"),v(de.$$.fragment),pa=d(),Re=o("p"),ca=s(`Pipeline for text-to-image generation using \u201CMultiDiffusion: Fusing Diffusion Paths for Controlled Image
Generation\u201D.`),ua=d(),fe=o("p"),ha=s("This model inherits from "),$e=o("a"),ma=s("DiffusionPipeline"),ga=s(`. 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.).`),_a=d(),x=o("p"),ba=s("To generate panorama-like images, be sure to pass the "),Ye=o("code"),va=s("width"),Pa=s(` parameter accordingly when using the pipeline. Our
recommendation for the `),Ke=o("code"),wa=s("width"),ya=s(" value is 2048. This is the default value of the "),Je=o("code"),Da=s("width"),ka=s(" parameter for this pipeline."),$a=d(),T=o("div"),v(pe.$$.fragment),xa=d(),Qe=o("p"),Ea=s("Function invoked when calling the pipeline for generation."),Sa=d(),v(H.$$.fragment),Ta=d(),B=o("div"),v(ce.$$.fragment),Ia=d(),ue=o("p"),Ca=s("Disable sliced VAE decoding. If "),Xe=o("code"),Aa=s("enable_vae_slicing"),Ma=s(` was previously invoked, this method will go back to
computing decoding in one step.`),La=d(),W=o("div"),v(he.$$.fragment),Oa=d(),N=o("p"),qa=s(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Ze=o("code"),Na=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),ja=s("forward"),et=o("code"),Ga=s("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Ua=s("enable_model_cpu_offload`, but performance is lower."),Fa=d(),I=o("div"),v(me.$$.fragment),za=d(),tt=o("p"),Va=s("Enable sliced VAE decoding."),Ha=d(),at=o("p"),Ba=s(`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),this.h()},l(t){const p=Ro('[data-svelte="svelte-1phssyn"]',document.head);m=n(p,"META",{name:!0,content:!0}),p.forEach(a),j=f(t),b=n(t,"H1",{class:!0});var ge=i(b);g=n(ge,"A",{id:!0,class:!0,href:!0});var Xa=i(g);E=n(Xa,"SPAN",{});var Za=i(E);P(u.$$.fragment,Za),Za.forEach(a),Xa.forEach(a),S=f(ge),Ce=n(ge,"SPAN",{});var eo=i(Ce);St=r(eo,"MultiDiffusion: Fusing Diffusion Paths for Controlled Image Generation"),eo.forEach(a),ge.forEach(a),st=f(t),C=n(t,"H2",{class:!0});var vt=i(C);G=n(vt,"A",{id:!0,class:!0,href:!0});var to=i(G);Ae=n(to,"SPAN",{});var ao=i(Ae);P(K.$$.fragment,ao),ao.forEach(a),to.forEach(a),Tt=f(vt),Me=n(vt,"SPAN",{});var oo=i(Me);It=r(oo,"Overview"),oo.forEach(a),vt.forEach(a),rt=f(t),J=n(t,"P",{});var Wa=i(J);Q=n(Wa,"A",{href:!0,rel:!0});var no=i(Q);Ct=r(no,"MultiDiffusion: Fusing Diffusion Paths for Controlled Image Generation"),no.forEach(a),At=r(Wa," by Omer Bar-Tal, Lior Yariv, Yaron Lipman, and Tali Dekel."),Wa.forEach(a),lt=f(t),_e=n(t,"P",{});var io=i(_e);Mt=r(io,"The abstract of the paper is the following:"),io.forEach(a),dt=f(t),be=n(t,"P",{});var so=i(be);Lt=r(so,"*Recent advances in text-to-image generation with diffusion models present transformative capabilities in image quality. However, user controllability of the generated image, and fast adaptation to new tasks still remains an open challenge, currently mostly addressed by costly and long re-training and fine-tuning or ad-hoc adaptations to specific image generation tasks. In this work, we present MultiDiffusion, a unified framework that enables versatile and controllable image generation, using a pre-trained text-to-image diffusion model, without any further training or finetuning. At the center of our approach is a new generation process, based on an optimization task that binds together multiple diffusion generation processes with a shared set of parameters or constraints. We show that MultiDiffusion can be readily applied to generate high quality and diverse images that adhere to user-provided controls, such as desired aspect ratio (e.g., panorama), and spatial guiding signals, ranging from tight segmentation masks to bounding boxes."),so.forEach(a),ft=f(t),ve=n(t,"P",{});var ro=i(ve);Ot=r(ro,"Resources:"),ro.forEach(a),pt=f(t),$=n(t,"UL",{});var R=i($);Pe=n(R,"LI",{});var Ra=i(Pe);X=n(Ra,"A",{href:!0,rel:!0});var lo=i(X);qt=r(lo,"Project Page"),lo.forEach(a),Nt=r(Ra,"."),Ra.forEach(a),jt=f(R),we=n(R,"LI",{});var Ya=i(we);Z=n(Ya,"A",{href:!0,rel:!0});var fo=i(Z);Gt=r(fo,"Paper"),fo.forEach(a),Ut=r(Ya,"."),Ya.forEach(a),Ft=f(R),ye=n(R,"LI",{});var Ka=i(ye);ee=n(Ka,"A",{href:!0,rel:!0});var po=i(ee);zt=r(po,"Original Code"),po.forEach(a),Vt=r(Ka,"."),Ka.forEach(a),Ht=f(R),De=n(R,"LI",{});var Ja=i(De);te=n(Ja,"A",{href:!0,rel:!0});var co=i(te);Bt=r(co,"Demo"),co.forEach(a),Wt=r(Ja,"."),Ja.forEach(a),R.forEach(a),ct=f(t),A=n(t,"H2",{class:!0});var Pt=i(A);U=n(Pt,"A",{id:!0,class:!0,href:!0});var uo=i(U);Le=n(uo,"SPAN",{});var ho=i(Le);P(ae.$$.fragment,ho),ho.forEach(a),uo.forEach(a),Rt=f(Pt),Oe=n(Pt,"SPAN",{});var mo=i(Oe);Yt=r(mo,"Available Pipelines:"),mo.forEach(a),Pt.forEach(a),ut=f(t),F=n(t,"TABLE",{});var wt=i(F);qe=n(wt,"THEAD",{});var go=i(qe);M=n(go,"TR",{});var xe=i(M);Ne=n(xe,"TH",{});var _o=i(Ne);Kt=r(_o,"Pipeline"),_o.forEach(a),Jt=f(xe),je=n(xe,"TH",{});var bo=i(je);Qt=r(bo,"Tasks"),bo.forEach(a),Xt=f(xe),ke=n(xe,"TH",{align:!0});var vo=i(ke);Zt=r(vo,"Demo"),vo.forEach(a),xe.forEach(a),go.forEach(a),ea=f(wt),Ge=n(wt,"TBODY",{});var Po=i(Ge);L=n(Po,"TR",{});var Ee=i(L);Ue=n(Ee,"TD",{});var wo=i(Ue);oe=n(wo,"A",{href:!0,rel:!0});var yo=i(oe);ta=r(yo,"StableDiffusionPanoramaPipeline"),yo.forEach(a),wo.forEach(a),aa=f(Ee),Fe=n(Ee,"TD",{});var Do=i(Fe);ze=n(Do,"EM",{});var ko=i(ze);oa=r(ko,"Text-Guided Panorama View Generation"),ko.forEach(a),Do.forEach(a),na=f(Ee),ne=n(Ee,"TD",{align:!0});var Qa=i(ne);ie=n(Qa,"A",{href:!0,rel:!0});var $o=i(ie);ia=r($o,"\u{1F917} Space"),$o.forEach(a),sa=r(Qa,")"),Qa.forEach(a),Ee.forEach(a),Po.forEach(a),wt.forEach(a),ht=f(t),O=n(t,"H2",{class:!0});var yt=i(O);z=n(yt,"A",{id:!0,class:!0,href:!0});var xo=i(z);Ve=n(xo,"SPAN",{});var Eo=i(Ve);P(se.$$.fragment,Eo),Eo.forEach(a),xo.forEach(a),ra=f(yt),He=n(yt,"SPAN",{});var So=i(He);la=r(So,"Usage example"),So.forEach(a),yt.forEach(a),mt=f(t),P(re.$$.fragment,t),gt=f(t),q=n(t,"H2",{class:!0});var Dt=i(q);V=n(Dt,"A",{id:!0,class:!0,href:!0});var To=i(V);Be=n(To,"SPAN",{});var Io=i(Be);P(le.$$.fragment,Io),Io.forEach(a),To.forEach(a),da=f(Dt),We=n(Dt,"SPAN",{});var Co=i(We);fa=r(Co,"StableDiffusionPanoramaPipeline"),Co.forEach(a),Dt.forEach(a),_t=f(t),h=n(t,"DIV",{class:!0});var _=i(h);P(de.$$.fragment,_),pa=f(_),Re=n(_,"P",{});var Ao=i(Re);ca=r(Ao,`Pipeline for text-to-image generation using \u201CMultiDiffusion: Fusing Diffusion Paths for Controlled Image
Generation\u201D.`),Ao.forEach(a),ua=f(_),fe=n(_,"P",{});var kt=i(fe);ha=r(kt,"This model inherits from "),$e=n(kt,"A",{href:!0});var Mo=i($e);ma=r(Mo,"DiffusionPipeline"),Mo.forEach(a),ga=r(kt,`. 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.).`),kt.forEach(a),_a=f(_),x=n(_,"P",{});var Y=i(x);ba=r(Y,"To generate panorama-like images, be sure to pass the "),Ye=n(Y,"CODE",{});var Lo=i(Ye);va=r(Lo,"width"),Lo.forEach(a),Pa=r(Y,` parameter accordingly when using the pipeline. Our
recommendation for the `),Ke=n(Y,"CODE",{});var Oo=i(Ke);wa=r(Oo,"width"),Oo.forEach(a),ya=r(Y," value is 2048. This is the default value of the "),Je=n(Y,"CODE",{});var qo=i(Je);Da=r(qo,"width"),qo.forEach(a),ka=r(Y," parameter for this pipeline."),Y.forEach(a),$a=f(_),T=n(_,"DIV",{class:!0});var Se=i(T);P(pe.$$.fragment,Se),xa=f(Se),Qe=n(Se,"P",{});var No=i(Qe);Ea=r(No,"Function invoked when calling the pipeline for generation."),No.forEach(a),Sa=f(Se),P(H.$$.fragment,Se),Se.forEach(a),Ta=f(_),B=n(_,"DIV",{class:!0});var $t=i(B);P(ce.$$.fragment,$t),Ia=f($t),ue=n($t,"P",{});var xt=i(ue);Ca=r(xt,"Disable sliced VAE decoding. If "),Xe=n(xt,"CODE",{});var jo=i(Xe);Aa=r(jo,"enable_vae_slicing"),jo.forEach(a),Ma=r(xt,` was previously invoked, this method will go back to
computing decoding in one step.`),xt.forEach(a),$t.forEach(a),La=f(_),W=n(_,"DIV",{class:!0});var Et=i(W);P(he.$$.fragment,Et),Oa=f(Et),N=n(Et,"P",{});var Te=i(N);qa=r(Te,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Ze=n(Te,"CODE",{});var Go=i(Ze);Na=r(Go,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Go.forEach(a),ja=r(Te,"forward"),et=n(Te,"CODE",{});var Uo=i(et);Ga=r(Uo,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Uo.forEach(a),Ua=r(Te,"enable_model_cpu_offload`, but performance is lower."),Te.forEach(a),Et.forEach(a),Fa=f(_),I=n(_,"DIV",{class:!0});var Ie=i(I);P(me.$$.fragment,Ie),za=f(Ie),tt=n(Ie,"P",{});var Fo=i(tt);Va=r(Fo,"Enable sliced VAE decoding."),Fo.forEach(a),Ha=f(Ie),at=n(Ie,"P",{});var zo=i(at);Ba=r(zo,`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),zo.forEach(a),Ie.forEach(a),_.forEach(a),this.h()},h(){l(m,"name","hf:doc:metadata"),l(m,"content",JSON.stringify(Zo)),l(g,"id","multidiffusion-fusing-diffusion-paths-for-controlled-image-generation"),l(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(g,"href","#multidiffusion-fusing-diffusion-paths-for-controlled-image-generation"),l(b,"class","relative group"),l(G,"id","overview"),l(G,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(G,"href","#overview"),l(C,"class","relative group"),l(Q,"href","https://arxiv.org/abs/2302.08113"),l(Q,"rel","nofollow"),l(X,"href","https://multidiffusion.github.io/"),l(X,"rel","nofollow"),l(Z,"href","https://arxiv.org/abs/2302.08113"),l(Z,"rel","nofollow"),l(ee,"href","https://github.com/omerbt/MultiDiffusion"),l(ee,"rel","nofollow"),l(te,"href","https://huggingface.co/spaces/weizmannscience/MultiDiffusion"),l(te,"rel","nofollow"),l(U,"id","available-pipelines"),l(U,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(U,"href","#available-pipelines"),l(A,"class","relative group"),l(ke,"align","center"),l(oe,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py"),l(oe,"rel","nofollow"),l(ie,"href","https://huggingface.co/spaces/weizmannscience/MultiDiffusion"),l(ie,"rel","nofollow"),l(ne,"align","center"),l(z,"id","usage-example"),l(z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(z,"href","#usage-example"),l(O,"class","relative group"),l(V,"id","diffusers.StableDiffusionPanoramaPipeline"),l(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(V,"href","#diffusers.StableDiffusionPanoramaPipeline"),l(q,"class","relative group"),l($e,"href","/docs/diffusers/v0.16.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),l(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,m),c(t,j,p),c(t,b,p),e(b,g),e(g,E),w(u,E,null),e(b,S),e(b,Ce),e(Ce,St),c(t,st,p),c(t,C,p),e(C,G),e(G,Ae),w(K,Ae,null),e(C,Tt),e(C,Me),e(Me,It),c(t,rt,p),c(t,J,p),e(J,Q),e(Q,Ct),e(J,At),c(t,lt,p),c(t,_e,p),e(_e,Mt),c(t,dt,p),c(t,be,p),e(be,Lt),c(t,ft,p),c(t,ve,p),e(ve,Ot),c(t,pt,p),c(t,$,p),e($,Pe),e(Pe,X),e(X,qt),e(Pe,Nt),e($,jt),e($,we),e(we,Z),e(Z,Gt),e(we,Ut),e($,Ft),e($,ye),e(ye,ee),e(ee,zt),e(ye,Vt),e($,Ht),e($,De),e(De,te),e(te,Bt),e(De,Wt),c(t,ct,p),c(t,A,p),e(A,U),e(U,Le),w(ae,Le,null),e(A,Rt),e(A,Oe),e(Oe,Yt),c(t,ut,p),c(t,F,p),e(F,qe),e(qe,M),e(M,Ne),e(Ne,Kt),e(M,Jt),e(M,je),e(je,Qt),e(M,Xt),e(M,ke),e(ke,Zt),e(F,ea),e(F,Ge),e(Ge,L),e(L,Ue),e(Ue,oe),e(oe,ta),e(L,aa),e(L,Fe),e(Fe,ze),e(ze,oa),e(L,na),e(L,ne),e(ne,ie),e(ie,ia),e(ne,sa),c(t,ht,p),c(t,O,p),e(O,z),e(z,Ve),w(se,Ve,null),e(O,ra),e(O,He),e(He,la),c(t,mt,p),w(re,t,p),c(t,gt,p),c(t,q,p),e(q,V),e(V,Be),w(le,Be,null),e(q,da),e(q,We),e(We,fa),c(t,_t,p),c(t,h,p),w(de,h,null),e(h,pa),e(h,Re),e(Re,ca),e(h,ua),e(h,fe),e(fe,ha),e(fe,$e),e($e,ma),e(fe,ga),e(h,_a),e(h,x),e(x,ba),e(x,Ye),e(Ye,va),e(x,Pa),e(x,Ke),e(Ke,wa),e(x,ya),e(x,Je),e(Je,Da),e(x,ka),e(h,$a),e(h,T),w(pe,T,null),e(T,xa),e(T,Qe),e(Qe,Ea),e(T,Sa),w(H,T,null),e(h,Ta),e(h,B),w(ce,B,null),e(B,Ia),e(B,ue),e(ue,Ca),e(ue,Xe),e(Xe,Aa),e(ue,Ma),e(h,La),e(h,W),w(he,W,null),e(W,Oa),e(W,N),e(N,qa),e(N,Ze),e(Ze,Na),e(N,ja),e(N,et),e(et,Ga),e(N,Ua),e(h,Fa),e(h,I),w(me,I,null),e(I,za),e(I,tt),e(tt,Va),e(I,Ha),e(I,at),e(at,Ba),bt=!0},p(t,[p]){const ge={};p&2&&(ge.$$scope={dirty:p,ctx:t}),H.$set(ge)},i(t){bt||(y(u.$$.fragment,t),y(K.$$.fragment,t),y(ae.$$.fragment,t),y(se.$$.fragment,t),y(re.$$.fragment,t),y(le.$$.fragment,t),y(de.$$.fragment,t),y(pe.$$.fragment,t),y(H.$$.fragment,t),y(ce.$$.fragment,t),y(he.$$.fragment,t),y(me.$$.fragment,t),bt=!0)},o(t){D(u.$$.fragment,t),D(K.$$.fragment,t),D(ae.$$.fragment,t),D(se.$$.fragment,t),D(re.$$.fragment,t),D(le.$$.fragment,t),D(de.$$.fragment,t),D(pe.$$.fragment,t),D(H.$$.fragment,t),D(ce.$$.fragment,t),D(he.$$.fragment,t),D(me.$$.fragment,t),bt=!1},d(t){a(m),t&&a(j),t&&a(b),k(u),t&&a(st),t&&a(C),k(K),t&&a(rt),t&&a(J),t&&a(lt),t&&a(_e),t&&a(dt),t&&a(be),t&&a(ft),t&&a(ve),t&&a(pt),t&&a($),t&&a(ct),t&&a(A),k(ae),t&&a(ut),t&&a(F),t&&a(ht),t&&a(O),k(se),t&&a(mt),k(re,t),t&&a(gt),t&&a(q),k(le),t&&a(_t),t&&a(h),k(de),k(pe),k(H),k(ce),k(he),k(me)}}}const Zo={local:"multidiffusion-fusing-diffusion-paths-for-controlled-image-generation",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"usage-example",title:"Usage example"},{local:"diffusers.StableDiffusionPanoramaPipeline",title:"StableDiffusionPanoramaPipeline"}],title:"MultiDiffusion: Fusing Diffusion Paths for Controlled Image Generation"};function en(it){return Yo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rn extends Ho{constructor(m){super();Bo(this,m,en,Xo,Wo,{})}}export{rn as default,Zo as metadata};
