import{S as ui,i as mi,s as hi,e as i,k as l,w as v,t as s,M as gi,c as o,d as n,m as d,a,x as w,h as r,b as p,G as e,g as b,y,q as M,o as L,B as $,v as _i,L as bi}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as Di}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as U}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as vi}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Un}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as wi}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function yi(me){let m,x,g,_,P;return{c(){m=i("p"),x=s("Make sure to check out the Stable Diffusion "),g=i("a"),_=s("Tips"),P=s(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),this.h()},l(f){m=o(f,"P",{});var D=a(m);x=r(D,"Make sure to check out the Stable Diffusion "),g=o(D,"A",{href:!0});var N=a(g);_=r(N,"Tips"),N.forEach(n),P=r(D," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),D.forEach(n),this.h()},h(){p(g,"href","overview#tips")},m(f,D){b(f,m,D),e(m,x),e(m,g),e(g,_),e(m,P)},d(f){f&&n(m)}}}function Mi(me){let m,x,g,_,P;return _=new vi({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkxETTNEUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uTERNM0RQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIySW50ZWwlMkZsZG0zZC00YyUyMiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBwaG90byUyMG9mJTIwYW4lMjBhc3Ryb25hdXQlMjByaWRpbmclMjBhJTIwaG9yc2UlMjBvbiUyMG1hcnMlMjIlMEFvdXRwdXQlMjAlM0QlMjBwaXBlKHByb21wdCklMEFyZ2JfaW1hZ2UlMkMlMjBkZXB0aF9pbWFnZSUyMCUzRCUyMG91dHB1dC5yZ2IlMkMlMjBvdXRwdXQuZGVwdGglMEFyZ2JfaW1hZ2UlNUIwJTVELnNhdmUoJTIyYXN0cm9uYXV0X2xkbTNkX3JnYi5qcGclMjIpJTBBZGVwdGhfaW1hZ2UlNUIwJTVELnNhdmUoJTIyYXN0cm9uYXV0X2xkbTNkX2RlcHRoLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionLDM3DPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionLDM3DPipeline.from_pretrained(<span class="hljs-string">&quot;Intel/ldm3d-4c&quot;</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 an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span>rgb_image, depth_image = output.rgb, output.depth
<span class="hljs-meta">&gt;&gt;&gt; </span>rgb_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;astronaut_ldm3d_rgb.jpg&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>depth_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;astronaut_ldm3d_depth.png&quot;</span>)`}}),{c(){m=i("p"),x=s("Examples:"),g=l(),v(_.$$.fragment)},l(f){m=o(f,"P",{});var D=a(m);x=r(D,"Examples:"),D.forEach(n),g=d(f),w(_.$$.fragment,f)},m(f,D){b(f,m,D),e(m,x),b(f,g,D),y(_,f,D),P=!0},p:bi,i(f){P||(M(_.$$.fragment,f),P=!0)},o(f){L(_.$$.fragment,f),P=!1},d(f){f&&n(m),f&&n(g),$(_,f)}}}function Li(me){let m,x,g,_,P,f,D,N,ht,Je,I,gt,Y,_t,bt,he,Dt,vt,Xe,ge,wt,Ye,_e,Q,yt,H,Mt,Lt,Qe,G,He,A,O,Se,K,$t,ke,Pt,Ke,c,ee,xt,Ie,Et,St,te,kt,be,It,Tt,At,Te,Ct,Ut,E,De,ve,Nt,Gt,Ot,we,ye,Bt,Rt,Vt,Me,Le,jt,Wt,Zt,B,$e,zt,Ft,Ae,qt,Jt,Xt,T,ne,Yt,Ce,Qt,Ht,R,Kt,V,ie,en,oe,tn,Ue,nn,on,an,j,ae,sn,se,rn,Ne,ln,dn,pn,W,re,fn,S,cn,Ge,un,mn,Oe,hn,gn,Be,_n,bn,Dn,Z,le,vn,Re,wn,yn,z,de,Mn,Ve,Ln,et,C,F,je,pe,$n,We,Pn,tt,k,fe,xn,Ze,En,Sn,q,ce,kn,ze,In,nt;return f=new Un({}),G=new Di({props:{$$slots:{default:[yi]},$$scope:{ctx:me}}}),K=new Un({}),ee=new U({props:{name:"class diffusers.StableDiffusionLDM3DPipeline",anchor:"diffusers.StableDiffusionLDM3DPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionLDM3DPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/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. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.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 more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L81"}}),ne=new U({props:{name:"__call__",anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 49"},{name:"guidance_scale",val:": float = 5.0"},{name:"negative_prompt",val:": typing.Union[typing.List[str], 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:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide image generation. If not defined, you need to pass <code>prompt_embeds</code>.`,name:"prompt"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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.StableDiffusionLDM3DPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 5.0) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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.StableDiffusionLDM3DPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 is called. If not specified, the callback is called at
every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionLDM3DPipeline.__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 in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>self.processor</code></a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L481",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is a list with the generated images and the
second element is a list of <code>bool</code>s indicating whether the corresponding generated image contains
\u201Cnot-safe-for-work\u201D (nsfw) content.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),R=new wi({props:{anchor:"diffusers.StableDiffusionLDM3DPipeline.__call__.example",$$slots:{default:[Mi]},$$scope:{ctx:me}}}),ie=new U({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionLDM3DPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L168"}}),ae=new U({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionLDM3DPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L185"}}),re=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionLDM3DPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L193"}}),le=new U({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionLDM3DPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L160"}}),de=new U({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionLDM3DPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L176"}}),pe=new Un({}),fe=new U({props:{name:"class diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput",parameters:[{name:"rgb",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"depth",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput.rgb",description:`<strong>rgb</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"rgb"},{anchor:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput.depth",description:`<strong>depth</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"depth"},{anchor:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_ldm3d.py#L60"}}),ce=new U({props:{name:"__call__",anchor:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}]}}),{c(){m=i("meta"),x=l(),g=i("h1"),_=i("a"),P=i("span"),v(f.$$.fragment),D=l(),N=i("span"),ht=s("Text-to-(RGB, depth)"),Je=l(),I=i("p"),gt=s("LDM3D was proposed in "),Y=i("a"),_t=s("LDM3D: Latent Diffusion Model for 3D"),bt=s(" by Gabriela Ben Melech Stan, Diana Wofk, Scottie Fox, Alex Redden, Will Saxton, Jean Yu, Estelle Aflalo, Shao-Yen Tseng, Fabio Nonato, Matthias Muller, and Vasudev Lal. LDM3D generates an image and a depth map from a given text prompt unlike the existing text-to-image diffusion models such as "),he=i("a"),Dt=s("Stable Diffusion"),vt=s(" which only generates an image. With almost the same number of parameters, LDM3D achieves to create a latent space that can compress both the RGB images and the depth maps."),Xe=l(),ge=i("p"),wt=s("The abstract from the paper is:"),Ye=l(),_e=i("p"),Q=i("em"),yt=s("This research paper proposes a Latent Diffusion Model for 3D (LDM3D) that generates both image and depth map data from a given text prompt, allowing users to generate RGBD images from text prompts. The LDM3D model is fine-tuned on a dataset of tuples containing an RGB image, depth map and caption, and validated through extensive experiments. We also develop an application called DepthFusion, which uses the generated RGB images and depth maps to create immersive and interactive 360-degree-view experiences using TouchDesigner. This technology has the potential to transform a wide range of industries, from entertainment and gaming to architecture and design. Overall, this paper presents a significant contribution to the field of generative AI and computer vision, and showcases the potential of LDM3D and DepthFusion to revolutionize content creation and digital experiences. A short video summarizing the approach can be found at "),H=i("a"),Mt=s("this url"),Lt=s("."),Qe=l(),v(G.$$.fragment),He=l(),A=i("h2"),O=i("a"),Se=i("span"),v(K.$$.fragment),$t=l(),ke=i("span"),Pt=s("StableDiffusionLDM3DPipeline"),Ke=l(),c=i("div"),v(ee.$$.fragment),xt=l(),Ie=i("p"),Et=s("Pipeline for text-to-image and 3D generation using LDM3D."),St=l(),te=i("p"),kt=s("This model inherits from "),be=i("a"),It=s("DiffusionPipeline"),Tt=s(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),At=l(),Te=i("p"),Ct=s("The pipeline also inherits the following loading methods:"),Ut=l(),E=i("ul"),De=i("li"),ve=i("a"),Nt=s("load_textual_inversion()"),Gt=s(" for loading textual inversion embeddings"),Ot=l(),we=i("li"),ye=i("a"),Bt=s("load_lora_weights()"),Rt=s(" for loading LoRA weights"),Vt=l(),Me=i("li"),Le=i("a"),jt=s("save_lora_weights()"),Wt=s(" for saving LoRA weights"),Zt=l(),B=i("li"),$e=i("a"),zt=s("from_single_file()"),Ft=s(" for loading "),Ae=i("code"),qt=s(".ckpt"),Jt=s(" files"),Xt=l(),T=i("div"),v(ne.$$.fragment),Yt=l(),Ce=i("p"),Qt=s("The call function to the pipeline for generation."),Ht=l(),v(R.$$.fragment),Kt=l(),V=i("div"),v(ie.$$.fragment),en=l(),oe=i("p"),tn=s("Disable sliced VAE decoding. If "),Ue=i("code"),nn=s("enable_vae_slicing"),on=s(` was previously enabled, this method will go back to
computing decoding in one step.`),an=l(),j=i("div"),v(ae.$$.fragment),sn=l(),se=i("p"),rn=s("Disable tiled VAE decoding. If "),Ne=i("code"),ln=s("enable_vae_tiling"),dn=s(` was previously enabled, this method will go back to
computing decoding in one step.`),pn=l(),W=i("div"),v(re.$$.fragment),fn=l(),S=i("p"),cn=s(`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),Ge=i("code"),un=s("forward"),mn=s(` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),Oe=i("code"),hn=s("enable_sequential_cpu_offload"),gn=s(`, but performance is much better due to the
iterative execution of the `),Be=i("code"),_n=s("unet"),bn=s("."),Dn=l(),Z=i("div"),v(le.$$.fragment),vn=l(),Re=i("p"),wn=s(`Enable sliced VAE decoding. 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.`),yn=l(),z=i("div"),v(de.$$.fragment),Mn=l(),Ve=i("p"),Ln=s(`Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
processing larger images.`),et=l(),C=i("h2"),F=i("a"),je=i("span"),v(pe.$$.fragment),$n=l(),We=i("span"),Pn=s("LDM3DPipelineOutput"),tt=l(),k=i("div"),v(fe.$$.fragment),xn=l(),Ze=i("p"),En=s("Output class for Stable Diffusion pipelines."),Sn=l(),q=i("div"),v(ce.$$.fragment),kn=l(),ze=i("p"),In=s("Call self as a function."),this.h()},l(t){const u=gi('[data-svelte="svelte-1phssyn"]',document.head);m=o(u,"META",{name:!0,content:!0}),u.forEach(n),x=d(t),g=o(t,"H1",{class:!0});var ue=a(g);_=o(ue,"A",{id:!0,class:!0,href:!0});var Fe=a(_);P=o(Fe,"SPAN",{});var Nn=a(P);w(f.$$.fragment,Nn),Nn.forEach(n),Fe.forEach(n),D=d(ue),N=o(ue,"SPAN",{});var Gn=a(N);ht=r(Gn,"Text-to-(RGB, depth)"),Gn.forEach(n),ue.forEach(n),Je=d(t),I=o(t,"P",{});var Pe=a(I);gt=r(Pe,"LDM3D was proposed in "),Y=o(Pe,"A",{href:!0,rel:!0});var On=a(Y);_t=r(On,"LDM3D: Latent Diffusion Model for 3D"),On.forEach(n),bt=r(Pe," by Gabriela Ben Melech Stan, Diana Wofk, Scottie Fox, Alex Redden, Will Saxton, Jean Yu, Estelle Aflalo, Shao-Yen Tseng, Fabio Nonato, Matthias Muller, and Vasudev Lal. LDM3D generates an image and a depth map from a given text prompt unlike the existing text-to-image diffusion models such as "),he=o(Pe,"A",{href:!0});var Bn=a(he);Dt=r(Bn,"Stable Diffusion"),Bn.forEach(n),vt=r(Pe," which only generates an image. With almost the same number of parameters, LDM3D achieves to create a latent space that can compress both the RGB images and the depth maps."),Pe.forEach(n),Xe=d(t),ge=o(t,"P",{});var Rn=a(ge);wt=r(Rn,"The abstract from the paper is:"),Rn.forEach(n),Ye=d(t),_e=o(t,"P",{});var Vn=a(_e);Q=o(Vn,"EM",{});var it=a(Q);yt=r(it,"This research paper proposes a Latent Diffusion Model for 3D (LDM3D) that generates both image and depth map data from a given text prompt, allowing users to generate RGBD images from text prompts. The LDM3D model is fine-tuned on a dataset of tuples containing an RGB image, depth map and caption, and validated through extensive experiments. We also develop an application called DepthFusion, which uses the generated RGB images and depth maps to create immersive and interactive 360-degree-view experiences using TouchDesigner. This technology has the potential to transform a wide range of industries, from entertainment and gaming to architecture and design. Overall, this paper presents a significant contribution to the field of generative AI and computer vision, and showcases the potential of LDM3D and DepthFusion to revolutionize content creation and digital experiences. A short video summarizing the approach can be found at "),H=o(it,"A",{href:!0,rel:!0});var jn=a(H);Mt=r(jn,"this url"),jn.forEach(n),Lt=r(it,"."),it.forEach(n),Vn.forEach(n),Qe=d(t),w(G.$$.fragment,t),He=d(t),A=o(t,"H2",{class:!0});var ot=a(A);O=o(ot,"A",{id:!0,class:!0,href:!0});var Wn=a(O);Se=o(Wn,"SPAN",{});var Zn=a(Se);w(K.$$.fragment,Zn),Zn.forEach(n),Wn.forEach(n),$t=d(ot),ke=o(ot,"SPAN",{});var zn=a(ke);Pt=r(zn,"StableDiffusionLDM3DPipeline"),zn.forEach(n),ot.forEach(n),Ke=d(t),c=o(t,"DIV",{class:!0});var h=a(c);w(ee.$$.fragment,h),xt=d(h),Ie=o(h,"P",{});var Fn=a(Ie);Et=r(Fn,"Pipeline for text-to-image and 3D generation using LDM3D."),Fn.forEach(n),St=d(h),te=o(h,"P",{});var at=a(te);kt=r(at,"This model inherits from "),be=o(at,"A",{href:!0});var qn=a(be);It=r(qn,"DiffusionPipeline"),qn.forEach(n),Tt=r(at,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),at.forEach(n),At=d(h),Te=o(h,"P",{});var Jn=a(Te);Ct=r(Jn,"The pipeline also inherits the following loading methods:"),Jn.forEach(n),Ut=d(h),E=o(h,"UL",{});var J=a(E);De=o(J,"LI",{});var Tn=a(De);ve=o(Tn,"A",{href:!0});var Xn=a(ve);Nt=r(Xn,"load_textual_inversion()"),Xn.forEach(n),Gt=r(Tn," for loading textual inversion embeddings"),Tn.forEach(n),Ot=d(J),we=o(J,"LI",{});var An=a(we);ye=o(An,"A",{href:!0});var Yn=a(ye);Bt=r(Yn,"load_lora_weights()"),Yn.forEach(n),Rt=r(An," for loading LoRA weights"),An.forEach(n),Vt=d(J),Me=o(J,"LI",{});var Cn=a(Me);Le=o(Cn,"A",{href:!0});var Qn=a(Le);jt=r(Qn,"save_lora_weights()"),Qn.forEach(n),Wt=r(Cn," for saving LoRA weights"),Cn.forEach(n),Zt=d(J),B=o(J,"LI",{});var qe=a(B);$e=o(qe,"A",{href:!0});var Hn=a($e);zt=r(Hn,"from_single_file()"),Hn.forEach(n),Ft=r(qe," for loading "),Ae=o(qe,"CODE",{});var Kn=a(Ae);qt=r(Kn,".ckpt"),Kn.forEach(n),Jt=r(qe," files"),qe.forEach(n),J.forEach(n),Xt=d(h),T=o(h,"DIV",{class:!0});var xe=a(T);w(ne.$$.fragment,xe),Yt=d(xe),Ce=o(xe,"P",{});var ei=a(Ce);Qt=r(ei,"The call function to the pipeline for generation."),ei.forEach(n),Ht=d(xe),w(R.$$.fragment,xe),xe.forEach(n),Kt=d(h),V=o(h,"DIV",{class:!0});var st=a(V);w(ie.$$.fragment,st),en=d(st),oe=o(st,"P",{});var rt=a(oe);tn=r(rt,"Disable sliced VAE decoding. If "),Ue=o(rt,"CODE",{});var ti=a(Ue);nn=r(ti,"enable_vae_slicing"),ti.forEach(n),on=r(rt,` was previously enabled, this method will go back to
computing decoding in one step.`),rt.forEach(n),st.forEach(n),an=d(h),j=o(h,"DIV",{class:!0});var lt=a(j);w(ae.$$.fragment,lt),sn=d(lt),se=o(lt,"P",{});var dt=a(se);rn=r(dt,"Disable tiled VAE decoding. If "),Ne=o(dt,"CODE",{});var ni=a(Ne);ln=r(ni,"enable_vae_tiling"),ni.forEach(n),dn=r(dt,` was previously enabled, this method will go back to
computing decoding in one step.`),dt.forEach(n),lt.forEach(n),pn=d(h),W=o(h,"DIV",{class:!0});var pt=a(W);w(re.$$.fragment,pt),fn=d(pt),S=o(pt,"P",{});var X=a(S);cn=r(X,`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),Ge=o(X,"CODE",{});var ii=a(Ge);un=r(ii,"forward"),ii.forEach(n),mn=r(X,` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),Oe=o(X,"CODE",{});var oi=a(Oe);hn=r(oi,"enable_sequential_cpu_offload"),oi.forEach(n),gn=r(X,`, but performance is much better due to the
iterative execution of the `),Be=o(X,"CODE",{});var ai=a(Be);_n=r(ai,"unet"),ai.forEach(n),bn=r(X,"."),X.forEach(n),pt.forEach(n),Dn=d(h),Z=o(h,"DIV",{class:!0});var ft=a(Z);w(le.$$.fragment,ft),vn=d(ft),Re=o(ft,"P",{});var si=a(Re);wn=r(si,`Enable sliced VAE decoding. 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.`),si.forEach(n),ft.forEach(n),yn=d(h),z=o(h,"DIV",{class:!0});var ct=a(z);w(de.$$.fragment,ct),Mn=d(ct),Ve=o(ct,"P",{});var ri=a(Ve);Ln=r(ri,`Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
processing larger images.`),ri.forEach(n),ct.forEach(n),h.forEach(n),et=d(t),C=o(t,"H2",{class:!0});var ut=a(C);F=o(ut,"A",{id:!0,class:!0,href:!0});var li=a(F);je=o(li,"SPAN",{});var di=a(je);w(pe.$$.fragment,di),di.forEach(n),li.forEach(n),$n=d(ut),We=o(ut,"SPAN",{});var pi=a(We);Pn=r(pi,"LDM3DPipelineOutput"),pi.forEach(n),ut.forEach(n),tt=d(t),k=o(t,"DIV",{class:!0});var Ee=a(k);w(fe.$$.fragment,Ee),xn=d(Ee),Ze=o(Ee,"P",{});var fi=a(Ze);En=r(fi,"Output class for Stable Diffusion pipelines."),fi.forEach(n),Sn=d(Ee),q=o(Ee,"DIV",{class:!0});var mt=a(q);w(ce.$$.fragment,mt),kn=d(mt),ze=o(mt,"P",{});var ci=a(ze);In=r(ci,"Call self as a function."),ci.forEach(n),mt.forEach(n),Ee.forEach(n),this.h()},h(){p(m,"name","hf:doc:metadata"),p(m,"content",JSON.stringify($i)),p(_,"id","texttorgb-depth"),p(_,"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"),p(_,"href","#texttorgb-depth"),p(g,"class","relative group"),p(Y,"href","https://huggingface.co/papers/2305.10853"),p(Y,"rel","nofollow"),p(he,"href","./stable_diffusion/overview"),p(H,"href","https://t.ly/tdi2"),p(H,"rel","nofollow"),p(O,"id","diffusers.StableDiffusionLDM3DPipeline"),p(O,"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"),p(O,"href","#diffusers.StableDiffusionLDM3DPipeline"),p(A,"class","relative group"),p(be,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),p(ve,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion"),p(ye,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights"),p(Le,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights"),p($e,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(F,"id","diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput"),p(F,"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"),p(F,"href","#diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput"),p(C,"class","relative group"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(k,"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,u){e(document.head,m),b(t,x,u),b(t,g,u),e(g,_),e(_,P),y(f,P,null),e(g,D),e(g,N),e(N,ht),b(t,Je,u),b(t,I,u),e(I,gt),e(I,Y),e(Y,_t),e(I,bt),e(I,he),e(he,Dt),e(I,vt),b(t,Xe,u),b(t,ge,u),e(ge,wt),b(t,Ye,u),b(t,_e,u),e(_e,Q),e(Q,yt),e(Q,H),e(H,Mt),e(Q,Lt),b(t,Qe,u),y(G,t,u),b(t,He,u),b(t,A,u),e(A,O),e(O,Se),y(K,Se,null),e(A,$t),e(A,ke),e(ke,Pt),b(t,Ke,u),b(t,c,u),y(ee,c,null),e(c,xt),e(c,Ie),e(Ie,Et),e(c,St),e(c,te),e(te,kt),e(te,be),e(be,It),e(te,Tt),e(c,At),e(c,Te),e(Te,Ct),e(c,Ut),e(c,E),e(E,De),e(De,ve),e(ve,Nt),e(De,Gt),e(E,Ot),e(E,we),e(we,ye),e(ye,Bt),e(we,Rt),e(E,Vt),e(E,Me),e(Me,Le),e(Le,jt),e(Me,Wt),e(E,Zt),e(E,B),e(B,$e),e($e,zt),e(B,Ft),e(B,Ae),e(Ae,qt),e(B,Jt),e(c,Xt),e(c,T),y(ne,T,null),e(T,Yt),e(T,Ce),e(Ce,Qt),e(T,Ht),y(R,T,null),e(c,Kt),e(c,V),y(ie,V,null),e(V,en),e(V,oe),e(oe,tn),e(oe,Ue),e(Ue,nn),e(oe,on),e(c,an),e(c,j),y(ae,j,null),e(j,sn),e(j,se),e(se,rn),e(se,Ne),e(Ne,ln),e(se,dn),e(c,pn),e(c,W),y(re,W,null),e(W,fn),e(W,S),e(S,cn),e(S,Ge),e(Ge,un),e(S,mn),e(S,Oe),e(Oe,hn),e(S,gn),e(S,Be),e(Be,_n),e(S,bn),e(c,Dn),e(c,Z),y(le,Z,null),e(Z,vn),e(Z,Re),e(Re,wn),e(c,yn),e(c,z),y(de,z,null),e(z,Mn),e(z,Ve),e(Ve,Ln),b(t,et,u),b(t,C,u),e(C,F),e(F,je),y(pe,je,null),e(C,$n),e(C,We),e(We,Pn),b(t,tt,u),b(t,k,u),y(fe,k,null),e(k,xn),e(k,Ze),e(Ze,En),e(k,Sn),e(k,q),y(ce,q,null),e(q,kn),e(q,ze),e(ze,In),nt=!0},p(t,[u]){const ue={};u&2&&(ue.$$scope={dirty:u,ctx:t}),G.$set(ue);const Fe={};u&2&&(Fe.$$scope={dirty:u,ctx:t}),R.$set(Fe)},i(t){nt||(M(f.$$.fragment,t),M(G.$$.fragment,t),M(K.$$.fragment,t),M(ee.$$.fragment,t),M(ne.$$.fragment,t),M(R.$$.fragment,t),M(ie.$$.fragment,t),M(ae.$$.fragment,t),M(re.$$.fragment,t),M(le.$$.fragment,t),M(de.$$.fragment,t),M(pe.$$.fragment,t),M(fe.$$.fragment,t),M(ce.$$.fragment,t),nt=!0)},o(t){L(f.$$.fragment,t),L(G.$$.fragment,t),L(K.$$.fragment,t),L(ee.$$.fragment,t),L(ne.$$.fragment,t),L(R.$$.fragment,t),L(ie.$$.fragment,t),L(ae.$$.fragment,t),L(re.$$.fragment,t),L(le.$$.fragment,t),L(de.$$.fragment,t),L(pe.$$.fragment,t),L(fe.$$.fragment,t),L(ce.$$.fragment,t),nt=!1},d(t){n(m),t&&n(x),t&&n(g),$(f),t&&n(Je),t&&n(I),t&&n(Xe),t&&n(ge),t&&n(Ye),t&&n(_e),t&&n(Qe),$(G,t),t&&n(He),t&&n(A),$(K),t&&n(Ke),t&&n(c),$(ee),$(ne),$(R),$(ie),$(ae),$(re),$(le),$(de),t&&n(et),t&&n(C),$(pe),t&&n(tt),t&&n(k),$(fe),$(ce)}}}const $i={local:"texttorgb-depth",sections:[{local:"diffusers.StableDiffusionLDM3DPipeline",title:"StableDiffusionLDM3DPipeline"},{local:"diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_ldm3d.LDM3DPipelineOutput",title:"LDM3DPipelineOutput"}],title:"Text-to-(RGB, depth)"};function Pi(me){return _i(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ai extends ui{constructor(m){super();mi(this,m,Pi,Li,hi,{})}}export{Ai as default,$i as metadata};
