import{s as Ze,o as Te,n as Y}from"../chunks/scheduler.182ea377.js";import{S as je,i as $e,g as h,s as u,r as M,A as ve,h as g,f as a,c as f,j as we,u as y,x as T,k as C,y as Ue,a as i,v as b,d as J,t as w,w as Z}from"../chunks/index.abf12888.js";import{T as We}from"../chunks/Tip.230e2334.js";import{C as z}from"../chunks/CodeBlock.57fe6e13.js";import{H as ce,E as xe}from"../chunks/EditOnGithub.9b8e78e4.js";import{H as Ie,a as pe}from"../chunks/HfOption.fc88c804.js";function Ge(j){let s,c='For inference, you need a model that has been trained with <em>v_prediction</em>. To train your own model with <em>v_prediction</em>, add the following flag to the <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py" rel="nofollow">train_text_to_image.py</a> or <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py" rel="nofollow">train_text_to_image_lora.py</a> scripts.',l,m,r;return m=new z({props:{code:"LS1wcmVkaWN0aW9uX3R5cGUlM0QlMjJ2X3ByZWRpY3Rpb24lMjI=",highlighted:'--prediction_type=<span class="hljs-string">&quot;v_prediction&quot;</span>',wrap:!1}}),{c(){s=h("p"),s.innerHTML=c,l=u(),M(m.$$.fragment)},l(t){s=g(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1u8ajsg"&&(s.innerHTML=c),l=f(t),y(m.$$.fragment,t)},m(t,p){i(t,s,p),i(t,l,p),b(m,t,p),r=!0},p:Y,i(t){r||(J(m.$$.fragment,t),r=!0)},o(t){w(m.$$.fragment,t),r=!1},d(t){t&&(a(s),a(l)),Z(m,t)}}}function _e(j){let s,c,l,m='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdv15-no-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU disabled</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdv15-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU enabled</figcaption></div>',r;return s=new z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHNhZmV0eV9jaGVja2VyJTNETm9uZSUwQSkudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS5lbmFibGVfZnJlZXUoczElM0QwLjklMkMlMjBzMiUzRDAuMiUyQyUyMGIxJTNEMS41JTJDJTIwYjIlM0QxLjYpJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmNwdSUyMikubWFudWFsX3NlZWQoMzMpJTBBcHJvbXB0JTIwJTNEJTIwJTIyJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16, safety_checker=<span class="hljs-literal">None</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.enable_freeu(s1=<span class="hljs-number">0.9</span>, s2=<span class="hljs-number">0.2</span>, b1=<span class="hljs-number">1.5</span>, b2=<span class="hljs-number">1.6</span>)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">33</span>)
prompt = <span class="hljs-string">&quot;&quot;</span>
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){M(s.$$.fragment),c=u(),l=h("div"),l.innerHTML=m,this.h()},l(t){y(s.$$.fragment,t),c=f(t),l=g(t,"DIV",{class:!0,"data-svelte-h":!0}),T(l)!=="svelte-1wayd6q"&&(l.innerHTML=m),this.h()},h(){C(l,"class","flex gap-4")},m(t,p){b(s,t,p),i(t,c,p),i(t,l,p),r=!0},p:Y,i(t){r||(J(s.$$.fragment,t),r=!0)},o(t){w(s.$$.fragment,t),r=!1},d(t){t&&(a(c),a(l)),Z(s,t)}}}function Be(j){let s,c,l,m='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdv21-no-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU disabled</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdv21-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU enabled</figcaption></div>',r;return s=new z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24tMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwc2FmZXR5X2NoZWNrZXIlM0ROb25lJTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmVuYWJsZV9mcmVldShzMSUzRDAuOSUyQyUyMHMyJTNEMC4yJTJDJTIwYjElM0QxLjQlMkMlMjBiMiUzRDEuNiklMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCg4MCklMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwc3F1aXJyZWwlMjBlYXRpbmclMjBhJTIwYnVyZ2VyJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-1&quot;</span>, torch_dtype=torch.float16, safety_checker=<span class="hljs-literal">None</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.enable_freeu(s1=<span class="hljs-number">0.9</span>, s2=<span class="hljs-number">0.2</span>, b1=<span class="hljs-number">1.4</span>, b2=<span class="hljs-number">1.6</span>)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">80</span>)
prompt = <span class="hljs-string">&quot;A squirrel eating a burger&quot;</span>
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){M(s.$$.fragment),c=u(),l=h("div"),l.innerHTML=m,this.h()},l(t){y(s.$$.fragment,t),c=f(t),l=g(t,"DIV",{class:!0,"data-svelte-h":!0}),T(l)!=="svelte-80qe6y"&&(l.innerHTML=m),this.h()},h(){C(l,"class","flex gap-4")},m(t,p){b(s,t,p),i(t,c,p),i(t,l,p),r=!0},p:Y,i(t){r||(J(s.$$.fragment,t),r=!0)},o(t){w(s.$$.fragment,t),r=!1},d(t){t&&(a(c),a(l)),Z(s,t)}}}function Ve(j){let s,c,l,m='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-no-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU disabled</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-freeu.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU enabled</figcaption></div>',r;return s=new z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUuZW5hYmxlX2ZyZWV1KHMxJTNEMC45JTJDJTIwczIlM0QwLjIlMkMlMjBiMSUzRDEuMyUyQyUyMGIyJTNEMS40KSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjcHUlMjIpLm1hbnVhbF9zZWVkKDEzKSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBzcXVpcnJlbCUyMGVhdGluZyUyMGElMjBidXJnZXIlMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvcikuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.enable_freeu(s1=<span class="hljs-number">0.9</span>, s2=<span class="hljs-number">0.2</span>, b1=<span class="hljs-number">1.3</span>, b2=<span class="hljs-number">1.4</span>)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">13</span>)
prompt = <span class="hljs-string">&quot;A squirrel eating a burger&quot;</span>
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){M(s.$$.fragment),c=u(),l=h("div"),l.innerHTML=m,this.h()},l(t){y(s.$$.fragment,t),c=f(t),l=g(t,"DIV",{class:!0,"data-svelte-h":!0}),T(l)!=="svelte-1uy9my4"&&(l.innerHTML=m),this.h()},h(){C(l,"class","flex gap-4")},m(t,p){b(s,t,p),i(t,c,p),i(t,l,p),r=!0},p:Y,i(t){r||(J(s.$$.fragment,t),r=!0)},o(t){w(s.$$.fragment,t),r=!1},d(t){t&&(a(c),a(l)),Z(s,t)}}}function ke(j){let s,c,l,m='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/video-no-freeu.gif"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU disabled</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/video-freeu.gif"/> <figcaption class="mt-2 text-center text-sm text-gray-500">FreeU enabled</figcaption></div>',r;return s=new z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZGFtby12aWxhYiUyRnRleHQtdG8tdmlkZW8tbXMtMS43YiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMiklMEElMjMlMjB2YWx1ZXMlMjBjb21lJTIwZnJvbSUyMGh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmx5bi1yZ2IlMkZGcmVlVV9EaWZmdXNlcnMlMjN2aWRlby1waXBlbGluZXMlMEFwaXBlbGluZS5lbmFibGVfZnJlZXUoYjElM0QxLjIlMkMlMjBiMiUzRDEuNCUyQyUyMHMxJTNEMC45JTJDJTIwczIlM0QwLjIpJTBBcHJvbXB0JTIwJTNEJTIwJTIyQ29uZmlkZW50JTIwdGVkZHklMjBiZWFyJTIwc3VyZmVyJTIwcmlkZXMlMjB0aGUlMjB3YXZlJTIwaW4lMjB0aGUlMjB0cm9waWNzJTIyJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmNwdSUyMikubWFudWFsX3NlZWQoNDcpJTBBdmlkZW9fZnJhbWVzJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKHZpZGVvX2ZyYW1lcyUyQyUyMCUyMnRlZGR5X2JlYXIubXA0JTIyJTJDJTIwZnBzJTNEMTAp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;damo-vilab/text-to-video-ms-1.7b&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># values come from https://github.com/lyn-rgb/FreeU_Diffusers#video-pipelines</span>
pipeline.enable_freeu(b1=<span class="hljs-number">1.2</span>, b2=<span class="hljs-number">1.4</span>, s1=<span class="hljs-number">0.9</span>, s2=<span class="hljs-number">0.2</span>)
prompt = <span class="hljs-string">&quot;Confident teddy bear surfer rides the wave in the tropics&quot;</span>
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">47</span>)
video_frames = pipeline(prompt, generator=generator).frames[<span class="hljs-number">0</span>]
export_to_video(video_frames, <span class="hljs-string">&quot;teddy_bear.mp4&quot;</span>, fps=<span class="hljs-number">10</span>)`,wrap:!1}}),{c(){M(s.$$.fragment),c=u(),l=h("div"),l.innerHTML=m,this.h()},l(t){y(s.$$.fragment,t),c=f(t),l=g(t,"DIV",{class:!0,"data-svelte-h":!0}),T(l)!=="svelte-3hke60"&&(l.innerHTML=m),this.h()},h(){C(l,"class","flex gap-4")},m(t,p){b(s,t,p),i(t,c,p),i(t,l,p),r=!0},p:Y,i(t){r||(J(s.$$.fragment,t),r=!0)},o(t){w(s.$$.fragment,t),r=!1},d(t){t&&(a(c),a(l)),Z(s,t)}}}function Xe(j){let s,c,l,m,r,t,p,x;return s=new pe({props:{id:"freeu",option:"Stable Diffusion v1-5",$$slots:{default:[_e]},$$scope:{ctx:j}}}),l=new pe({props:{id:"freeu",option:"Stable Diffusion v2-1",$$slots:{default:[Be]},$$scope:{ctx:j}}}),r=new pe({props:{id:"freeu",option:"Stable Diffusion XL",$$slots:{default:[Ve]},$$scope:{ctx:j}}}),p=new pe({props:{id:"freeu",option:"Zeroscope",$$slots:{default:[ke]},$$scope:{ctx:j}}}),{c(){M(s.$$.fragment),c=u(),M(l.$$.fragment),m=u(),M(r.$$.fragment),t=u(),M(p.$$.fragment)},l(o){y(s.$$.fragment,o),c=f(o),y(l.$$.fragment,o),m=f(o),y(r.$$.fragment,o),t=f(o),y(p.$$.fragment,o)},m(o,d){b(s,o,d),i(o,c,d),b(l,o,d),i(o,m,d),b(r,o,d),i(o,t,d),b(p,o,d),x=!0},p(o,d){const D={};d&2&&(D.$$scope={dirty:d,ctx:o}),s.$set(D);const I={};d&2&&(I.$$scope={dirty:d,ctx:o}),l.$set(I);const $={};d&2&&($.$$scope={dirty:d,ctx:o}),r.$set($);const G={};d&2&&(G.$$scope={dirty:d,ctx:o}),p.$set(G)},i(o){x||(J(s.$$.fragment,o),J(l.$$.fragment,o),J(r.$$.fragment,o),J(p.$$.fragment,o),x=!0)},o(o){w(s.$$.fragment,o),w(l.$$.fragment,o),w(r.$$.fragment,o),w(p.$$.fragment,o),x=!1},d(o){o&&(a(c),a(m),a(t)),Z(s,o),Z(l,o),Z(r,o),Z(p,o)}}}function Re(j){let s,c,l,m,r,t,p,x="The components of a diffusion model, like the UNet and scheduler, can be optimized to improve the quality of generated images leading to better image lighting and details. These techniques are especially useful if you don’t have the resources to simply use a larger model for inference. You can enable these techniques during inference without any additional training.",o,d,D="This guide will show you how to turn these techniques on in your pipeline and how to configure them to improve the quality of your generated images.",I,$,G,_,me='The Stable Diffusion models aren’t very good at generating images that are very bright or dark because the scheduler doesn’t start sampling from the last timestep and it doesn’t enforce a zero signal-to-noise ratio (SNR). The <a href="https://hf.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are Flawed</a> paper fixes these issues which are now available in some Diffusers schedulers.',Q,v,L,B,ue='For example, load the <a href="https://hf.co/ptx0/pseudo-journey-v2" rel="nofollow">ptx0/pseudo-journey-v2</a> checkpoint which was trained with <code>v_prediction</code> and the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>. Now you should configure the following parameters in the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.',A,V,fe="<li><code>rescale_betas_zero_snr=True</code> to rescale the noise schedule to zero SNR</li> <li><code>timestep_spacing=&quot;trailing&quot;</code> to start sampling from the last timestep</li>",P,k,de="Set <code>guidance_rescale</code> in the pipeline to prevent over-exposure. A lower value increases brightness but some of the details may appear washed out.",K,X,O,U,he='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/no-zero-snr.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">default Stable Diffusion v2-1 image</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/zero-snr.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">image with zero SNR and trailing timestep spacing enabled</figcaption></div>',ee,R,te,E,ge='<a href="https://hf.co/papers/2309.11497" rel="nofollow">FreeU</a> improves image details by rebalancing the UNet’s backbone and skip connection weights. The skip connections can cause the model to overlook some of the backbone semantics which may lead to unnatural image details in the generated image. This technique does not require any additional training and can be applied on the fly during inference for tasks like image-to-image and text-to-video.',se,S,Me='Use the <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.StableDiffusionMixin.enable_freeu">enable_freeu()</a> method on your pipeline and configure the scaling factors for the backbone (<code>b1</code> and <code>b2</code>) and skip connections (<code>s1</code> and <code>s2</code>). The number after each scaling factor corresponds to the stage in the UNet where the factor is applied. Take a look at the <a href="https://github.com/ChenyangSi/FreeU#parameters" rel="nofollow">FreeU</a> repository for reference hyperparameters for different models.',le,W,ae,N,ye='Call the <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.StableDiffusionMixin.disable_freeu">pipelines.StableDiffusionMixin.disable_freeu()</a> method to disable FreeU.',ne,F,ie,H,re,q,oe;return r=new ce({props:{title:"Controlling image quality",local:"controlling-image-quality",headingTag:"h1"}}),$=new ce({props:{title:"Lighting",local:"lighting",headingTag:"h2"}}),v=new We({props:{warning:!1,$$slots:{default:[Ge]},$$scope:{ctx:j}}}),X=new z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwRERJTVNjaGVkdWxlciUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnB0eDAlMkZwc2V1ZG8tam91cm5leS12MiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpJTBBJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwRERJTVNjaGVkdWxlci5mcm9tX2NvbmZpZyglMEElMjAlMjAlMjAlMjBwaXBlbGluZS5zY2hlZHVsZXIuY29uZmlnJTJDJTIwcmVzY2FsZV9iZXRhc196ZXJvX3NuciUzRFRydWUlMkMlMjB0aW1lc3RlcF9zcGFjaW5nJTNEJTIydHJhaWxpbmclMjIlMEEpJTBBcGlwZWxpbmUudG8oJTIyY3VkYSUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJjaW5lbWF0aWMlMjBwaG90byUyMG9mJTIwYSUyMHNub3d5JTIwbW91bnRhaW4lMjBhdCUyMG5pZ2h0JTIwd2l0aCUyMHRoZSUyMG5vcnRoZXJuJTIwbGlnaHRzJTIwYXVyb3JhJTIwYm9yZWFsaXMlMjBvdmVyaGVhZCUyQyUyMDM1bW0lMjBwaG90b2dyYXBoJTJDJTIwZmlsbSUyQyUyMHByb2Zlc3Npb25hbCUyQyUyMDRrJTJDJTIwaGlnaGx5JTIwZGV0YWlsZWQlMjIlMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCgyMyklMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMGd1aWRhbmNlX3Jlc2NhbGUlM0QwLjclMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DDIMScheduler

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;ptx0/pseudo-journey-v2&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>)

pipeline.scheduler = DDIMScheduler.from_config(
    pipeline.scheduler.config, rescale_betas_zero_snr=<span class="hljs-literal">True</span>, timestep_spacing=<span class="hljs-string">&quot;trailing&quot;</span>
)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)
prompt = <span class="hljs-string">&quot;cinematic photo of a snowy mountain at night with the northern lights aurora borealis overhead, 35mm photograph, film, professional, 4k, highly detailed&quot;</span>
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">23</span>)
image = pipeline(prompt, guidance_rescale=<span class="hljs-number">0.7</span>, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),R=new ce({props:{title:"Details",local:"details",headingTag:"h2"}}),W=new Ie({props:{id:"freeu",options:["Stable Diffusion v1-5","Stable Diffusion v2-1","Stable Diffusion XL","Zeroscope"],$$slots:{default:[Xe]},$$scope:{ctx:j}}}),F=new z({props:{code:"cGlwZWxpbmUuZGlzYWJsZV9mcmVldSgp",highlighted:"pipeline.disable_freeu()",wrap:!1}}),H=new xe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/image_quality.md"}}),{c(){s=h("meta"),c=u(),l=h("p"),m=u(),M(r.$$.fragment),t=u(),p=h("p"),p.textContent=x,o=u(),d=h("p"),d.textContent=D,I=u(),M($.$$.fragment),G=u(),_=h("p"),_.innerHTML=me,Q=u(),M(v.$$.fragment),L=u(),B=h("p"),B.innerHTML=ue,A=u(),V=h("ul"),V.innerHTML=fe,P=u(),k=h("p"),k.innerHTML=de,K=u(),M(X.$$.fragment),O=u(),U=h("div"),U.innerHTML=he,ee=u(),M(R.$$.fragment),te=u(),E=h("p"),E.innerHTML=ge,se=u(),S=h("p"),S.innerHTML=Me,le=u(),M(W.$$.fragment),ae=u(),N=h("p"),N.innerHTML=ye,ne=u(),M(F.$$.fragment),ie=u(),M(H.$$.fragment),re=u(),q=h("p"),this.h()},l(e){const n=ve("svelte-u9bgzb",document.head);s=g(n,"META",{name:!0,content:!0}),n.forEach(a),c=f(e),l=g(e,"P",{}),we(l).forEach(a),m=f(e),y(r.$$.fragment,e),t=f(e),p=g(e,"P",{"data-svelte-h":!0}),T(p)!=="svelte-t7ydeu"&&(p.textContent=x),o=f(e),d=g(e,"P",{"data-svelte-h":!0}),T(d)!=="svelte-4avkmd"&&(d.textContent=D),I=f(e),y($.$$.fragment,e),G=f(e),_=g(e,"P",{"data-svelte-h":!0}),T(_)!=="svelte-1xh1aah"&&(_.innerHTML=me),Q=f(e),y(v.$$.fragment,e),L=f(e),B=g(e,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1w84d4l"&&(B.innerHTML=ue),A=f(e),V=g(e,"UL",{"data-svelte-h":!0}),T(V)!=="svelte-1dozvyr"&&(V.innerHTML=fe),P=f(e),k=g(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-158nvmg"&&(k.innerHTML=de),K=f(e),y(X.$$.fragment,e),O=f(e),U=g(e,"DIV",{class:!0,"data-svelte-h":!0}),T(U)!=="svelte-2pxhst"&&(U.innerHTML=he),ee=f(e),y(R.$$.fragment,e),te=f(e),E=g(e,"P",{"data-svelte-h":!0}),T(E)!=="svelte-47jju9"&&(E.innerHTML=ge),se=f(e),S=g(e,"P",{"data-svelte-h":!0}),T(S)!=="svelte-18kclpc"&&(S.innerHTML=Me),le=f(e),y(W.$$.fragment,e),ae=f(e),N=g(e,"P",{"data-svelte-h":!0}),T(N)!=="svelte-e45pk"&&(N.innerHTML=ye),ne=f(e),y(F.$$.fragment,e),ie=f(e),y(H.$$.fragment,e),re=f(e),q=g(e,"P",{}),we(q).forEach(a),this.h()},h(){C(s,"name","hf:doc:metadata"),C(s,"content",Ee),C(U,"class","flex gap-4")},m(e,n){Ue(document.head,s),i(e,c,n),i(e,l,n),i(e,m,n),b(r,e,n),i(e,t,n),i(e,p,n),i(e,o,n),i(e,d,n),i(e,I,n),b($,e,n),i(e,G,n),i(e,_,n),i(e,Q,n),b(v,e,n),i(e,L,n),i(e,B,n),i(e,A,n),i(e,V,n),i(e,P,n),i(e,k,n),i(e,K,n),b(X,e,n),i(e,O,n),i(e,U,n),i(e,ee,n),b(R,e,n),i(e,te,n),i(e,E,n),i(e,se,n),i(e,S,n),i(e,le,n),b(W,e,n),i(e,ae,n),i(e,N,n),i(e,ne,n),b(F,e,n),i(e,ie,n),b(H,e,n),i(e,re,n),i(e,q,n),oe=!0},p(e,[n]){const be={};n&2&&(be.$$scope={dirty:n,ctx:e}),v.$set(be);const Je={};n&2&&(Je.$$scope={dirty:n,ctx:e}),W.$set(Je)},i(e){oe||(J(r.$$.fragment,e),J($.$$.fragment,e),J(v.$$.fragment,e),J(X.$$.fragment,e),J(R.$$.fragment,e),J(W.$$.fragment,e),J(F.$$.fragment,e),J(H.$$.fragment,e),oe=!0)},o(e){w(r.$$.fragment,e),w($.$$.fragment,e),w(v.$$.fragment,e),w(X.$$.fragment,e),w(R.$$.fragment,e),w(W.$$.fragment,e),w(F.$$.fragment,e),w(H.$$.fragment,e),oe=!1},d(e){e&&(a(c),a(l),a(m),a(t),a(p),a(o),a(d),a(I),a(G),a(_),a(Q),a(L),a(B),a(A),a(V),a(P),a(k),a(K),a(O),a(U),a(ee),a(te),a(E),a(se),a(S),a(le),a(ae),a(N),a(ne),a(ie),a(re),a(q)),a(s),Z(r,e),Z($,e),Z(v,e),Z(X,e),Z(R,e),Z(W,e),Z(F,e),Z(H,e)}}}const Ee='{"title":"Controlling image quality","local":"controlling-image-quality","sections":[{"title":"Lighting","local":"lighting","sections":[],"depth":2},{"title":"Details","local":"details","sections":[],"depth":2}],"depth":1}';function Se(j){return Te(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qe extends je{constructor(s){super(),$e(this,s,Se,Re,Ze,{})}}export{qe as component};
