import{s as rs,o as os,n as qe}from"../chunks/scheduler.8c3d61f6.js";import{S as ps,i as us,g as f,s as r,r as h,A as ds,h as m,f as t,c as o,j as is,u as M,x as Z,k as Le,y as cs,a,v as y,d as b,t as g,w as $}from"../chunks/index.da70eac4.js";import{C as v}from"../chunks/CodeBlock.a9c4becf.js";import{D as fs}from"../chunks/DocNotebookDropdown.48852948.js";import{H as Be,E as ms}from"../chunks/getInferenceSnippets.28ca3596.js";import{H as hs,a as He}from"../chunks/HfOption.6c3b4e77.js";function Ms(T){let n,w='<a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a> typically generates higher quality images than the default scheduler.',d,p,u;return p=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExNU0Rpc2NyZXRlU2NoZWR1bGVyJTBBJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwTE1TRGlzY3JldGVTY2hlZHVsZXIuZnJvbV9jb25maWcocGlwZWxpbmUuc2NoZWR1bGVyLmNvbmZpZyklMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvcikuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LMSDiscreteScheduler

pipeline.scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=w,d=r(),h(p.$$.fragment)},l(l){n=m(l,"P",{"data-svelte-h":!0}),Z(n)!=="svelte-1u7n96v"&&(n.innerHTML=w),d=o(l),M(p.$$.fragment,l)},m(l,c){a(l,n,c),a(l,d,c),y(p,l,c),u=!0},p:qe,i(l){u||(b(p.$$.fragment,l),u=!0)},o(l){g(p.$$.fragment,l),u=!1},d(l){l&&(t(n),t(d)),$(p,l)}}}function ys(T){let n,w='<a href="/docs/diffusers/main/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler">EulerDiscreteScheduler</a> can generate higher quality images in just 30 steps.',d,p,u;return p=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEV1bGVyRGlzY3JldGVTY2hlZHVsZXIlMEElMEFwaXBlbGluZS5zY2hlZHVsZXIlMjAlM0QlMjBFdWxlckRpc2NyZXRlU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWcpJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> EulerDiscreteScheduler

pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=w,d=r(),h(p.$$.fragment)},l(l){n=m(l,"P",{"data-svelte-h":!0}),Z(n)!=="svelte-1aj8vh5"&&(n.innerHTML=w),d=o(l),M(p.$$.fragment,l)},m(l,c){a(l,n,c),a(l,d,c),y(p,l,c),u=!0},p:qe,i(l){u||(b(p.$$.fragment,l),u=!0)},o(l){g(p.$$.fragment,l),u=!1},d(l){l&&(t(n),t(d)),$(p,l)}}}function bs(T){let n,w='<a href="/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler">EulerAncestralDiscreteScheduler</a> can generate higher quality images in just 30 steps.',d,p,u;return p=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEV1bGVyQW5jZXN0cmFsRGlzY3JldGVTY2hlZHVsZXIlMEElMEFwaXBlbGluZS5zY2hlZHVsZXIlMjAlM0QlMjBFdWxlckFuY2VzdHJhbERpc2NyZXRlU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWcpJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> EulerAncestralDiscreteScheduler

pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=w,d=r(),h(p.$$.fragment)},l(l){n=m(l,"P",{"data-svelte-h":!0}),Z(n)!=="svelte-e3tbp7"&&(n.innerHTML=w),d=o(l),M(p.$$.fragment,l)},m(l,c){a(l,n,c),a(l,d,c),y(p,l,c),u=!0},p:qe,i(l){u||(b(p.$$.fragment,l),u=!0)},o(l){g(p.$$.fragment,l),u=!1},d(l){l&&(t(n),t(d)),$(p,l)}}}function gs(T){let n,w='<a href="/docs/diffusers/main/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a> provides a balance between speed and quality and can generate higher quality images in just 20 steps.',d,p,u;return p=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlciUwQSUwQXBpcGVsaW5lLnNjaGVkdWxlciUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX2NvbmZpZyhwaXBlbGluZS5zY2hlZHVsZXIuY29uZmlnKSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler

pipeline.scheduler = DPMSolverMultistepScheduler.from_config(pipeline.scheduler.config)
image = pipeline(prompt, generator=generator).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){n=f("p"),n.innerHTML=w,d=r(),h(p.$$.fragment)},l(l){n=m(l,"P",{"data-svelte-h":!0}),Z(n)!=="svelte-1coadql"&&(n.innerHTML=w),d=o(l),M(p.$$.fragment,l)},m(l,c){a(l,n,c),a(l,d,c),y(p,l,c),u=!0},p:qe,i(l){u||(b(p.$$.fragment,l),u=!0)},o(l){g(p.$$.fragment,l),u=!1},d(l){l&&(t(n),t(d)),$(p,l)}}}function $s(T){let n,w,d,p,u,l,c,J;return n=new He({props:{id:"schedulers",option:"LMSDiscreteScheduler",$$slots:{default:[Ms]},$$scope:{ctx:T}}}),d=new He({props:{id:"schedulers",option:"EulerDiscreteScheduler",$$slots:{default:[ys]},$$scope:{ctx:T}}}),u=new He({props:{id:"schedulers",option:"EulerAncestralDiscreteScheduler",$$slots:{default:[bs]},$$scope:{ctx:T}}}),c=new He({props:{id:"schedulers",option:"DPMSolverMultistepScheduler",$$slots:{default:[gs]},$$scope:{ctx:T}}}),{c(){h(n.$$.fragment),w=r(),h(d.$$.fragment),p=r(),h(u.$$.fragment),l=r(),h(c.$$.fragment)},l(i){M(n.$$.fragment,i),w=o(i),M(d.$$.fragment,i),p=o(i),M(u.$$.fragment,i),l=o(i),M(c.$$.fragment,i)},m(i,U){y(n,i,U),a(i,w,U),y(d,i,U),a(i,p,U),y(u,i,U),a(i,l,U),y(c,i,U),J=!0},p(i,U){const k={};U&2&&(k.$$scope={dirty:U,ctx:i}),n.$set(k);const j={};U&2&&(j.$$scope={dirty:U,ctx:i}),d.$set(j);const ie={};U&2&&(ie.$$scope={dirty:U,ctx:i}),u.$set(ie);const S={};U&2&&(S.$$scope={dirty:U,ctx:i}),c.$set(S)},i(i){J||(b(n.$$.fragment,i),b(d.$$.fragment,i),b(u.$$.fragment,i),b(c.$$.fragment,i),J=!0)},o(i){g(n.$$.fragment,i),g(d.$$.fragment,i),g(u.$$.fragment,i),g(c.$$.fragment,i),J=!1},d(i){i&&(t(w),t(p),t(l)),$(n,i),$(d,i),$(u,i),$(c,i)}}}function Zs(T){let n,w,d,p,u,l,c,J,i,U="Diffusion pipelines are a collection of interchangeable schedulers and models that can be mixed and matched to tailor a pipeline to a specific use case. The scheduler encapsulates the entire denoising process such as the number of denoising steps and the algorithm for finding the denoised sample. A scheduler is not parameterized or trained so they don’t take very much memory. The model is usually only concerned with the forward pass of going from a noisy input to a less noisy sample.",k,j,ie='This guide will show you how to load schedulers and models to customize a pipeline. You’ll use the <a href="https://hf.co/stable-diffusion-v1-5/stable-diffusion-v1-5" rel="nofollow">stable-diffusion-v1-5/stable-diffusion-v1-5</a> checkpoint throughout this guide, so let’s load it first.',S,W,oe,C,Ne="You can see what scheduler this pipeline uses with the <code>pipeline.scheduler</code> attribute.",pe,R,ue,x,de,I,Xe='Schedulers are defined by a configuration file that can be used by a variety of schedulers. Load a scheduler with the <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained">SchedulerMixin.from_pretrained()</a> method, and specify the <code>subfolder</code> parameter to load the configuration file into the correct subfolder of the pipeline repository.',ce,E,De='For example, to load the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>:',fe,L,me,B,Fe="Then you can pass the newly loaded scheduler to the pipeline.",he,H,Me,q,ye,N,ze="Schedulers have their own unique strengths and weaknesses, making it difficult to quantitatively compare which scheduler works best for a pipeline. You typically have to make a trade-off between denoising speed and denoising quality. We recommend trying out different schedulers to find one that works best for your use case. Call the <code>pipeline.scheduler.compatibles</code> attribute to see what schedulers are compatible with a pipeline.",be,X,Qe='Let’s compare the <a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler">EulerDiscreteScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler">EulerAncestralDiscreteScheduler</a>, and the <a href="/docs/diffusers/main/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a> on the following prompt and seed.',ge,D,$e,F,Ye='To change the pipelines scheduler, use the <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin.from_config">from_config()</a> method to load a different scheduler’s <code>pipeline.scheduler.config</code> into the pipeline.',Ze,G,we,_,Ae='<div><img class="rounded-xl" src="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_lms.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">LMSDiscreteScheduler</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_euler_discrete.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">EulerDiscreteScheduler</figcaption></div>',Ue,V,Pe='<div><img class="rounded-xl" src="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_euler_ancestral.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">EulerAncestralDiscreteScheduler</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/diffusers_docs/astronaut_dpm.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">DPMSolverMultistepScheduler</figcaption></div>',ve,z,Ke="Most images look very similar and are comparable in quality. Again, it often comes down to your specific use case so a good approach is to run multiple different schedulers and compare the results.",Te,Q,je,Y,Oe='Models are loaded from the <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained">ModelMixin.from_pretrained()</a> method, which downloads and caches the latest version of the model weights and configurations. If the latest files are available in the local cache, <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained">from_pretrained()</a> reuses files in the cache instead of re-downloading them.',Je,A,es='Models can be loaded from a subfolder with the <code>subfolder</code> argument. For example, the model weights for <a href="https://hf.co/stable-diffusion-v1-5/stable-diffusion-v1-5" rel="nofollow">stable-diffusion-v1-5/stable-diffusion-v1-5</a> are stored in the <a href="https://hf.co/stable-diffusion-v1-5/stable-diffusion-v1-5/tree/main/unet" rel="nofollow">unet</a> subfolder.',Ge,P,_e,K,ss='They can also be directly loaded from a <a href="https://huggingface.co/google/ddpm-cifar10-32/tree/main" rel="nofollow">repository</a>.',Ve,O,ke,ee,ts='To load and save model variants, specify the <code>variant</code> argument in <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained">ModelMixin.from_pretrained()</a> and <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.save_pretrained">ModelMixin.save_pretrained()</a>.',Se,se,We,te,ls='Use the <code>torch_dtype</code> argument in <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained">from_pretrained()</a> to specify the dtype to load a model in.',Ce,le,Re,ae,as='You can also use the <a href="https://docs.pytorch.org/docs/stable/generated/torch.Tensor.to.html" rel="nofollow">torch.Tensor.to</a> method to convert to the specified dtype on the fly. It converts <em>all</em> weights unlike the <code>torch_dtype</code> argument that respects the <code>_keep_in_fp32_modules</code>. This is important for models whose layers must remain in fp32 for numerical stability and best generation quality (see example <a href="https://github.com/huggingface/diffusers/blob/f864a9a352fa4a220d860bfdd1782e3e5af96382/src/diffusers/models/transformers/transformer_wan.py#L374" rel="nofollow">here</a>).',xe,ne,Ie,re,Ee;return u=new Be({props:{title:"Load schedulers and models",local:"load-schedulers-and-models",headingTag:"h1"}}),c=new fs({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/schedulers.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/schedulers.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/schedulers.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/schedulers.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/schedulers.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/schedulers.ipynb"}]}}),W=new v({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKQ==",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;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),R=new v({props:{code:"cGlwZWxpbmUuc2NoZWR1bGVyJTBBUE5ETVNjaGVkdWxlciUyMCU3QiUwQSUyMCUyMCUyMl9jbGFzc19uYW1lJTIyJTNBJTIwJTIyUE5ETVNjaGVkdWxlciUyMiUyQyUwQSUyMCUyMCUyMl9kaWZmdXNlcnNfdmVyc2lvbiUyMiUzQSUyMCUyMjAuMjEuNCUyMiUyQyUwQSUyMCUyMCUyMmJldGFfZW5kJTIyJTNBJTIwMC4wMTIlMkMlMEElMjAlMjAlMjJiZXRhX3NjaGVkdWxlJTIyJTNBJTIwJTIyc2NhbGVkX2xpbmVhciUyMiUyQyUwQSUyMCUyMCUyMmJldGFfc3RhcnQlMjIlM0ElMjAwLjAwMDg1JTJDJTBBJTIwJTIwJTIyY2xpcF9zYW1wbGUlMjIlM0ElMjBmYWxzZSUyQyUwQSUyMCUyMCUyMm51bV90cmFpbl90aW1lc3RlcHMlMjIlM0ElMjAxMDAwJTJDJTBBJTIwJTIwJTIyc2V0X2FscGhhX3RvX29uZSUyMiUzQSUyMGZhbHNlJTJDJTBBJTIwJTIwJTIyc2tpcF9wcmtfc3RlcHMlMjIlM0ElMjB0cnVlJTJDJTBBJTIwJTIwJTIyc3RlcHNfb2Zmc2V0JTIyJTNBJTIwMSUyQyUwQSUyMCUyMCUyMnRpbWVzdGVwX3NwYWNpbmclMjIlM0ElMjAlMjJsZWFkaW5nJTIyJTJDJTBBJTIwJTIwJTIydHJhaW5lZF9iZXRhcyUyMiUzQSUyMG51bGwlMEElN0Q=",highlighted:`pipeline.scheduler
PNDMScheduler {
  <span class="hljs-string">&quot;_class_name&quot;</span>: <span class="hljs-string">&quot;PNDMScheduler&quot;</span>,
  <span class="hljs-string">&quot;_diffusers_version&quot;</span>: <span class="hljs-string">&quot;0.21.4&quot;</span>,
  <span class="hljs-string">&quot;beta_end&quot;</span>: <span class="hljs-number">0.012</span>,
  <span class="hljs-string">&quot;beta_schedule&quot;</span>: <span class="hljs-string">&quot;scaled_linear&quot;</span>,
  <span class="hljs-string">&quot;beta_start&quot;</span>: <span class="hljs-number">0.00085</span>,
  <span class="hljs-string">&quot;clip_sample&quot;</span>: false,
  <span class="hljs-string">&quot;num_train_timesteps&quot;</span>: <span class="hljs-number">1000</span>,
  <span class="hljs-string">&quot;set_alpha_to_one&quot;</span>: false,
  <span class="hljs-string">&quot;skip_prk_steps&quot;</span>: true,
  <span class="hljs-string">&quot;steps_offset&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;timestep_spacing&quot;</span>: <span class="hljs-string">&quot;leading&quot;</span>,
  <span class="hljs-string">&quot;trained_betas&quot;</span>: null
}`,wrap:!1}}),x=new Be({props:{title:"Load a scheduler",local:"load-a-scheduler",headingTag:"h2"}}),L=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERESU1TY2hlZHVsZXIlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQSUwQWRkaW0lMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZCglMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMScheduler, DiffusionPipeline

ddim = DDIMScheduler.from_pretrained(<span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)`,wrap:!1}}),H=new v({props:{code:"cGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmxlLWRpZmZ1c2lvbi12MS01JTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTIwc2NoZWR1bGVyJTNEZGRpbSUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIp",highlighted:`pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, scheduler=ddim, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),q=new Be({props:{title:"Compare schedulers",local:"compare-schedulers",headingTag:"h2"}}),D=new v({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBwaG90b2dyYXBoJTIwb2YlMjBhbiUyMGFzdHJvbmF1dCUyMHJpZGluZyUyMGElMjBob3JzZSUyMG9uJTIwTWFycyUyQyUyMGhpZ2glMjByZXNvbHV0aW9uJTJDJTIwaGlnaCUyMGRlZmluaXRpb24uJTIyJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmN1ZGElMjIpLm1hbnVhbF9zZWVkKDgp",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;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A photograph of an astronaut riding a horse on Mars, high resolution, high definition.&quot;</span>
generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">8</span>)`,wrap:!1}}),G=new hs({props:{id:"schedulers",options:["LMSDiscreteScheduler","EulerDiscreteScheduler","EulerAncestralDiscreteScheduler","DPMSolverMultistepScheduler"],$$slots:{default:[$s]},$$scope:{ctx:T}}}),Q=new Be({props:{title:"Models",local:"models",headingTag:"h2"}}),P=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>)`,wrap:!1}}),O=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRE1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZkZHBtLWNpZmFyMTAtMzIlMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DModel

unet = UNet2DModel.from_pretrained(<span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>)`,wrap:!1}}),se=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwdmFyaWFudCUzRCUyMm5vbl9lbWElMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKSUwQXVuZXQuc2F2ZV9wcmV0cmFpbmVkKCUyMi4lMkZsb2NhbC11bmV0JTIyJTJDJTIwdmFyaWFudCUzRCUyMm5vbl9lbWElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

unet = UNet2DConditionModel.from_pretrained(
    <span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, variant=<span class="hljs-string">&quot;non_ema&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)
unet.save_pretrained(<span class="hljs-string">&quot;./local-unet&quot;</span>, variant=<span class="hljs-string">&quot;non_ema&quot;</span>)`,wrap:!1}}),le=new v({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQXVuZXQlMjAlM0QlMjBBdXRvTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnVuZXQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoModel

unet = AutoModel.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, torch_dtype=torch.float16
)`,wrap:!1}}),ne=new ms({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/schedulers.md"}}),{c(){n=f("meta"),w=r(),d=f("p"),p=r(),h(u.$$.fragment),l=r(),h(c.$$.fragment),J=r(),i=f("p"),i.textContent=U,k=r(),j=f("p"),j.innerHTML=ie,S=r(),h(W.$$.fragment),oe=r(),C=f("p"),C.innerHTML=Ne,pe=r(),h(R.$$.fragment),ue=r(),h(x.$$.fragment),de=r(),I=f("p"),I.innerHTML=Xe,ce=r(),E=f("p"),E.innerHTML=De,fe=r(),h(L.$$.fragment),me=r(),B=f("p"),B.textContent=Fe,he=r(),h(H.$$.fragment),Me=r(),h(q.$$.fragment),ye=r(),N=f("p"),N.innerHTML=ze,be=r(),X=f("p"),X.innerHTML=Qe,ge=r(),h(D.$$.fragment),$e=r(),F=f("p"),F.innerHTML=Ye,Ze=r(),h(G.$$.fragment),we=r(),_=f("div"),_.innerHTML=Ae,Ue=r(),V=f("div"),V.innerHTML=Pe,ve=r(),z=f("p"),z.textContent=Ke,Te=r(),h(Q.$$.fragment),je=r(),Y=f("p"),Y.innerHTML=Oe,Je=r(),A=f("p"),A.innerHTML=es,Ge=r(),h(P.$$.fragment),_e=r(),K=f("p"),K.innerHTML=ss,Ve=r(),h(O.$$.fragment),ke=r(),ee=f("p"),ee.innerHTML=ts,Se=r(),h(se.$$.fragment),We=r(),te=f("p"),te.innerHTML=ls,Ce=r(),h(le.$$.fragment),Re=r(),ae=f("p"),ae.innerHTML=as,xe=r(),h(ne.$$.fragment),Ie=r(),re=f("p"),this.h()},l(e){const s=ds("svelte-u9bgzb",document.head);n=m(s,"META",{name:!0,content:!0}),s.forEach(t),w=o(e),d=m(e,"P",{}),is(d).forEach(t),p=o(e),M(u.$$.fragment,e),l=o(e),M(c.$$.fragment,e),J=o(e),i=m(e,"P",{"data-svelte-h":!0}),Z(i)!=="svelte-147f8qd"&&(i.textContent=U),k=o(e),j=m(e,"P",{"data-svelte-h":!0}),Z(j)!=="svelte-1vfyhb5"&&(j.innerHTML=ie),S=o(e),M(W.$$.fragment,e),oe=o(e),C=m(e,"P",{"data-svelte-h":!0}),Z(C)!=="svelte-bntjs"&&(C.innerHTML=Ne),pe=o(e),M(R.$$.fragment,e),ue=o(e),M(x.$$.fragment,e),de=o(e),I=m(e,"P",{"data-svelte-h":!0}),Z(I)!=="svelte-12wcj3l"&&(I.innerHTML=Xe),ce=o(e),E=m(e,"P",{"data-svelte-h":!0}),Z(E)!=="svelte-1qzt247"&&(E.innerHTML=De),fe=o(e),M(L.$$.fragment,e),me=o(e),B=m(e,"P",{"data-svelte-h":!0}),Z(B)!=="svelte-1gk96nj"&&(B.textContent=Fe),he=o(e),M(H.$$.fragment,e),Me=o(e),M(q.$$.fragment,e),ye=o(e),N=m(e,"P",{"data-svelte-h":!0}),Z(N)!=="svelte-gbqn3x"&&(N.innerHTML=ze),be=o(e),X=m(e,"P",{"data-svelte-h":!0}),Z(X)!=="svelte-1baxatv"&&(X.innerHTML=Qe),ge=o(e),M(D.$$.fragment,e),$e=o(e),F=m(e,"P",{"data-svelte-h":!0}),Z(F)!=="svelte-c6ot8t"&&(F.innerHTML=Ye),Ze=o(e),M(G.$$.fragment,e),we=o(e),_=m(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(_)!=="svelte-k6zsrl"&&(_.innerHTML=Ae),Ue=o(e),V=m(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(V)!=="svelte-8ii4fv"&&(V.innerHTML=Pe),ve=o(e),z=m(e,"P",{"data-svelte-h":!0}),Z(z)!=="svelte-95mtrv"&&(z.textContent=Ke),Te=o(e),M(Q.$$.fragment,e),je=o(e),Y=m(e,"P",{"data-svelte-h":!0}),Z(Y)!=="svelte-1cl76mo"&&(Y.innerHTML=Oe),Je=o(e),A=m(e,"P",{"data-svelte-h":!0}),Z(A)!=="svelte-mll1yp"&&(A.innerHTML=es),Ge=o(e),M(P.$$.fragment,e),_e=o(e),K=m(e,"P",{"data-svelte-h":!0}),Z(K)!=="svelte-1r8gmv0"&&(K.innerHTML=ss),Ve=o(e),M(O.$$.fragment,e),ke=o(e),ee=m(e,"P",{"data-svelte-h":!0}),Z(ee)!=="svelte-12qu4qt"&&(ee.innerHTML=ts),Se=o(e),M(se.$$.fragment,e),We=o(e),te=m(e,"P",{"data-svelte-h":!0}),Z(te)!=="svelte-dg21b5"&&(te.innerHTML=ls),Ce=o(e),M(le.$$.fragment,e),Re=o(e),ae=m(e,"P",{"data-svelte-h":!0}),Z(ae)!=="svelte-dbifto"&&(ae.innerHTML=as),xe=o(e),M(ne.$$.fragment,e),Ie=o(e),re=m(e,"P",{}),is(re).forEach(t),this.h()},h(){Le(n,"name","hf:doc:metadata"),Le(n,"content",ws),Le(_,"class","flex gap-4"),Le(V,"class","flex gap-4")},m(e,s){cs(document.head,n),a(e,w,s),a(e,d,s),a(e,p,s),y(u,e,s),a(e,l,s),y(c,e,s),a(e,J,s),a(e,i,s),a(e,k,s),a(e,j,s),a(e,S,s),y(W,e,s),a(e,oe,s),a(e,C,s),a(e,pe,s),y(R,e,s),a(e,ue,s),y(x,e,s),a(e,de,s),a(e,I,s),a(e,ce,s),a(e,E,s),a(e,fe,s),y(L,e,s),a(e,me,s),a(e,B,s),a(e,he,s),y(H,e,s),a(e,Me,s),y(q,e,s),a(e,ye,s),a(e,N,s),a(e,be,s),a(e,X,s),a(e,ge,s),y(D,e,s),a(e,$e,s),a(e,F,s),a(e,Ze,s),y(G,e,s),a(e,we,s),a(e,_,s),a(e,Ue,s),a(e,V,s),a(e,ve,s),a(e,z,s),a(e,Te,s),y(Q,e,s),a(e,je,s),a(e,Y,s),a(e,Je,s),a(e,A,s),a(e,Ge,s),y(P,e,s),a(e,_e,s),a(e,K,s),a(e,Ve,s),y(O,e,s),a(e,ke,s),a(e,ee,s),a(e,Se,s),y(se,e,s),a(e,We,s),a(e,te,s),a(e,Ce,s),y(le,e,s),a(e,Re,s),a(e,ae,s),a(e,xe,s),y(ne,e,s),a(e,Ie,s),a(e,re,s),Ee=!0},p(e,[s]){const ns={};s&2&&(ns.$$scope={dirty:s,ctx:e}),G.$set(ns)},i(e){Ee||(b(u.$$.fragment,e),b(c.$$.fragment,e),b(W.$$.fragment,e),b(R.$$.fragment,e),b(x.$$.fragment,e),b(L.$$.fragment,e),b(H.$$.fragment,e),b(q.$$.fragment,e),b(D.$$.fragment,e),b(G.$$.fragment,e),b(Q.$$.fragment,e),b(P.$$.fragment,e),b(O.$$.fragment,e),b(se.$$.fragment,e),b(le.$$.fragment,e),b(ne.$$.fragment,e),Ee=!0)},o(e){g(u.$$.fragment,e),g(c.$$.fragment,e),g(W.$$.fragment,e),g(R.$$.fragment,e),g(x.$$.fragment,e),g(L.$$.fragment,e),g(H.$$.fragment,e),g(q.$$.fragment,e),g(D.$$.fragment,e),g(G.$$.fragment,e),g(Q.$$.fragment,e),g(P.$$.fragment,e),g(O.$$.fragment,e),g(se.$$.fragment,e),g(le.$$.fragment,e),g(ne.$$.fragment,e),Ee=!1},d(e){e&&(t(w),t(d),t(p),t(l),t(J),t(i),t(k),t(j),t(S),t(oe),t(C),t(pe),t(ue),t(de),t(I),t(ce),t(E),t(fe),t(me),t(B),t(he),t(Me),t(ye),t(N),t(be),t(X),t(ge),t($e),t(F),t(Ze),t(we),t(_),t(Ue),t(V),t(ve),t(z),t(Te),t(je),t(Y),t(Je),t(A),t(Ge),t(_e),t(K),t(Ve),t(ke),t(ee),t(Se),t(We),t(te),t(Ce),t(Re),t(ae),t(xe),t(Ie),t(re)),t(n),$(u,e),$(c,e),$(W,e),$(R,e),$(x,e),$(L,e),$(H,e),$(q,e),$(D,e),$(G,e),$(Q,e),$(P,e),$(O,e),$(se,e),$(le,e),$(ne,e)}}}const ws='{"title":"Load schedulers and models","local":"load-schedulers-and-models","sections":[{"title":"Load a scheduler","local":"load-a-scheduler","sections":[],"depth":2},{"title":"Compare schedulers","local":"compare-schedulers","sections":[],"depth":2},{"title":"Models","local":"models","sections":[],"depth":2}],"depth":1}';function Us(T){return os(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vs extends ps{constructor(n){super(),us(this,n,Us,Zs,rs,{})}}export{Vs as component};
