Buckets:
| import{s as gi,o as hi,n as pt}from"../chunks/scheduler.8c3d61f6.js";import{S as yi,i as Mi,g as f,s,r as o,A as bi,h as u,f as n,c as a,j as et,u as r,x as g,k,y as w,a as i,v as p,d,t as c,w as m}from"../chunks/index.da70eac4.js";import{T as In}from"../chunks/Tip.1d9b8c37.js";import{D as rt}from"../chunks/Docstring.c021b19a.js";import{C as T}from"../chunks/CodeBlock.a9c4becf.js";import{E as _i}from"../chunks/ExampleCodeBlock.56b4589c.js";import{H as M,E as wi}from"../chunks/getInferenceSnippets.725ed3d4.js";function Ti(Z){let l,b="The SD3 pipeline uses three text encoders to generate an image. Model offloading is necessary in order for it to run on most commodity hardware. Please use the <code>torch.float16</code> data type for additional memory savings.";return{c(){l=f("p"),l.innerHTML=b},l(h){l=u(h,"P",{"data-svelte-h":!0}),g(l)!=="svelte-1abcova"&&(l.innerHTML=b)},m(h,y){i(h,l,y)},p:pt,d(h){h&&n(l)}}}function Ji(Z){let l,b='Check out <a href="../../../using-diffusers/ip_adapter">IP-Adapter</a> to learn more about how IP-Adapters work.';return{c(){l=f("p"),l.innerHTML=b},l(h){l=u(h,"P",{"data-svelte-h":!0}),g(l)!=="svelte-1xq17cf"&&(l.innerHTML=b)},m(h,y){i(h,l,y)},p:pt,d(h){h&&n(l)}}}function Ui(Z){let l,b="The prompt with the CLIP Text Encoders is still truncated to the 77 token limit.";return{c(){l=f("p"),l.textContent=b},l(h){l=u(h,"P",{"data-svelte-h":!0}),g(l)!=="svelte-1pfxyog"&&(l.textContent=b)},m(h,y){i(h,l,y)},p:pt,d(h){h&&n(l)}}}function Zi(Z){let l,b="The following example loads a checkpoint stored in a 8-bit floating point format which requires PyTorch 2.3 or later.";return{c(){l=f("p"),l.textContent=b},l(h){l=u(h,"P",{"data-svelte-h":!0}),g(l)!=="svelte-msx2hu"&&(l.textContent=b)},m(h,y){i(h,l,y)},p:pt,d(h){h&&n(l)}}}function ji(Z){let l,b="Examples:",h,y,j;return y=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMnNkMy5wbmclMjIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| <span class="hljs-meta">>>> </span>pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, torch_dtype=torch.float16 | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"A cat holding a sign that says hello world"</span> | |
| <span class="hljs-meta">>>> </span>image = pipe(prompt).images[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>image.save(<span class="hljs-string">"sd3.png"</span>)`,wrap:!1}}),{c(){l=f("p"),l.textContent=b,h=s(),o(y.$$.fragment)},l(_){l=u(_,"P",{"data-svelte-h":!0}),g(l)!=="svelte-kvfsh7"&&(l.textContent=b),h=a(_),r(y.$$.fragment,_)},m(_,I){i(_,l,I),i(_,h,I),p(y,_,I),j=!0},p:pt,i(_){j||(d(y.$$.fragment,_),j=!0)},o(_){c(y.$$.fragment,_),j=!1},d(_){_&&(n(l),n(h)),m(y,_)}}}function Ii(Z){let l,b,h,y,j,_,I,Rn='<img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/> <img alt="MPS" src="https://img.shields.io/badge/MPS-000000?style=flat&logo=apple&logoColor=white%22"/>',dt,V,Xn='Stable Diffusion 3 (SD3) was proposed in <a href="https://huggingface.co/papers/2403.03206" rel="nofollow">Scaling Rectified Flow Transformers for High-Resolution Image Synthesis</a> by Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Muller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, Dustin Podell, Tim Dockhorn, Zion English, Kyle Lacey, Alex Goodwin, Yannik Marek, and Robin Rombach.',ct,z,Yn="The abstract from the paper is:",mt,N,Vn="<em>Diffusion models create data from noise by inverting the forward paths of data towards noise and have emerged as a powerful generative modeling technique for high-dimensional, perceptual data such as images and videos. Rectified flow is a recent generative model formulation that connects data and noise in a straight line. Despite its better theoretical properties and conceptual simplicity, it is not yet decisively established as standard practice. In this work, we improve existing noise sampling techniques for training rectified flow models by biasing them towards perceptually relevant scales. Through a large-scale study, we demonstrate the superior performance of this approach compared to established diffusion formulations for high-resolution text-to-image synthesis. Additionally, we present a novel transformer-based architecture for text-to-image generation that uses separate weights for the two modalities and enables a bidirectional flow of information between image and text tokens, improving text comprehension typography, and human preference ratings. We demonstrate that this architecture follows predictable scaling trends and correlates lower validation loss to improved text-to-image synthesis as measured by various metrics and human evaluations.</em>",ft,E,ut,Q,zn='<em>As the model is gated, before using it with diffusers you first need to go to the <a href="https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers" rel="nofollow">Stable Diffusion 3 Medium Hugging Face page</a>, fill in the form and accept the gate. Once you are in, you need to login so that your system knows you’ve accepted the gate.</em>',gt,D,Nn="Use the command below to log in:",ht,F,yt,C,Mt,H,bt,P,En="<strong>Note:</strong> Stable Diffusion 3.5 can also be run using the SD3 pipeline, and all mentioned optimizations and techniques apply to it as well. In total there are three official models in the SD3 family:",_t,L,Qn='<li><a href="https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers" rel="nofollow"><code>stabilityai/stable-diffusion-3-medium-diffusers</code></a></li> <li><a href="https://huggingface.co/stabilityai/stable-diffusion-3-5-large" rel="nofollow"><code>stabilityai/stable-diffusion-3.5-large</code></a></li> <li><a href="https://huggingface.co/stabilityai/stable-diffusion-3-5-large-turbo" rel="nofollow"><code>stabilityai/stable-diffusion-3.5-large-turbo</code></a></li>',wt,q,Tt,A,Dn="An IP-Adapter lets you prompt SD3 with images, in addition to the text prompt. This is especially useful when describing complex concepts that are difficult to articulate through text alone and you have reference images. To load and use an IP-Adapter, you need:",Jt,K,Fn="<li><code>image_encoder</code>: Pre-trained vision model used to obtain image features, usually a CLIP image encoder.</li> <li><code>feature_extractor</code>: Image processor that prepares the input image for the chosen <code>image_encoder</code>.</li> <li><code>ip_adapter_id</code>: Checkpoint containing parameters of image cross attention layers and image projection.</li>",Ut,O,Hn="IP-Adapters are trained for a specific model architecture, so they also work in finetuned variations of the base model. You can use the <code>~SD3IPAdapterMixin.set_ip_adapter_scale</code> function to adjust how strongly the output aligns with the image prompt. The higher the value, the more closely the model follows the image prompt. A default value of 0.5 is typically a good balance, ensuring the model considers both the text and image prompts equally.",Zt,ee,jt,x,Pn='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sd3_ip_adapter_example.png"/> <figcaption class="mt-2 text-sm text-center text-gray-500">IP-Adapter examples with prompt "a cat"</figcaption>',It,$,Bt,te,vt,ne,Ln="SD3 uses three text encoders, one of which is the very large T5-XXL model. This makes it challenging to run the model on GPUs with less than 24GB of VRAM, even when using <code>fp16</code> precision. The following section outlines a few memory optimizations in Diffusers that make it easier to run SD3 on low resource hardware.",Wt,ie,Gt,se,qn="The most basic memory optimization available in Diffusers allows you to offload the components of the model to CPU during inference in order to save memory, while seeing a slight increase in inference latency. Model offloading will only move a model component onto the GPU when it needs to be executed, while keeping the remaining components on the CPU.",kt,ae,Ct,le,xt,oe,An="Removing the memory-intensive 4.7B parameter T5-XXL text encoder during inference can significantly decrease the memory requirements for SD3 with only a slight loss in performance.",$t,re,St,pe,Rt,de,Kn="We can leverage the <code>bitsandbytes</code> library to load and quantize the T5-XXL text encoder to 8-bit precision. This allows you to keep using all three text encoders while only slightly impacting performance.",Xt,ce,On="First install the <code>bitsandbytes</code> library.",Yt,me,Vt,fe,ei="Then load the T5-XXL model using the <code>BitsAndBytesConfig</code>.",zt,ue,Nt,ge,ti='You can find the end-to-end script <a href="https://gist.github.com/sayakpaul/82acb5976509851f2db1a83456e504f1" rel="nofollow">here</a>.',Et,he,Qt,ye,Dt,Me,ni="Using compiled components in the SD3 pipeline can speed up inference by as much as 4X. The following code snippet demonstrates how to compile the Transformer and VAE components of the SD3 pipeline.",Ft,be,Ht,_e,ii='Check out the full script <a href="https://gist.github.com/sayakpaul/508d89d7aad4f454900813da5d42ca97" rel="nofollow">here</a>.',Pt,we,Lt,Te,si="Quantization helps reduce the memory requirements of very large models by storing model weights in a lower precision data type. However, quantization may have varying impact on video quality depending on the video model.",qt,Je,ai='Refer to the <a href="../../quantization/overview">Quantization</a> overview to learn more about supported quantization backends and selecting a quantization backend that supports your use case. The example below demonstrates how to load a quantized <a href="/docs/diffusers/pr_12036/en/api/pipelines/stable_diffusion/stable_diffusion_3#diffusers.StableDiffusion3Pipeline">StableDiffusion3Pipeline</a> for inference with bitsandbytes.',At,Ue,Kt,Ze,Ot,je,li="By default, the T5 Text Encoder prompt uses a maximum sequence length of <code>256</code>. This can be adjusted by setting the <code>max_sequence_length</code> to accept fewer or more tokens. Keep in mind that longer sequences require additional resources and result in longer generation times, such as during batch inference.",en,Ie,tn,Be,nn,ve,oi="You can send a different prompt to the CLIP Text Encoders and the T5 Text Encoder to prevent the prompt from being truncated by the CLIP Text Encoders and to improve generation.",sn,S,an,We,ln,Ge,on,ke,ri='Tiny AutoEncoder for Stable Diffusion (TAESD3) is a tiny distilled version of Stable Diffusion 3’s VAE by <a href="https://github.com/madebyollin/taesd" rel="nofollow">Ollin Boer Bohan</a> that can decode <a href="/docs/diffusers/pr_12036/en/api/pipelines/stable_diffusion/stable_diffusion_3#diffusers.StableDiffusion3Pipeline">StableDiffusion3Pipeline</a> latents almost instantly.',rn,Ce,pi="To use with Stable Diffusion 3:",pn,xe,dn,$e,cn,Se,di="The <code>SD3Transformer2DModel</code> and <code>StableDiffusion3Pipeline</code> classes support loading the original checkpoints via the <code>from_single_file</code> method. This method allows you to load the original checkpoint files that were used to train the models.",mn,Re,fn,Xe,un,Ye,gn,Ve,hn,ze,yn,Ne,Mn,R,bn,Ee,_n,Qe,wn,De,Tn,Fe,Jn,J,He,Bn,B,Pe,vn,tt,ci="Function invoked when calling the pipeline for generation.",Wn,X,Gn,Y,Le,kn,nt,mi="Encodes the given image into a feature representation using a pre-trained image encoder.",Cn,it,qe,xn,v,Ae,$n,st,fi="Prepares image embeddings for use in the IP-Adapter.",Sn,at,ui="Either <code>ip_adapter_image</code> or <code>ip_adapter_image_embeds</code> must be passed.",Un,Ke,Zn,lt,jn;return j=new M({props:{title:"Stable Diffusion 3",local:"stable-diffusion-3",headingTag:"h1"}}),E=new M({props:{title:"Usage Example",local:"usage-example",headingTag:"h2"}}),F=new T({props:{code:"aGYlMjBhdXRoJTIwbG9naW4=",highlighted:"hf auth login",wrap:!1}}),C=new In({props:{$$slots:{default:[Ti]},$$scope:{ctx:Z}}}),H=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMiUyMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyOCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDcuMCUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlLnNhdmUoJTIyc2QzX2hlbGxvX3dvcmxkLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| pipe = StableDiffusion3Pipeline.from_pretrained(<span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, torch_dtype=torch.float16) | |
| pipe.to(<span class="hljs-string">"cuda"</span>) | |
| image = pipe( | |
| prompt=<span class="hljs-string">"a photo of a cat holding a sign that says hello world"</span>, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| height=<span class="hljs-number">1024</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| guidance_scale=<span class="hljs-number">7.0</span>, | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3_hello_world.png"</span>)`,wrap:!1}}),q=new M({props:{title:"Image Prompting with IP-Adapters",local:"image-prompting-with-ip-adapters",headingTag:"h2"}}),ee=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNpZ2xpcFZpc2lvbk1vZGVsJTJDJTIwU2lnbGlwSW1hZ2VQcm9jZXNzb3IlMEElMEFpbWFnZV9lbmNvZGVyX2lkJTIwJTNEJTIwJTIyZ29vZ2xlJTJGc2lnbGlwLXNvNDAwbS1wYXRjaDE0LTM4NCUyMiUwQWlwX2FkYXB0ZXJfaWQlMjAlM0QlMjAlMjJJbnN0YW50WCUyRlNEMy41LUxhcmdlLUlQLUFkYXB0ZXIlMjIlMEElMEFmZWF0dXJlX2V4dHJhY3RvciUyMCUzRCUyMFNpZ2xpcEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBpbWFnZV9lbmNvZGVyX2lkJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQWltYWdlX2VuY29kZXIlMjAlM0QlMjBTaWdsaXBWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwaW1hZ2VfZW5jb2Rlcl9pZCUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIwJTIyY3VkYSUyMiklMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMy41LWxhcmdlJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwZmVhdHVyZV9leHRyYWN0b3IlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMGltYWdlX2VuY29kZXIlM0RpbWFnZV9lbmNvZGVyJTJDJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXBpcGUubG9hZF9pcF9hZGFwdGVyKGlwX2FkYXB0ZXJfaWQpJTBBcGlwZS5zZXRfaXBfYWRhcHRlcl9zY2FsZSgwLjYpJTBBJTBBcmVmX2ltZyUyMCUzRCUyMEltYWdlLm9wZW4oJTIyaW1hZ2UuanBnJTIyKS5jb252ZXJ0KCdSR0InKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjB3aWR0aCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0QxMDI0JTJDJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyYSUyMGNhdCUyMiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMmxvd3JlcyUyQyUyMGxvdyUyMHF1YWxpdHklMkMlMjB3b3JzdCUyMHF1YWxpdHklMjIlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSUyMCUyMCUyMCUyMGlwX2FkYXB0ZXJfaW1hZ2UlM0RyZWZfaW1nJTBBKS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjJyZXN1bHQuanBnJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SiglipVisionModel, SiglipImageProcessor | |
| image_encoder_id = <span class="hljs-string">"google/siglip-so400m-patch14-384"</span> | |
| ip_adapter_id = <span class="hljs-string">"InstantX/SD3.5-Large-IP-Adapter"</span> | |
| feature_extractor = SiglipImageProcessor.from_pretrained( | |
| image_encoder_id, | |
| torch_dtype=torch.float16 | |
| ) | |
| image_encoder = SiglipVisionModel.from_pretrained( | |
| image_encoder_id, | |
| torch_dtype=torch.float16 | |
| ).to( <span class="hljs-string">"cuda"</span>) | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3.5-large"</span>, | |
| torch_dtype=torch.float16, | |
| feature_extractor=feature_extractor, | |
| image_encoder=image_encoder, | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipe.load_ip_adapter(ip_adapter_id) | |
| pipe.set_ip_adapter_scale(<span class="hljs-number">0.6</span>) | |
| ref_img = Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">"image.jpg"</span>).convert(<span class="hljs-string">'RGB'</span>) | |
| image = pipe( | |
| width=<span class="hljs-number">1024</span>, | |
| height=<span class="hljs-number">1024</span>, | |
| prompt=<span class="hljs-string">"a cat"</span>, | |
| negative_prompt=<span class="hljs-string">"lowres, low quality, worst quality"</span>, | |
| num_inference_steps=<span class="hljs-number">24</span>, | |
| guidance_scale=<span class="hljs-number">5.0</span>, | |
| ip_adapter_image=ref_img | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"result.jpg"</span>)`,wrap:!1}}),$=new In({props:{$$slots:{default:[Ji]},$$scope:{ctx:Z}}}),te=new M({props:{title:"Memory Optimisations for SD3",local:"memory-optimisations-for-sd3",headingTag:"h2"}}),ie=new M({props:{title:"Running Inference with Model Offloading",local:"running-inference-with-model-offloading",headingTag:"h3"}}),ae=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMiUyMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyOCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDcuMCUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlLnNhdmUoJTIyc2QzX2hlbGxvX3dvcmxkLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| pipe = StableDiffusion3Pipeline.from_pretrained(<span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, torch_dtype=torch.float16) | |
| pipe.enable_model_cpu_offload() | |
| image = pipe( | |
| prompt=<span class="hljs-string">"a photo of a cat holding a sign that says hello world"</span>, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| height=<span class="hljs-number">1024</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| guidance_scale=<span class="hljs-number">7.0</span>, | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3_hello_world.png"</span>)`,wrap:!1}}),le=new M({props:{title:"Dropping the T5 Text Encoder during Inference",local:"dropping-the-t5-text-encoder-during-inference",headingTag:"h3"}}),re=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2Rlcl8zJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplcl8zJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwaGVsbG8lMjB3b3JsZCUyMiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMiUyMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyOCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDcuMCUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlLnNhdmUoJTIyc2QzX2hlbGxvX3dvcmxkLW5vLVQ1LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, | |
| text_encoder_3=<span class="hljs-literal">None</span>, | |
| tokenizer_3=<span class="hljs-literal">None</span>, | |
| torch_dtype=torch.float16 | |
| ) | |
| pipe.to(<span class="hljs-string">"cuda"</span>) | |
| image = pipe( | |
| prompt=<span class="hljs-string">"a photo of a cat holding a sign that says hello world"</span>, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| height=<span class="hljs-number">1024</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| guidance_scale=<span class="hljs-number">7.0</span>, | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3_hello_world-no-T5.png"</span>)`,wrap:!1}}),pe=new M({props:{title:"Using a Quantized Version of the T5 Text Encoder",local:"using-a-quantized-version-of-the-t5-text-encoder",headingTag:"h3"}}),me=new T({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcw==",highlighted:"pip install bitsandbytes",wrap:!1}}),ue=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFQ1RW5jb2Rlck1vZGVsJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzhiaXQlM0RUcnVlKSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUwQXRleHRfZW5jb2RlciUyMCUzRCUyMFQ1RW5jb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUwQSUyMCUyMCUyMCUyMHN1YmZvbGRlciUzRCUyMnRleHRfZW5jb2Rlcl8zJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWclMkMlMEEpJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlMkMlMEElMjAlMjAlMjAlMjB0ZXh0X2VuY29kZXJfMyUzRHRleHRfZW5jb2RlciUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJiYWxhbmNlZCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIwaG9sZGluZyUyMGElMjBzaWduJTIwdGhhdCUyMHNheXMlMjBoZWxsbyUyMHdvcmxkJTIyJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEJTIyJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI4JTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNEMTAyNCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNEMTAyNCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENy4wJTJDJTBBKS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjJzZDNfaGVsbG9fd29ybGQtOGJpdC1UNS5wbmclMjIp",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5EncoderModel, BitsAndBytesConfig | |
| quantization_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>) | |
| model_id = <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span> | |
| text_encoder = T5EncoderModel.from_pretrained( | |
| model_id, | |
| subfolder=<span class="hljs-string">"text_encoder_3"</span>, | |
| quantization_config=quantization_config, | |
| ) | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| model_id, | |
| text_encoder_3=text_encoder, | |
| device_map=<span class="hljs-string">"balanced"</span>, | |
| torch_dtype=torch.float16 | |
| ) | |
| image = pipe( | |
| prompt=<span class="hljs-string">"a photo of a cat holding a sign that says hello world"</span>, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| height=<span class="hljs-number">1024</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| guidance_scale=<span class="hljs-number">7.0</span>, | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3_hello_world-8bit-T5.png"</span>)`,wrap:!1}}),he=new M({props:{title:"Performance Optimizations for SD3",local:"performance-optimizations-for-sd3",headingTag:"h2"}}),ye=new M({props:{title:"Using Torch Compile to Speed Up Inference",local:"using-torch-compile-to-speed-up-inference",headingTag:"h3"}}),be=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBdG9yY2guc2V0X2Zsb2F0MzJfbWF0bXVsX3ByZWNpc2lvbiglMjJoaWdoJTIyKSUwQSUwQXRvcmNoLl9pbmR1Y3Rvci5jb25maWcuY29udl8xeDFfYXNfbW0lMjAlM0QlMjBUcnVlJTBBdG9yY2guX2luZHVjdG9yLmNvbmZpZy5jb29yZGluYXRlX2Rlc2NlbnRfdHVuaW5nJTIwJTNEJTIwVHJ1ZSUwQXRvcmNoLl9pbmR1Y3Rvci5jb25maWcuZXBpbG9ndWVfZnVzaW9uJTIwJTNEJTIwRmFsc2UlMEF0b3JjaC5faW5kdWN0b3IuY29uZmlnLmNvb3JkaW5hdGVfZGVzY2VudF9jaGVja19hbGxfZGlyZWN0aW9ucyUyMCUzRCUyMFRydWUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMy1tZWRpdW0tZGlmZnVzZXJzJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGUuc2V0X3Byb2dyZXNzX2Jhcl9jb25maWcoZGlzYWJsZSUzRFRydWUpJTBBJTBBcGlwZS50cmFuc2Zvcm1lci50byhtZW1vcnlfZm9ybWF0JTNEdG9yY2guY2hhbm5lbHNfbGFzdCklMEFwaXBlLnZhZS50byhtZW1vcnlfZm9ybWF0JTNEdG9yY2guY2hhbm5lbHNfbGFzdCklMEElMEFwaXBlLnRyYW5zZm9ybWVyJTIwJTNEJTIwdG9yY2guY29tcGlsZShwaXBlLnRyYW5zZm9ybWVyJTJDJTIwbW9kZSUzRCUyMm1heC1hdXRvdHVuZSUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUpJTBBcGlwZS52YWUuZGVjb2RlJTIwJTNEJTIwdG9yY2guY29tcGlsZShwaXBlLnZhZS5kZWNvZGUlMkMlMjBtb2RlJTNEJTIybWF4LWF1dG90dW5lJTIyJTJDJTIwZnVsbGdyYXBoJTNEVHJ1ZSklMEElMEElMjMlMjBXYXJtJTIwVXAlMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjBob2xkaW5nJTIwYSUyMHNpZ24lMjB0aGF0JTIwc2F5cyUyMGhlbGxvJTIwd29ybGQlMjIlMEFmb3IlMjBfJTIwaW4lMjByYW5nZSgzKSUzQSUwQSUyMCUyMCUyMCUyMF8lMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGdlbmVyYXRvciUzRHRvcmNoLm1hbnVhbF9zZWVkKDEpKSUwQSUwQSUyMyUyMFJ1biUyMEluZmVyZW5jZSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0R0b3JjaC5tYW51YWxfc2VlZCgxKSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyc2QzX2hlbGxvX3dvcmxkLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| torch.set_float32_matmul_precision(<span class="hljs-string">"high"</span>) | |
| torch._inductor.config.conv_1x1_as_mm = <span class="hljs-literal">True</span> | |
| torch._inductor.config.coordinate_descent_tuning = <span class="hljs-literal">True</span> | |
| torch._inductor.config.epilogue_fusion = <span class="hljs-literal">False</span> | |
| torch._inductor.config.coordinate_descent_check_all_directions = <span class="hljs-literal">True</span> | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, | |
| torch_dtype=torch.float16 | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipe.set_progress_bar_config(disable=<span class="hljs-literal">True</span>) | |
| pipe.transformer.to(memory_format=torch.channels_last) | |
| pipe.vae.to(memory_format=torch.channels_last) | |
| pipe.transformer = torch.<span class="hljs-built_in">compile</span>(pipe.transformer, mode=<span class="hljs-string">"max-autotune"</span>, fullgraph=<span class="hljs-literal">True</span>) | |
| pipe.vae.decode = torch.<span class="hljs-built_in">compile</span>(pipe.vae.decode, mode=<span class="hljs-string">"max-autotune"</span>, fullgraph=<span class="hljs-literal">True</span>) | |
| <span class="hljs-comment"># Warm Up</span> | |
| prompt = <span class="hljs-string">"a photo of a cat holding a sign that says hello world"</span> | |
| <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">3</span>): | |
| _ = pipe(prompt=prompt, generator=torch.manual_seed(<span class="hljs-number">1</span>)) | |
| <span class="hljs-comment"># Run Inference</span> | |
| image = pipe(prompt=prompt, generator=torch.manual_seed(<span class="hljs-number">1</span>)).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3_hello_world.png"</span>)`,wrap:!1}}),we=new M({props:{title:"Quantization",local:"quantization",headingTag:"h2"}}),Ue=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQml0c0FuZEJ5dGVzQ29uZmlnJTIwYXMlMjBEaWZmdXNlcnNCaXRzQW5kQnl0ZXNDb25maWclMkMlMjBTRDNUcmFuc2Zvcm1lcjJETW9kZWwlMkMlMjBTdGFibGVEaWZmdXNpb24zUGlwZWxpbmUlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQml0c0FuZEJ5dGVzQ29uZmlnJTIwYXMlMjBCaXRzQW5kQnl0ZXNDb25maWclMkMlMjBUNUVuY29kZXJNb2RlbCUwQSUwQXF1YW50X2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzhiaXQlM0RUcnVlKSUwQXRleHRfZW5jb2Rlcl84Yml0JTIwJTNEJTIwVDVFbmNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi0zLjUtbGFyZ2UlMjIlMkMlMEElMjAlMjAlMjAlMjBzdWJmb2xkZXIlM0QlMjJ0ZXh0X2VuY29kZXJfMyUyMiUyQyUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudF9jb25maWclMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpJTBBJTBBcXVhbnRfY29uZmlnJTIwJTNEJTIwRGlmZnVzZXJzQml0c0FuZEJ5dGVzQ29uZmlnKGxvYWRfaW5fOGJpdCUzRFRydWUpJTBBdHJhbnNmb3JtZXJfOGJpdCUyMCUzRCUyMFNEM1RyYW5zZm9ybWVyMkRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMuNS1sYXJnZSUyMiUyQyUwQSUyMCUyMCUyMCUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50X2NvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSklMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMuNS1sYXJnZSUyMiUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2RlciUzRHRleHRfZW5jb2Rlcl84Yml0JTJDJTBBJTIwJTIwJTIwJTIwdHJhbnNmb3JtZXIlM0R0cmFuc2Zvcm1lcl84Yml0JTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRCUyMmJhbGFuY2VkJTIyJTJDJTBBKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjB0aW55JTIwYXN0cm9uYXV0JTIwaGF0Y2hpbmclMjBmcm9tJTIwYW4lMjBlZ2clMjBvbiUyMHRoZSUyMG1vb24lMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyOCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENy4wKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJzZDMucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BitsAndBytesConfig <span class="hljs-keyword">as</span> DiffusersBitsAndBytesConfig, SD3Transformer2DModel, StableDiffusion3Pipeline | |
| <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig <span class="hljs-keyword">as</span> BitsAndBytesConfig, T5EncoderModel | |
| quant_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>) | |
| text_encoder_8bit = T5EncoderModel.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3.5-large"</span>, | |
| subfolder=<span class="hljs-string">"text_encoder_3"</span>, | |
| quantization_config=quant_config, | |
| torch_dtype=torch.float16, | |
| ) | |
| quant_config = DiffusersBitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>) | |
| transformer_8bit = SD3Transformer2DModel.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3.5-large"</span>, | |
| subfolder=<span class="hljs-string">"transformer"</span>, | |
| quantization_config=quant_config, | |
| torch_dtype=torch.float16, | |
| ) | |
| pipeline = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3.5-large"</span>, | |
| text_encoder=text_encoder_8bit, | |
| transformer=transformer_8bit, | |
| torch_dtype=torch.float16, | |
| device_map=<span class="hljs-string">"balanced"</span>, | |
| ) | |
| prompt = <span class="hljs-string">"a tiny astronaut hatching from an egg on the moon"</span> | |
| image = pipeline(prompt, num_inference_steps=<span class="hljs-number">28</span>, guidance_scale=<span class="hljs-number">7.0</span>).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd3.png"</span>)`,wrap:!1}}),Ze=new M({props:{title:"Using Long Prompts with the T5 Text Encoder",local:"using-long-prompts-with-the-t5-text-encoder",headingTag:"h2"}}),Ie=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHdoaW1zaWNhbCUyMGFuZCUyMGNyZWF0aXZlJTIwaW1hZ2UlMjBkZXBpY3RpbmclMjBhJTIwaHlicmlkJTIwY3JlYXR1cmUlMjB0aGF0JTIwaXMlMjBhJTIwbWl4JTIwb2YlMjBhJTIwd2FmZmxlJTIwYW5kJTIwYSUyMGhpcHBvcG90YW11cyUyQyUyMGJhc2tpbmclMjBpbiUyMGElMjByaXZlciUyMG9mJTIwbWVsdGVkJTIwYnV0dGVyJTIwYW1pZHN0JTIwYSUyMGJyZWFrZmFzdC10aGVtZWQlMjBsYW5kc2NhcGUuJTIwSXQlMjBmZWF0dXJlcyUyMHRoZSUyMGRpc3RpbmN0aXZlJTJDJTIwYnVsa3klMjBib2R5JTIwc2hhcGUlMjBvZiUyMGElMjBoaXBwby4lMjBIb3dldmVyJTJDJTIwaW5zdGVhZCUyMG9mJTIwdGhlJTIwdXN1YWwlMjBncmV5JTIwc2tpbiUyQyUyMHRoZSUyMGNyZWF0dXJlJUUyJTgwJTk5cyUyMGJvZHklMjByZXNlbWJsZXMlMjBhJTIwZ29sZGVuLWJyb3duJTJDJTIwY3Jpc3B5JTIwd2FmZmxlJTIwZnJlc2glMjBvZmYlMjB0aGUlMjBncmlkZGxlLiUyMFRoZSUyMHNraW4lMjBpcyUyMHRleHR1cmVkJTIwd2l0aCUyMHRoZSUyMGZhbWlsaWFyJTIwZ3JpZCUyMHBhdHRlcm4lMjBvZiUyMGElMjB3YWZmbGUlMkMlMjBlYWNoJTIwc3F1YXJlJTIwZmlsbGVkJTIwd2l0aCUyMGElMjBnbGlzdGVuaW5nJTIwc2hlZW4lMjBvZiUyMHN5cnVwLiUyMFRoZSUyMGVudmlyb25tZW50JTIwY29tYmluZXMlMjB0aGUlMjBuYXR1cmFsJTIwaGFiaXRhdCUyMG9mJTIwYSUyMGhpcHBvJTIwd2l0aCUyMGVsZW1lbnRzJTIwb2YlMjBhJTIwYnJlYWtmYXN0JTIwdGFibGUlMjBzZXR0aW5nJTJDJTIwYSUyMHJpdmVyJTIwb2YlMjB3YXJtJTJDJTIwbWVsdGVkJTIwYnV0dGVyJTJDJTIwd2l0aCUyMG92ZXJzaXplZCUyMHV0ZW5zaWxzJTIwb3IlMjBwbGF0ZXMlMjBwZWVraW5nJTIwb3V0JTIwZnJvbSUyMHRoZSUyMGx1c2glMkMlMjBwYW5jYWtlLWxpa2UlMjBmb2xpYWdlJTIwaW4lMjB0aGUlMjBiYWNrZ3JvdW5kJTJDJTIwYSUyMHRvd2VyaW5nJTIwcGVwcGVyJTIwbWlsbCUyMHN0YW5kaW5nJTIwaW4lMjBmb3IlMjBhJTIwdHJlZS4lMjAlMjBBcyUyMHRoZSUyMHN1biUyMHJpc2VzJTIwaW4lMjB0aGlzJTIwZmFudGFzdGljYWwlMjB3b3JsZCUyQyUyMGl0JTIwY2FzdHMlMjBhJTIwd2FybSUyQyUyMGJ1dHRlcnklMjBnbG93JTIwb3ZlciUyMHRoZSUyMHNjZW5lLiUyMFRoZSUyMGNyZWF0dXJlJTJDJTIwY29udGVudCUyMGluJTIwaXRzJTIwYnV0dGVyJTIwcml2ZXIlMkMlMjBsZXRzJTIwb3V0JTIwYSUyMHlhd24uJTIwTmVhcmJ5JTJDJTIwYSUyMGZsb2NrJTIwb2YlMjBiaXJkcyUyMHRha2UlMjBmbGlnaHQlMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEJTIyJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI4JTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q0LjUlMkMlMEElMjAlMjAlMjAlMjBtYXhfc2VxdWVuY2VfbGVuZ3RoJTNENTEyJTJDJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`prompt = <span class="hljs-string">"A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature’s body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree. As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"</span> | |
| image = pipe( | |
| prompt=prompt, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| guidance_scale=<span class="hljs-number">4.5</span>, | |
| max_sequence_length=<span class="hljs-number">512</span>, | |
| ).images[<span class="hljs-number">0</span>]`,wrap:!1}}),Be=new M({props:{title:"Sending a different prompt to the T5 Text Encoder",local:"sending-a-different-prompt-to-the-t5-text-encoder",headingTag:"h3"}}),S=new In({props:{$$slots:{default:[Ui]},$$scope:{ctx:Z}}}),We=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHdoaW1zaWNhbCUyMGFuZCUyMGNyZWF0aXZlJTIwaW1hZ2UlMjBkZXBpY3RpbmclMjBhJTIwaHlicmlkJTIwY3JlYXR1cmUlMjB0aGF0JTIwaXMlMjBhJTIwbWl4JTIwb2YlMjBhJTIwd2FmZmxlJTIwYW5kJTIwYSUyMGhpcHBvcG90YW11cyUyQyUyMGJhc2tpbmclMjBpbiUyMGElMjByaXZlciUyMG9mJTIwbWVsdGVkJTIwYnV0dGVyJTIwYW1pZHN0JTIwYSUyMGJyZWFrZmFzdC10aGVtZWQlMjBsYW5kc2NhcGUuJTIwQSUyMHJpdmVyJTIwb2YlMjB3YXJtJTJDJTIwbWVsdGVkJTIwYnV0dGVyJTJDJTIwcGFuY2FrZS1saWtlJTIwZm9saWFnZSUyMGluJTIwdGhlJTIwYmFja2dyb3VuZCUyQyUyMGElMjB0b3dlcmluZyUyMHBlcHBlciUyMG1pbGwlMjBzdGFuZGluZyUyMGluJTIwZm9yJTIwYSUyMHRyZWUuJTIyJTBBJTBBcHJvbXB0XzMlMjAlM0QlMjAlMjJBJTIwd2hpbXNpY2FsJTIwYW5kJTIwY3JlYXRpdmUlMjBpbWFnZSUyMGRlcGljdGluZyUyMGElMjBoeWJyaWQlMjBjcmVhdHVyZSUyMHRoYXQlMjBpcyUyMGElMjBtaXglMjBvZiUyMGElMjB3YWZmbGUlMjBhbmQlMjBhJTIwaGlwcG9wb3RhbXVzJTJDJTIwYmFza2luZyUyMGluJTIwYSUyMHJpdmVyJTIwb2YlMjBtZWx0ZWQlMjBidXR0ZXIlMjBhbWlkc3QlMjBhJTIwYnJlYWtmYXN0LXRoZW1lZCUyMGxhbmRzY2FwZS4lMjBJdCUyMGZlYXR1cmVzJTIwdGhlJTIwZGlzdGluY3RpdmUlMkMlMjBidWxreSUyMGJvZHklMjBzaGFwZSUyMG9mJTIwYSUyMGhpcHBvLiUyMEhvd2V2ZXIlMkMlMjBpbnN0ZWFkJTIwb2YlMjB0aGUlMjB1c3VhbCUyMGdyZXklMjBza2luJTJDJTIwdGhlJTIwY3JlYXR1cmUlRTIlODAlOTlzJTIwYm9keSUyMHJlc2VtYmxlcyUyMGElMjBnb2xkZW4tYnJvd24lMkMlMjBjcmlzcHklMjB3YWZmbGUlMjBmcmVzaCUyMG9mZiUyMHRoZSUyMGdyaWRkbGUuJTIwVGhlJTIwc2tpbiUyMGlzJTIwdGV4dHVyZWQlMjB3aXRoJTIwdGhlJTIwZmFtaWxpYXIlMjBncmlkJTIwcGF0dGVybiUyMG9mJTIwYSUyMHdhZmZsZSUyQyUyMGVhY2glMjBzcXVhcmUlMjBmaWxsZWQlMjB3aXRoJTIwYSUyMGdsaXN0ZW5pbmclMjBzaGVlbiUyMG9mJTIwc3lydXAuJTIwVGhlJTIwZW52aXJvbm1lbnQlMjBjb21iaW5lcyUyMHRoZSUyMG5hdHVyYWwlMjBoYWJpdGF0JTIwb2YlMjBhJTIwaGlwcG8lMjB3aXRoJTIwZWxlbWVudHMlMjBvZiUyMGElMjBicmVha2Zhc3QlMjB0YWJsZSUyMHNldHRpbmclMkMlMjBhJTIwcml2ZXIlMjBvZiUyMHdhcm0lMkMlMjBtZWx0ZWQlMjBidXR0ZXIlMkMlMjB3aXRoJTIwb3ZlcnNpemVkJTIwdXRlbnNpbHMlMjBvciUyMHBsYXRlcyUyMHBlZWtpbmclMjBvdXQlMjBmcm9tJTIwdGhlJTIwbHVzaCUyQyUyMHBhbmNha2UtbGlrZSUyMGZvbGlhZ2UlMjBpbiUyMHRoZSUyMGJhY2tncm91bmQlMkMlMjBhJTIwdG93ZXJpbmclMjBwZXBwZXIlMjBtaWxsJTIwc3RhbmRpbmclMjBpbiUyMGZvciUyMGElMjB0cmVlLiUyMCUyMEFzJTIwdGhlJTIwc3VuJTIwcmlzZXMlMjBpbiUyMHRoaXMlMjBmYW50YXN0aWNhbCUyMHdvcmxkJTJDJTIwaXQlMjBjYXN0cyUyMGElMjB3YXJtJTJDJTIwYnV0dGVyeSUyMGdsb3clMjBvdmVyJTIwdGhlJTIwc2NlbmUuJTIwVGhlJTIwY3JlYXR1cmUlMkMlMjBjb250ZW50JTIwaW4lMjBpdHMlMjBidXR0ZXIlMjByaXZlciUyQyUyMGxldHMlMjBvdXQlMjBhJTIweWF3bi4lMjBOZWFyYnklMkMlMjBhJTIwZmxvY2slMjBvZiUyMGJpcmRzJTIwdGFrZSUyMGZsaWdodCUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfMyUzRHByb21wdF8zJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEJTIyJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI4JTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q0LjUlMkMlMEElMjAlMjAlMjAlMjBtYXhfc2VxdWVuY2VfbGVuZ3RoJTNENTEyJTJDJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`prompt = <span class="hljs-string">"A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. A river of warm, melted butter, pancake-like foliage in the background, a towering pepper mill standing in for a tree."</span> | |
| prompt_3 = <span class="hljs-string">"A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature’s body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree. As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"</span> | |
| image = pipe( | |
| prompt=prompt, | |
| prompt_3=prompt_3, | |
| negative_prompt=<span class="hljs-string">""</span>, | |
| num_inference_steps=<span class="hljs-number">28</span>, | |
| guidance_scale=<span class="hljs-number">4.5</span>, | |
| max_sequence_length=<span class="hljs-number">512</span>, | |
| ).images[<span class="hljs-number">0</span>]`,wrap:!1}}),Ge=new M({props:{title:"Tiny AutoEncoder for Stable Diffusion 3",local:"tiny-autoencoder-for-stable-diffusion-3",headingTag:"h2"}}),xe=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTJDJTIwQXV0b2VuY29kZXJUaW55JTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMtbWVkaXVtLWRpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlLnZhZSUyMCUzRCUyMEF1dG9lbmNvZGVyVGlueS5mcm9tX3ByZXRyYWluZWQoJTIybWFkZWJ5b2xsaW4lMkZ0YWVzZDMlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJzbGljZSUyMG9mJTIwZGVsaWNpb3VzJTIwTmV3JTIwWW9yay1zdHlsZSUyMGJlcnJ5JTIwY2hlZXNlY2FrZSUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNoZWVzZWNha2UucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline, AutoencoderTiny | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, torch_dtype=torch.float16 | |
| ) | |
| pipe.vae = AutoencoderTiny.from_pretrained(<span class="hljs-string">"madebyollin/taesd3"</span>, torch_dtype=torch.float16) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"slice of delicious New York-style berry cheesecake"</span> | |
| image = pipe(prompt, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"cheesecake.png"</span>)`,wrap:!1}}),$e=new M({props:{title:"Loading the original checkpoints via from_single_file",local:"loading-the-original-checkpoints-via-fromsinglefile",headingTag:"h2"}}),Re=new M({props:{title:"Loading the original checkpoints for the SD3Transformer2DModel",local:"loading-the-original-checkpoints-for-the-sd3transformer2dmodel",headingTag:"h2"}}),Xe=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFNEM1RyYW5zZm9ybWVyMkRNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwU0QzVHJhbnNmb3JtZXIyRE1vZGVsLmZyb21fc2luZ2xlX2ZpbGUoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi0zLW1lZGl1bSUyRmJsb2IlMkZtYWluJTJGc2QzX21lZGl1bS5zYWZldGVuc29ycyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SD3Transformer2DModel | |
| model = SD3Transformer2DModel.from_single_file(<span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/sd3_medium.safetensors"</span>)`,wrap:!1}}),Ye=new M({props:{title:"Loading the single checkpoint for the StableDiffusion3Pipeline",local:"loading-the-single-checkpoint-for-the-stablediffusion3pipeline",headingTag:"h2"}}),Ve=new M({props:{title:"Loading the single file checkpoint without T5",local:"loading-the-single-file-checkpoint-without-t5",headingTag:"h3"}}),ze=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3NpbmdsZV9maWxlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMy1tZWRpdW0lMkZibG9iJTJGbWFpbiUyRnNkM19tZWRpdW1faW5jbF9jbGlwcy5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2Rlcl8zJTNETm9uZSUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUyMmElMjBwaWN0dXJlJTIwb2YlMjBhJTIwY2F0JTIwaG9sZGluZyUyMGElMjBzaWduJTIwdGhhdCUyMHNheXMlMjBoZWxsbyUyMHdvcmxkJTIyKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSgnc2QzLXNpbmdsZS1maWxlLnBuZycp",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| pipe = StableDiffusion3Pipeline.from_single_file( | |
| <span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/sd3_medium_incl_clips.safetensors"</span>, | |
| torch_dtype=torch.float16, | |
| text_encoder_3=<span class="hljs-literal">None</span> | |
| ) | |
| pipe.enable_model_cpu_offload() | |
| image = pipe(<span class="hljs-string">"a picture of a cat holding a sign that says hello world"</span>).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">'sd3-single-file.png'</span>)`,wrap:!1}}),Ne=new M({props:{title:"Loading the single file checkpoint with T5",local:"loading-the-single-file-checkpoint-with-t5",headingTag:"h3"}}),R=new In({props:{warning:!1,$$slots:{default:[Zi]},$$scope:{ctx:Z}}}),Ee=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbjNQaXBlbGluZS5mcm9tX3NpbmdsZV9maWxlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMy1tZWRpdW0lMkZibG9iJTJGbWFpbiUyRnNkM19tZWRpdW1faW5jbF9jbGlwc190NXh4bGZwOC5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUyMmElMjBwaWN0dXJlJTIwb2YlMjBhJTIwY2F0JTIwaG9sZGluZyUyMGElMjBzaWduJTIwdGhhdCUyMHNheXMlMjBoZWxsbyUyMHdvcmxkJTIyKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSgnc2QzLXNpbmdsZS1maWxlLXQ1LWZwOC5wbmcnKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusion3Pipeline | |
| pipe = StableDiffusion3Pipeline.from_single_file( | |
| <span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/sd3_medium_incl_clips_t5xxlfp8.safetensors"</span>, | |
| torch_dtype=torch.float16, | |
| ) | |
| pipe.enable_model_cpu_offload() | |
| image = pipe(<span class="hljs-string">"a picture of a cat holding a sign that says hello world"</span>).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">'sd3-single-file-t5-fp8.png'</span>)`,wrap:!1}}),Qe=new M({props:{title:"Loading the single file checkpoint for the Stable Diffusion 3.5 Transformer Model",local:"loading-the-single-file-checkpoint-for-the-stable-diffusion-35-transformer-model",headingTag:"h3"}}),De=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU0QzVHJhbnNmb3JtZXIyRE1vZGVsJTJDJTIwU3RhYmxlRGlmZnVzaW9uM1BpcGVsaW5lJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBTRDNUcmFuc2Zvcm1lcjJETW9kZWwuZnJvbV9zaW5nbGVfZmlsZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTMuNS1sYXJnZS10dXJibyUyRmJsb2IlMkZtYWluJTJGc2QzLjVfbGFyZ2Uuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTJDJTBBKSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb24zUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi0zLjUtbGFyZ2UlMjIlMkMlMEElMjAlMjAlMjAlMjB0cmFuc2Zvcm1lciUzRHRyYW5zZm9ybWVyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUyMmElMjBjYXQlMjBob2xkaW5nJTIwYSUyMHNpZ24lMjB0aGF0JTIwc2F5cyUyMGhlbGxvJTIwd29ybGQlMjIpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMnNkMzUucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SD3Transformer2DModel, StableDiffusion3Pipeline | |
| transformer = SD3Transformer2DModel.from_single_file( | |
| <span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-3.5-large-turbo/blob/main/sd3.5_large.safetensors"</span>, | |
| torch_dtype=torch.bfloat16, | |
| ) | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3.5-large"</span>, | |
| transformer=transformer, | |
| torch_dtype=torch.bfloat16, | |
| ) | |
| pipe.enable_model_cpu_offload() | |
| image = pipe(<span class="hljs-string">"a cat holding a sign that says hello world"</span>).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"sd35.png"</span>)`,wrap:!1}}),Fe=new M({props:{title:"StableDiffusion3Pipeline",local:"diffusers.StableDiffusion3Pipeline",headingTag:"h2"}}),He=new rt({props:{name:"class diffusers.StableDiffusion3Pipeline",anchor:"diffusers.StableDiffusion3Pipeline",parameters:[{name:"transformer",val:": SD3Transformer2DModel"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"text_encoder_2",val:": CLIPTextModelWithProjection"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"text_encoder_3",val:": T5EncoderModel"},{name:"tokenizer_3",val:": T5TokenizerFast"},{name:"image_encoder",val:": SiglipVisionModel = None"},{name:"feature_extractor",val:": SiglipImageProcessor = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusion3Pipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/pr_12036/en/api/models/sd3_transformer2d#diffusers.SD3Transformer2DModel">SD3Transformer2DModel</a>) — | |
| Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.`,name:"transformer"},{anchor:"diffusers.StableDiffusion3Pipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_12036/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a>) — | |
| A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.StableDiffusion3Pipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_12036/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) — | |
| Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusion3Pipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) — | |
| <a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModelWithProjection" rel="nofollow">CLIP</a>, | |
| specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant, | |
| with an additional added projection layer that is initialized with a diagonal matrix with the <code>hidden_size</code> | |
| as its dimension.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusion3Pipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<code>CLIPTextModelWithProjection</code>) — | |
| <a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModelWithProjection" rel="nofollow">CLIP</a>, | |
| specifically the | |
| <a href="https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k" rel="nofollow">laion/CLIP-ViT-bigG-14-laion2B-39B-b160k</a> | |
| variant.`,name:"text_encoder_2"},{anchor:"diffusers.StableDiffusion3Pipeline.text_encoder_3",description:`<strong>text_encoder_3</strong> (<code>T5EncoderModel</code>) — | |
| Frozen text-encoder. Stable Diffusion 3 uses | |
| <a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically the | |
| <a href="https://huggingface.co/google/t5-v1_1-xxl" rel="nofollow">t5-v1_1-xxl</a> variant.`,name:"text_encoder_3"},{anchor:"diffusers.StableDiffusion3Pipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) — | |
| 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.StableDiffusion3Pipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<code>CLIPTokenizer</code>) — | |
| Second 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_2"},{anchor:"diffusers.StableDiffusion3Pipeline.tokenizer_3",description:`<strong>tokenizer_3</strong> (<code>T5TokenizerFast</code>) — | |
| Tokenizer of class | |
| <a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5Tokenizer</a>.`,name:"tokenizer_3"},{anchor:"diffusers.StableDiffusion3Pipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>SiglipVisionModel</code>, <em>optional</em>) — | |
| Pre-trained Vision Model for IP Adapter.`,name:"image_encoder"},{anchor:"diffusers.StableDiffusion3Pipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>SiglipImageProcessor</code>, <em>optional</em>) — | |
| Image processor for IP Adapter.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/vr_12036/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L148"}}),Pe=new rt({props:{name:"__call__",anchor:"diffusers.StableDiffusion3Pipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"prompt_2",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"prompt_3",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 28"},{name:"sigmas",val:": typing.Optional[typing.List[float]] = None"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"negative_prompt_2",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"negative_prompt_3",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{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:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"ip_adapter_image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor], NoneType] = None"},{name:"ip_adapter_image_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"joint_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"clip_skip",val:": typing.Optional[int] = None"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int, typing.Dict], NoneType]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 256"},{name:"skip_guidance_layers",val:": typing.List[int] = None"},{name:"skip_layer_guidance_scale",val:": float = 2.8"},{name:"skip_layer_guidance_stop",val:": float = 0.2"},{name:"skip_layer_guidance_start",val:": float = 0.01"},{name:"mu",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusion3Pipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| 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.StableDiffusion3Pipeline.__call__.prompt_2",description:`<strong>prompt_2</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to be sent to <code>tokenizer_2</code> and <code>text_encoder_2</code>. If not defined, <code>prompt</code> is | |
| will be used instead`,name:"prompt_2"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.prompt_3",description:`<strong>prompt_3</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to be sent to <code>tokenizer_3</code> and <code>text_encoder_3</code>. If not defined, <code>prompt</code> is | |
| will be used instead`,name:"prompt_3"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) — | |
| The height in pixels of the generated image. This is set to 1024 by default for the best results.`,name:"height"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) — | |
| The width in pixels of the generated image. This is set to 1024 by default for the best results.`,name:"width"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) — | |
| 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.StableDiffusion3Pipeline.__call__.sigmas",description:`<strong>sigmas</strong> (<code>List[float]</code>, <em>optional</em>) — | |
| Custom sigmas to use for the denoising process with schedulers which support a <code>sigmas</code> argument in | |
| their <code>set_timesteps</code> method. If not defined, the default behavior when <code>num_inference_steps</code> is passed | |
| will be used.`,name:"sigmas"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.0) — | |
| Guidance scale as defined in <a href="https://huggingface.co/papers/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://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting | |
| <code>guidance_scale > 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.StableDiffusion3Pipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<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. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is | |
| less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.negative_prompt_2",description:`<strong>negative_prompt_2</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts not to guide the image generation to be sent to <code>tokenizer_2</code> and | |
| <code>text_encoder_2</code>. If not defined, <code>negative_prompt</code> is used instead`,name:"negative_prompt_2"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.negative_prompt_3",description:`<strong>negative_prompt_3</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts not to guide the image generation to be sent to <code>tokenizer_3</code> and | |
| <code>text_encoder_3</code>. If not defined, <code>negative_prompt</code> is used instead`,name:"negative_prompt_3"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) — | |
| 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.StableDiffusion3Pipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — | |
| 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.StableDiffusion3Pipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<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.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<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.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — | |
| Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. | |
| If not provided, pooled text embeddings will be generated from <code>prompt</code> input argument.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — | |
| Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt | |
| weighting. If not provided, pooled negative_prompt_embeds will be generated from <code>negative_prompt</code> | |
| input argument.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.ip_adapter_image",description:`<strong>ip_adapter_image</strong> (<code>PipelineImageInput</code>, <em>optional</em>) — | |
| Optional image input to work with IP Adapters.`,name:"ip_adapter_image"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.ip_adapter_image_embeds",description:`<strong>ip_adapter_image_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated image embeddings for IP-Adapter. Should be a tensor of shape <code>(batch_size, num_images, emb_dim)</code>. It should contain the negative image embedding if <code>do_classifier_free_guidance</code> is set to | |
| <code>True</code>. If not provided, embeddings are computed from the <code>ip_adapter_image</code> input argument.`,name:"ip_adapter_image_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| 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.StableDiffusion3Pipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>~pipelines.stable_diffusion_3.StableDiffusion3PipelineOutput</code> instead of | |
| a plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.joint_attention_kwargs",description:`<strong>joint_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) — | |
| 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:"joint_attention_kwargs"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) — | |
| 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.StableDiffusion3Pipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) — | |
| 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"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.max_sequence_length",description:"<strong>max_sequence_length</strong> (<code>int</code> defaults to 256) — Maximum sequence length to use with the <code>prompt</code>.",name:"max_sequence_length"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.skip_guidance_layers",description:`<strong>skip_guidance_layers</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| A list of integers that specify layers to skip during guidance. If not provided, all layers will be | |
| used for guidance. If provided, the guidance will only be applied to the layers specified in the list. | |
| Recommended value by StabiltyAI for Stable Diffusion 3.5 Medium is [7, 8, 9].`,name:"skip_guidance_layers"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.skip_layer_guidance_scale",description:`<strong>skip_layer_guidance_scale</strong> (<code>int</code>, <em>optional</em>) — The scale of the guidance for the layers specified in | |
| <code>skip_guidance_layers</code>. The guidance will be applied to the layers specified in <code>skip_guidance_layers</code> | |
| with a scale of <code>skip_layer_guidance_scale</code>. The guidance will be applied to the rest of the layers | |
| with a scale of <code>1</code>.`,name:"skip_layer_guidance_scale"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.skip_layer_guidance_stop",description:`<strong>skip_layer_guidance_stop</strong> (<code>int</code>, <em>optional</em>) — The step at which the guidance for the layers specified in | |
| <code>skip_guidance_layers</code> will stop. The guidance will be applied to the layers specified in | |
| <code>skip_guidance_layers</code> until the fraction specified in <code>skip_layer_guidance_stop</code>. Recommended value by | |
| StabiltyAI for Stable Diffusion 3.5 Medium is 0.2.`,name:"skip_layer_guidance_stop"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.skip_layer_guidance_start",description:`<strong>skip_layer_guidance_start</strong> (<code>int</code>, <em>optional</em>) — The step at which the guidance for the layers specified in | |
| <code>skip_guidance_layers</code> will start. The guidance will be applied to the layers specified in | |
| <code>skip_guidance_layers</code> from the fraction specified in <code>skip_layer_guidance_start</code>. Recommended value by | |
| StabiltyAI for Stable Diffusion 3.5 Medium is 0.01.`,name:"skip_layer_guidance_start"},{anchor:"diffusers.StableDiffusion3Pipeline.__call__.mu",description:"<strong>mu</strong> (<code>float</code>, <em>optional</em>) — <code>mu</code> value used for <code>dynamic_shifting</code>.",name:"mu"}],source:"https://github.com/huggingface/diffusers/blob/vr_12036/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L772",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~pipelines.stable_diffusion_3.StableDiffusion3PipelineOutput</code> if <code>return_dict</code> is True, otherwise a | |
| <code>tuple</code>. When returning a tuple, the first element is a list with the generated images.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~pipelines.stable_diffusion_3.StableDiffusion3PipelineOutput</code> or <code>tuple</code></p> | |
| `}}),X=new _i({props:{anchor:"diffusers.StableDiffusion3Pipeline.__call__.example",$$slots:{default:[ji]},$$scope:{ctx:Z}}}),Le=new rt({props:{name:"encode_image",anchor:"diffusers.StableDiffusion3Pipeline.encode_image",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]"},{name:"device",val:": device"}],parametersDescription:[{anchor:"diffusers.StableDiffusion3Pipeline.encode_image.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>) — | |
| Input image to be encoded.`,name:"image"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_image.device",description:`<strong>device</strong> — (<code>torch.device</code>): | |
| Torch device.`,name:"device"}],source:"https://github.com/huggingface/diffusers/blob/vr_12036/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L696",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The encoded image feature representation.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>torch.Tensor</code></p> | |
| `}}),qe=new rt({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"prompt_2",val:": typing.Union[str, typing.List[str]]"},{name:"prompt_3",val:": typing.Union[str, typing.List[str]]"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"negative_prompt_2",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"negative_prompt_3",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clip_skip",val:": typing.Optional[int] = None"},{name:"max_sequence_length",val:": int = 256"},{name:"lora_scale",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| prompt to be encoded`,name:"prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.prompt_2",description:`<strong>prompt_2</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to be sent to the <code>tokenizer_2</code> and <code>text_encoder_2</code>. If not defined, <code>prompt</code> is | |
| used in all text-encoders`,name:"prompt_2"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.prompt_3",description:`<strong>prompt_3</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to be sent to the <code>tokenizer_3</code> and <code>text_encoder_3</code>. If not defined, <code>prompt</code> is | |
| used in all text-encoders`,name:"prompt_3"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.device",description:`<strong>device</strong> — (<code>torch.device</code>): | |
| torch device`,name:"device"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>) — | |
| number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>) — | |
| whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<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. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is | |
| less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.negative_prompt_2",description:`<strong>negative_prompt_2</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts not to guide the image generation to be sent to <code>tokenizer_2</code> and | |
| <code>text_encoder_2</code>. If not defined, <code>negative_prompt</code> is used in all the text-encoders.`,name:"negative_prompt_2"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.negative_prompt_3",description:`<strong>negative_prompt_3</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) — | |
| The prompt or prompts not to guide the image generation to be sent to <code>tokenizer_3</code> and | |
| <code>text_encoder_3</code>. If not defined, <code>negative_prompt</code> is used in all the text-encoders.`,name:"negative_prompt_3"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<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.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<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.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — | |
| Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. | |
| If not provided, pooled text embeddings will be generated from <code>prompt</code> input argument.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — | |
| Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt | |
| weighting. If not provided, pooled negative_prompt_embeds will be generated from <code>negative_prompt</code> | |
| input argument.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.clip_skip",description:`<strong>clip_skip</strong> (<code>int</code>, <em>optional</em>) — | |
| Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that | |
| the output of the pre-final layer will be used for computing the prompt embeddings.`,name:"clip_skip"},{anchor:"diffusers.StableDiffusion3Pipeline.encode_prompt.lora_scale",description:`<strong>lora_scale</strong> (<code>float</code>, <em>optional</em>) — | |
| A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`,name:"lora_scale"}],source:"https://github.com/huggingface/diffusers/blob/vr_12036/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L344"}}),Ae=new rt({props:{name:"prepare_ip_adapter_image_embeds",anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds",parameters:[{name:"ip_adapter_image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor], NoneType] = None"},{name:"ip_adapter_image_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds.ip_adapter_image",description:`<strong>ip_adapter_image</strong> (<code>PipelineImageInput</code>, <em>optional</em>) — | |
| The input image to extract features from for IP-Adapter.`,name:"ip_adapter_image"},{anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds.ip_adapter_image_embeds",description:`<strong>ip_adapter_image_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Precomputed image embeddings.`,name:"ip_adapter_image_embeds"},{anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds.device",description:`<strong>device</strong> — (<code>torch.device</code>, <em>optional</em>): | |
| Torch device.`,name:"device"},{anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, defaults to 1) — | |
| Number of images that should be generated per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusion3Pipeline.prepare_ip_adapter_image_embeds.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, defaults to True) — | |
| Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"}],source:"https://github.com/huggingface/diffusers/blob/vr_12036/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L716"}}),Ke=new wi({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md"}}),{c(){l=f("meta"),b=s(),h=f("p"),y=s(),o(j.$$.fragment),_=s(),I=f("div"),I.innerHTML=Rn,dt=s(),V=f("p"),V.innerHTML=Xn,ct=s(),z=f("p"),z.textContent=Yn,mt=s(),N=f("p"),N.innerHTML=Vn,ft=s(),o(E.$$.fragment),ut=s(),Q=f("p"),Q.innerHTML=zn,gt=s(),D=f("p"),D.textContent=Nn,ht=s(),o(F.$$.fragment),yt=s(),o(C.$$.fragment),Mt=s(),o(H.$$.fragment),bt=s(),P=f("p"),P.innerHTML=En,_t=s(),L=f("ul"),L.innerHTML=Qn,wt=s(),o(q.$$.fragment),Tt=s(),A=f("p"),A.textContent=Dn,Jt=s(),K=f("ul"),K.innerHTML=Fn,Ut=s(),O=f("p"),O.innerHTML=Hn,Zt=s(),o(ee.$$.fragment),jt=s(),x=f("div"),x.innerHTML=Pn,It=s(),o($.$$.fragment),Bt=s(),o(te.$$.fragment),vt=s(),ne=f("p"),ne.innerHTML=Ln,Wt=s(),o(ie.$$.fragment),Gt=s(),se=f("p"),se.textContent=qn,kt=s(),o(ae.$$.fragment),Ct=s(),o(le.$$.fragment),xt=s(),oe=f("p"),oe.textContent=An,$t=s(),o(re.$$.fragment),St=s(),o(pe.$$.fragment),Rt=s(),de=f("p"),de.innerHTML=Kn,Xt=s(),ce=f("p"),ce.innerHTML=On,Yt=s(),o(me.$$.fragment),Vt=s(),fe=f("p"),fe.innerHTML=ei,zt=s(),o(ue.$$.fragment),Nt=s(),ge=f("p"),ge.innerHTML=ti,Et=s(),o(he.$$.fragment),Qt=s(),o(ye.$$.fragment),Dt=s(),Me=f("p"),Me.textContent=ni,Ft=s(),o(be.$$.fragment),Ht=s(),_e=f("p"),_e.innerHTML=ii,Pt=s(),o(we.$$.fragment),Lt=s(),Te=f("p"),Te.textContent=si,qt=s(),Je=f("p"),Je.innerHTML=ai,At=s(),o(Ue.$$.fragment),Kt=s(),o(Ze.$$.fragment),Ot=s(),je=f("p"),je.innerHTML=li,en=s(),o(Ie.$$.fragment),tn=s(),o(Be.$$.fragment),nn=s(),ve=f("p"),ve.textContent=oi,sn=s(),o(S.$$.fragment),an=s(),o(We.$$.fragment),ln=s(),o(Ge.$$.fragment),on=s(),ke=f("p"),ke.innerHTML=ri,rn=s(),Ce=f("p"),Ce.textContent=pi,pn=s(),o(xe.$$.fragment),dn=s(),o($e.$$.fragment),cn=s(),Se=f("p"),Se.innerHTML=di,mn=s(),o(Re.$$.fragment),fn=s(),o(Xe.$$.fragment),un=s(),o(Ye.$$.fragment),gn=s(),o(Ve.$$.fragment),hn=s(),o(ze.$$.fragment),yn=s(),o(Ne.$$.fragment),Mn=s(),o(R.$$.fragment),bn=s(),o(Ee.$$.fragment),_n=s(),o(Qe.$$.fragment),wn=s(),o(De.$$.fragment),Tn=s(),o(Fe.$$.fragment),Jn=s(),J=f("div"),o(He.$$.fragment),Bn=s(),B=f("div"),o(Pe.$$.fragment),vn=s(),tt=f("p"),tt.textContent=ci,Wn=s(),o(X.$$.fragment),Gn=s(),Y=f("div"),o(Le.$$.fragment),kn=s(),nt=f("p"),nt.textContent=mi,Cn=s(),it=f("div"),o(qe.$$.fragment),xn=s(),v=f("div"),o(Ae.$$.fragment),$n=s(),st=f("p"),st.textContent=fi,Sn=s(),at=f("p"),at.innerHTML=ui,Un=s(),o(Ke.$$.fragment),Zn=s(),lt=f("p"),this.h()},l(e){const t=bi("svelte-u9bgzb",document.head);l=u(t,"META",{name:!0,content:!0}),t.forEach(n),b=a(e),h=u(e,"P",{}),et(h).forEach(n),y=a(e),r(j.$$.fragment,e),_=a(e),I=u(e,"DIV",{class:!0,"data-svelte-h":!0}),g(I)!=="svelte-1elo7hh"&&(I.innerHTML=Rn),dt=a(e),V=u(e,"P",{"data-svelte-h":!0}),g(V)!=="svelte-1e472ng"&&(V.innerHTML=Xn),ct=a(e),z=u(e,"P",{"data-svelte-h":!0}),g(z)!=="svelte-1cwsb16"&&(z.textContent=Yn),mt=a(e),N=u(e,"P",{"data-svelte-h":!0}),g(N)!=="svelte-vkvbjo"&&(N.innerHTML=Vn),ft=a(e),r(E.$$.fragment,e),ut=a(e),Q=u(e,"P",{"data-svelte-h":!0}),g(Q)!=="svelte-mtsbjp"&&(Q.innerHTML=zn),gt=a(e),D=u(e,"P",{"data-svelte-h":!0}),g(D)!=="svelte-12sg8l0"&&(D.textContent=Nn),ht=a(e),r(F.$$.fragment,e),yt=a(e),r(C.$$.fragment,e),Mt=a(e),r(H.$$.fragment,e),bt=a(e),P=u(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-16uzmu4"&&(P.innerHTML=En),_t=a(e),L=u(e,"UL",{"data-svelte-h":!0}),g(L)!=="svelte-1wxish5"&&(L.innerHTML=Qn),wt=a(e),r(q.$$.fragment,e),Tt=a(e),A=u(e,"P",{"data-svelte-h":!0}),g(A)!=="svelte-n8z787"&&(A.textContent=Dn),Jt=a(e),K=u(e,"UL",{"data-svelte-h":!0}),g(K)!=="svelte-79yrba"&&(K.innerHTML=Fn),Ut=a(e),O=u(e,"P",{"data-svelte-h":!0}),g(O)!=="svelte-19sl6jj"&&(O.innerHTML=Hn),Zt=a(e),r(ee.$$.fragment,e),jt=a(e),x=u(e,"DIV",{class:!0,"data-svelte-h":!0}),g(x)!=="svelte-lfioke"&&(x.innerHTML=Pn),It=a(e),r($.$$.fragment,e),Bt=a(e),r(te.$$.fragment,e),vt=a(e),ne=u(e,"P",{"data-svelte-h":!0}),g(ne)!=="svelte-19ncv5l"&&(ne.innerHTML=Ln),Wt=a(e),r(ie.$$.fragment,e),Gt=a(e),se=u(e,"P",{"data-svelte-h":!0}),g(se)!=="svelte-uyrglw"&&(se.textContent=qn),kt=a(e),r(ae.$$.fragment,e),Ct=a(e),r(le.$$.fragment,e),xt=a(e),oe=u(e,"P",{"data-svelte-h":!0}),g(oe)!=="svelte-k4awn"&&(oe.textContent=An),$t=a(e),r(re.$$.fragment,e),St=a(e),r(pe.$$.fragment,e),Rt=a(e),de=u(e,"P",{"data-svelte-h":!0}),g(de)!=="svelte-vcvc4f"&&(de.innerHTML=Kn),Xt=a(e),ce=u(e,"P",{"data-svelte-h":!0}),g(ce)!=="svelte-1t2mxsa"&&(ce.innerHTML=On),Yt=a(e),r(me.$$.fragment,e),Vt=a(e),fe=u(e,"P",{"data-svelte-h":!0}),g(fe)!=="svelte-1pykif5"&&(fe.innerHTML=ei),zt=a(e),r(ue.$$.fragment,e),Nt=a(e),ge=u(e,"P",{"data-svelte-h":!0}),g(ge)!=="svelte-bsz29z"&&(ge.innerHTML=ti),Et=a(e),r(he.$$.fragment,e),Qt=a(e),r(ye.$$.fragment,e),Dt=a(e),Me=u(e,"P",{"data-svelte-h":!0}),g(Me)!=="svelte-x56fi6"&&(Me.textContent=ni),Ft=a(e),r(be.$$.fragment,e),Ht=a(e),_e=u(e,"P",{"data-svelte-h":!0}),g(_e)!=="svelte-d39h5a"&&(_e.innerHTML=ii),Pt=a(e),r(we.$$.fragment,e),Lt=a(e),Te=u(e,"P",{"data-svelte-h":!0}),g(Te)!=="svelte-1ou2pxc"&&(Te.textContent=si),qt=a(e),Je=u(e,"P",{"data-svelte-h":!0}),g(Je)!=="svelte-16lneqp"&&(Je.innerHTML=ai),At=a(e),r(Ue.$$.fragment,e),Kt=a(e),r(Ze.$$.fragment,e),Ot=a(e),je=u(e,"P",{"data-svelte-h":!0}),g(je)!=="svelte-ejr28n"&&(je.innerHTML=li),en=a(e),r(Ie.$$.fragment,e),tn=a(e),r(Be.$$.fragment,e),nn=a(e),ve=u(e,"P",{"data-svelte-h":!0}),g(ve)!=="svelte-1ey7u3k"&&(ve.textContent=oi),sn=a(e),r(S.$$.fragment,e),an=a(e),r(We.$$.fragment,e),ln=a(e),r(Ge.$$.fragment,e),on=a(e),ke=u(e,"P",{"data-svelte-h":!0}),g(ke)!=="svelte-jjps0a"&&(ke.innerHTML=ri),rn=a(e),Ce=u(e,"P",{"data-svelte-h":!0}),g(Ce)!=="svelte-cj7nlj"&&(Ce.textContent=pi),pn=a(e),r(xe.$$.fragment,e),dn=a(e),r($e.$$.fragment,e),cn=a(e),Se=u(e,"P",{"data-svelte-h":!0}),g(Se)!=="svelte-1pvw0yz"&&(Se.innerHTML=di),mn=a(e),r(Re.$$.fragment,e),fn=a(e),r(Xe.$$.fragment,e),un=a(e),r(Ye.$$.fragment,e),gn=a(e),r(Ve.$$.fragment,e),hn=a(e),r(ze.$$.fragment,e),yn=a(e),r(Ne.$$.fragment,e),Mn=a(e),r(R.$$.fragment,e),bn=a(e),r(Ee.$$.fragment,e),_n=a(e),r(Qe.$$.fragment,e),wn=a(e),r(De.$$.fragment,e),Tn=a(e),r(Fe.$$.fragment,e),Jn=a(e),J=u(e,"DIV",{class:!0});var U=et(J);r(He.$$.fragment,U),Bn=a(U),B=u(U,"DIV",{class:!0});var W=et(B);r(Pe.$$.fragment,W),vn=a(W),tt=u(W,"P",{"data-svelte-h":!0}),g(tt)!=="svelte-v78lg8"&&(tt.textContent=ci),Wn=a(W),r(X.$$.fragment,W),W.forEach(n),Gn=a(U),Y=u(U,"DIV",{class:!0});var Oe=et(Y);r(Le.$$.fragment,Oe),kn=a(Oe),nt=u(Oe,"P",{"data-svelte-h":!0}),g(nt)!=="svelte-vi6ux7"&&(nt.textContent=mi),Oe.forEach(n),Cn=a(U),it=u(U,"DIV",{class:!0});var ot=et(it);r(qe.$$.fragment,ot),ot.forEach(n),xn=a(U),v=u(U,"DIV",{class:!0});var G=et(v);r(Ae.$$.fragment,G),$n=a(G),st=u(G,"P",{"data-svelte-h":!0}),g(st)!=="svelte-fimzys"&&(st.textContent=fi),Sn=a(G),at=u(G,"P",{"data-svelte-h":!0}),g(at)!=="svelte-gkgg1h"&&(at.innerHTML=ui),G.forEach(n),U.forEach(n),Un=a(e),r(Ke.$$.fragment,e),Zn=a(e),lt=u(e,"P",{}),et(lt).forEach(n),this.h()},h(){k(l,"name","hf:doc:metadata"),k(l,"content",Bi),k(I,"class","flex flex-wrap space-x-1"),k(x,"class","justify-center"),k(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(J,"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){w(document.head,l),i(e,b,t),i(e,h,t),i(e,y,t),p(j,e,t),i(e,_,t),i(e,I,t),i(e,dt,t),i(e,V,t),i(e,ct,t),i(e,z,t),i(e,mt,t),i(e,N,t),i(e,ft,t),p(E,e,t),i(e,ut,t),i(e,Q,t),i(e,gt,t),i(e,D,t),i(e,ht,t),p(F,e,t),i(e,yt,t),p(C,e,t),i(e,Mt,t),p(H,e,t),i(e,bt,t),i(e,P,t),i(e,_t,t),i(e,L,t),i(e,wt,t),p(q,e,t),i(e,Tt,t),i(e,A,t),i(e,Jt,t),i(e,K,t),i(e,Ut,t),i(e,O,t),i(e,Zt,t),p(ee,e,t),i(e,jt,t),i(e,x,t),i(e,It,t),p($,e,t),i(e,Bt,t),p(te,e,t),i(e,vt,t),i(e,ne,t),i(e,Wt,t),p(ie,e,t),i(e,Gt,t),i(e,se,t),i(e,kt,t),p(ae,e,t),i(e,Ct,t),p(le,e,t),i(e,xt,t),i(e,oe,t),i(e,$t,t),p(re,e,t),i(e,St,t),p(pe,e,t),i(e,Rt,t),i(e,de,t),i(e,Xt,t),i(e,ce,t),i(e,Yt,t),p(me,e,t),i(e,Vt,t),i(e,fe,t),i(e,zt,t),p(ue,e,t),i(e,Nt,t),i(e,ge,t),i(e,Et,t),p(he,e,t),i(e,Qt,t),p(ye,e,t),i(e,Dt,t),i(e,Me,t),i(e,Ft,t),p(be,e,t),i(e,Ht,t),i(e,_e,t),i(e,Pt,t),p(we,e,t),i(e,Lt,t),i(e,Te,t),i(e,qt,t),i(e,Je,t),i(e,At,t),p(Ue,e,t),i(e,Kt,t),p(Ze,e,t),i(e,Ot,t),i(e,je,t),i(e,en,t),p(Ie,e,t),i(e,tn,t),p(Be,e,t),i(e,nn,t),i(e,ve,t),i(e,sn,t),p(S,e,t),i(e,an,t),p(We,e,t),i(e,ln,t),p(Ge,e,t),i(e,on,t),i(e,ke,t),i(e,rn,t),i(e,Ce,t),i(e,pn,t),p(xe,e,t),i(e,dn,t),p($e,e,t),i(e,cn,t),i(e,Se,t),i(e,mn,t),p(Re,e,t),i(e,fn,t),p(Xe,e,t),i(e,un,t),p(Ye,e,t),i(e,gn,t),p(Ve,e,t),i(e,hn,t),p(ze,e,t),i(e,yn,t),p(Ne,e,t),i(e,Mn,t),p(R,e,t),i(e,bn,t),p(Ee,e,t),i(e,_n,t),p(Qe,e,t),i(e,wn,t),p(De,e,t),i(e,Tn,t),p(Fe,e,t),i(e,Jn,t),i(e,J,t),p(He,J,null),w(J,Bn),w(J,B),p(Pe,B,null),w(B,vn),w(B,tt),w(B,Wn),p(X,B,null),w(J,Gn),w(J,Y),p(Le,Y,null),w(Y,kn),w(Y,nt),w(J,Cn),w(J,it),p(qe,it,null),w(J,xn),w(J,v),p(Ae,v,null),w(v,$n),w(v,st),w(v,Sn),w(v,at),i(e,Un,t),p(Ke,e,t),i(e,Zn,t),i(e,lt,t),jn=!0},p(e,[t]){const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),C.$set(U);const W={};t&2&&(W.$$scope={dirty:t,ctx:e}),$.$set(W);const Oe={};t&2&&(Oe.$$scope={dirty:t,ctx:e}),S.$set(Oe);const ot={};t&2&&(ot.$$scope={dirty:t,ctx:e}),R.$set(ot);const G={};t&2&&(G.$$scope={dirty:t,ctx:e}),X.$set(G)},i(e){jn||(d(j.$$.fragment,e),d(E.$$.fragment,e),d(F.$$.fragment,e),d(C.$$.fragment,e),d(H.$$.fragment,e),d(q.$$.fragment,e),d(ee.$$.fragment,e),d($.$$.fragment,e),d(te.$$.fragment,e),d(ie.$$.fragment,e),d(ae.$$.fragment,e),d(le.$$.fragment,e),d(re.$$.fragment,e),d(pe.$$.fragment,e),d(me.$$.fragment,e),d(ue.$$.fragment,e),d(he.$$.fragment,e),d(ye.$$.fragment,e),d(be.$$.fragment,e),d(we.$$.fragment,e),d(Ue.$$.fragment,e),d(Ze.$$.fragment,e),d(Ie.$$.fragment,e),d(Be.$$.fragment,e),d(S.$$.fragment,e),d(We.$$.fragment,e),d(Ge.$$.fragment,e),d(xe.$$.fragment,e),d($e.$$.fragment,e),d(Re.$$.fragment,e),d(Xe.$$.fragment,e),d(Ye.$$.fragment,e),d(Ve.$$.fragment,e),d(ze.$$.fragment,e),d(Ne.$$.fragment,e),d(R.$$.fragment,e),d(Ee.$$.fragment,e),d(Qe.$$.fragment,e),d(De.$$.fragment,e),d(Fe.$$.fragment,e),d(He.$$.fragment,e),d(Pe.$$.fragment,e),d(X.$$.fragment,e),d(Le.$$.fragment,e),d(qe.$$.fragment,e),d(Ae.$$.fragment,e),d(Ke.$$.fragment,e),jn=!0)},o(e){c(j.$$.fragment,e),c(E.$$.fragment,e),c(F.$$.fragment,e),c(C.$$.fragment,e),c(H.$$.fragment,e),c(q.$$.fragment,e),c(ee.$$.fragment,e),c($.$$.fragment,e),c(te.$$.fragment,e),c(ie.$$.fragment,e),c(ae.$$.fragment,e),c(le.$$.fragment,e),c(re.$$.fragment,e),c(pe.$$.fragment,e),c(me.$$.fragment,e),c(ue.$$.fragment,e),c(he.$$.fragment,e),c(ye.$$.fragment,e),c(be.$$.fragment,e),c(we.$$.fragment,e),c(Ue.$$.fragment,e),c(Ze.$$.fragment,e),c(Ie.$$.fragment,e),c(Be.$$.fragment,e),c(S.$$.fragment,e),c(We.$$.fragment,e),c(Ge.$$.fragment,e),c(xe.$$.fragment,e),c($e.$$.fragment,e),c(Re.$$.fragment,e),c(Xe.$$.fragment,e),c(Ye.$$.fragment,e),c(Ve.$$.fragment,e),c(ze.$$.fragment,e),c(Ne.$$.fragment,e),c(R.$$.fragment,e),c(Ee.$$.fragment,e),c(Qe.$$.fragment,e),c(De.$$.fragment,e),c(Fe.$$.fragment,e),c(He.$$.fragment,e),c(Pe.$$.fragment,e),c(X.$$.fragment,e),c(Le.$$.fragment,e),c(qe.$$.fragment,e),c(Ae.$$.fragment,e),c(Ke.$$.fragment,e),jn=!1},d(e){e&&(n(b),n(h),n(y),n(_),n(I),n(dt),n(V),n(ct),n(z),n(mt),n(N),n(ft),n(ut),n(Q),n(gt),n(D),n(ht),n(yt),n(Mt),n(bt),n(P),n(_t),n(L),n(wt),n(Tt),n(A),n(Jt),n(K),n(Ut),n(O),n(Zt),n(jt),n(x),n(It),n(Bt),n(vt),n(ne),n(Wt),n(Gt),n(se),n(kt),n(Ct),n(xt),n(oe),n($t),n(St),n(Rt),n(de),n(Xt),n(ce),n(Yt),n(Vt),n(fe),n(zt),n(Nt),n(ge),n(Et),n(Qt),n(Dt),n(Me),n(Ft),n(Ht),n(_e),n(Pt),n(Lt),n(Te),n(qt),n(Je),n(At),n(Kt),n(Ot),n(je),n(en),n(tn),n(nn),n(ve),n(sn),n(an),n(ln),n(on),n(ke),n(rn),n(Ce),n(pn),n(dn),n(cn),n(Se),n(mn),n(fn),n(un),n(gn),n(hn),n(yn),n(Mn),n(bn),n(_n),n(wn),n(Tn),n(Jn),n(J),n(Un),n(Zn),n(lt)),n(l),m(j,e),m(E,e),m(F,e),m(C,e),m(H,e),m(q,e),m(ee,e),m($,e),m(te,e),m(ie,e),m(ae,e),m(le,e),m(re,e),m(pe,e),m(me,e),m(ue,e),m(he,e),m(ye,e),m(be,e),m(we,e),m(Ue,e),m(Ze,e),m(Ie,e),m(Be,e),m(S,e),m(We,e),m(Ge,e),m(xe,e),m($e,e),m(Re,e),m(Xe,e),m(Ye,e),m(Ve,e),m(ze,e),m(Ne,e),m(R,e),m(Ee,e),m(Qe,e),m(De,e),m(Fe,e),m(He),m(Pe),m(X),m(Le),m(qe),m(Ae),m(Ke,e)}}}const Bi='{"title":"Stable Diffusion 3","local":"stable-diffusion-3","sections":[{"title":"Usage Example","local":"usage-example","sections":[],"depth":2},{"title":"Image Prompting with IP-Adapters","local":"image-prompting-with-ip-adapters","sections":[],"depth":2},{"title":"Memory Optimisations for SD3","local":"memory-optimisations-for-sd3","sections":[{"title":"Running Inference with Model Offloading","local":"running-inference-with-model-offloading","sections":[],"depth":3},{"title":"Dropping the T5 Text Encoder during Inference","local":"dropping-the-t5-text-encoder-during-inference","sections":[],"depth":3},{"title":"Using a Quantized Version of the T5 Text Encoder","local":"using-a-quantized-version-of-the-t5-text-encoder","sections":[],"depth":3}],"depth":2},{"title":"Performance Optimizations for SD3","local":"performance-optimizations-for-sd3","sections":[{"title":"Using Torch Compile to Speed Up Inference","local":"using-torch-compile-to-speed-up-inference","sections":[],"depth":3}],"depth":2},{"title":"Quantization","local":"quantization","sections":[],"depth":2},{"title":"Using Long Prompts with the T5 Text Encoder","local":"using-long-prompts-with-the-t5-text-encoder","sections":[{"title":"Sending a different prompt to the T5 Text Encoder","local":"sending-a-different-prompt-to-the-t5-text-encoder","sections":[],"depth":3}],"depth":2},{"title":"Tiny AutoEncoder for Stable Diffusion 3","local":"tiny-autoencoder-for-stable-diffusion-3","sections":[],"depth":2},{"title":"Loading the original checkpoints via from_single_file","local":"loading-the-original-checkpoints-via-fromsinglefile","sections":[],"depth":2},{"title":"Loading the original checkpoints for the SD3Transformer2DModel","local":"loading-the-original-checkpoints-for-the-sd3transformer2dmodel","sections":[],"depth":2},{"title":"Loading the single checkpoint for the StableDiffusion3Pipeline","local":"loading-the-single-checkpoint-for-the-stablediffusion3pipeline","sections":[{"title":"Loading the single file checkpoint without T5","local":"loading-the-single-file-checkpoint-without-t5","sections":[],"depth":3},{"title":"Loading the single file checkpoint with T5","local":"loading-the-single-file-checkpoint-with-t5","sections":[],"depth":3},{"title":"Loading the single file checkpoint for the Stable Diffusion 3.5 Transformer Model","local":"loading-the-single-file-checkpoint-for-the-stable-diffusion-35-transformer-model","sections":[],"depth":3}],"depth":2},{"title":"StableDiffusion3Pipeline","local":"diffusers.StableDiffusion3Pipeline","sections":[],"depth":2}],"depth":1}';function vi(Z){return hi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ri extends yi{constructor(l){super(),Mi(this,l,vi,Ii,gi,{})}}export{Ri as component}; | |
Xet Storage Details
- Size:
- 97.4 kB
- Xet hash:
- 89e00ea7c4d13e055897102fb505c6c7818ff30cd033b7810581b05baf205e54
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.