import{s as $e,n as ve,o as we}from"../chunks/scheduler.d6170356.js";import{S as xe,i as Me,g as a,s as l,r as Z,A as _e,h as o,f as i,c as n,j as ye,u as U,x as r,k as le,y as Te,a as s,v as k,d as L,t as G,w as j}from"../chunks/index.fcd4cc08.js";import{C as be}from"../chunks/CodeBlock.7b16bdef.js";import{H as W}from"../chunks/Heading.8660bd0e.js";function Ce(ne){let f,B,P,D,u,R,d,ae="Diffusers is the go-to library for state-of-the-art pretrained diffusion models for generating images, audio, and even 3D structures of molecules. Whether you’re looking for a simple inference solution or want to train your own diffusion model, Diffusers is a modular toolbox that supports both. The library is designed with a focus on usability over performance, simple over easy, and customizability over abstractions.",z,m,E,g,oe='There are over 10,000 <code>diffusers</code> compatible pipelines on the Hub which you can find by filtering at the left of <a href="https://huggingface.co/models?library=diffusers&amp;sort=downloads" rel="nofollow">the models page</a>. Diffusion systems are typically composed of multiple components such as text encoder, UNet, VAE, and scheduler. Even though they are not standalone models, the pipeline abstraction makes it easy to use them for inference or training.',S,h,re="You can find diffusion pipelines for many different tasks:",V,c,fe='<li>Generating images from natural language text prompts (<a href="https://huggingface.co/models?library=diffusers&amp;pipeline_tag=text-to-image&amp;sort=downloads" rel="nofollow">text-to-image</a>).</li> <li>Transforming images using natural language text prompts (<a href="https://huggingface.co/models?library=diffusers&amp;pipeline_tag=image-to-image&amp;sort=downloads" rel="nofollow">image-to-image</a>).</li> <li>Generating videos from natural language descriptions (<a href="https://huggingface.co/models?library=diffusers&amp;pipeline_tag=text-to-video&amp;sort=downloads" rel="nofollow">text-to-video</a>).</li>',F,y,pe="You can try out the models directly in the browser if you want to test them out without downloading them, thanks to the in-browser widgets!",X,p,ue='<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/refs%2Fpr%2F35/hub/libraries-diffusers_widget.png"/>',A,b,N,$,de="All <code>diffusers</code> pipelines are a line away from being used! To run generation we recommended to always start from the <code>DiffusionPipeline</code>:",q,v,Q,w,me="If you want to load a specific pipeline component such as the UNet, you can do so by:",I,x,Y,M,K,_,ge='All the <a href="https://huggingface.co/docs/diffusers/main/api/pipelines/overview" rel="nofollow">pipeline classes</a>, <a href="https://huggingface.co/docs/diffusers/main/api/models/overview" rel="nofollow">model classes</a>, and <a href="https://huggingface.co/docs/diffusers/main/api/schedulers/overview" rel="nofollow">scheduler classes</a> are fully compatible with the Hub. More specifically, they can be easily loaded from the Hub using the <code>from_pretrained()</code> method and can be shared with others using the <code>push_to_hub()</code> method.',O,T,he='For more details, please check out the <a href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/push_to_hub" rel="nofollow">documentation</a>.',ee,C,te,H,ce='<li>Diffusers <a href="https://github.com/huggingface/diffusers" rel="nofollow">library</a>.</li> <li>Diffusers <a href="https://huggingface.co/docs/diffusers/index" rel="nofollow">docs</a>.</li>',ie,J,se;return u=new W({props:{title:"Using 🧨 diffusers at Hugging Face",local:"using--diffusers-at-hugging-face",headingTag:"h1"}}),m=new W({props:{title:"Exploring Diffusers in the Hub",local:"exploring-diffusers-in-the-hub",headingTag:"h2"}}),b=new W({props:{title:"Using existing pipelines",local:"using-existing-pipelines",headingTag:"h2"}}),v=new be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyKQ==",highlighted:`<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>)`,wrap:!1}}),x=new be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

unet = UNet2DConditionModel.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>)`,wrap:!1}}),M=new W({props:{title:"Sharing your pipelines and models",local:"sharing-your-pipelines-and-models",headingTag:"h2"}}),C=new W({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),{c(){f=a("meta"),B=l(),P=a("p"),D=l(),Z(u.$$.fragment),R=l(),d=a("p"),d.textContent=ae,z=l(),Z(m.$$.fragment),E=l(),g=a("p"),g.innerHTML=oe,S=l(),h=a("p"),h.textContent=re,V=l(),c=a("ul"),c.innerHTML=fe,F=l(),y=a("p"),y.textContent=pe,X=l(),p=a("div"),p.innerHTML=ue,A=l(),Z(b.$$.fragment),N=l(),$=a("p"),$.innerHTML=de,q=l(),Z(v.$$.fragment),Q=l(),w=a("p"),w.textContent=me,I=l(),Z(x.$$.fragment),Y=l(),Z(M.$$.fragment),K=l(),_=a("p"),_.innerHTML=ge,O=l(),T=a("p"),T.innerHTML=he,ee=l(),Z(C.$$.fragment),te=l(),H=a("ul"),H.innerHTML=ce,ie=l(),J=a("p"),this.h()},l(e){const t=_e("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(i),B=n(e),P=o(e,"P",{}),ye(P).forEach(i),D=n(e),U(u.$$.fragment,e),R=n(e),d=o(e,"P",{"data-svelte-h":!0}),r(d)!=="svelte-m22y1p"&&(d.textContent=ae),z=n(e),U(m.$$.fragment,e),E=n(e),g=o(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-179vgjk"&&(g.innerHTML=oe),S=n(e),h=o(e,"P",{"data-svelte-h":!0}),r(h)!=="svelte-p27v5r"&&(h.textContent=re),V=n(e),c=o(e,"UL",{"data-svelte-h":!0}),r(c)!=="svelte-q5vwlh"&&(c.innerHTML=fe),F=n(e),y=o(e,"P",{"data-svelte-h":!0}),r(y)!=="svelte-1fw1m0z"&&(y.textContent=pe),X=n(e),p=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(p)!=="svelte-dzgzv4"&&(p.innerHTML=ue),A=n(e),U(b.$$.fragment,e),N=n(e),$=o(e,"P",{"data-svelte-h":!0}),r($)!=="svelte-1bbr56i"&&($.innerHTML=de),q=n(e),U(v.$$.fragment,e),Q=n(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-98dc3i"&&(w.textContent=me),I=n(e),U(x.$$.fragment,e),Y=n(e),U(M.$$.fragment,e),K=n(e),_=o(e,"P",{"data-svelte-h":!0}),r(_)!=="svelte-1a9gnjr"&&(_.innerHTML=ge),O=n(e),T=o(e,"P",{"data-svelte-h":!0}),r(T)!=="svelte-ehslmh"&&(T.innerHTML=he),ee=n(e),U(C.$$.fragment,e),te=n(e),H=o(e,"UL",{"data-svelte-h":!0}),r(H)!=="svelte-478azc"&&(H.innerHTML=ce),ie=n(e),J=o(e,"P",{}),ye(J).forEach(i),this.h()},h(){le(f,"name","hf:doc:metadata"),le(f,"content",He),le(p,"class","flex justify-center")},m(e,t){Te(document.head,f),s(e,B,t),s(e,P,t),s(e,D,t),k(u,e,t),s(e,R,t),s(e,d,t),s(e,z,t),k(m,e,t),s(e,E,t),s(e,g,t),s(e,S,t),s(e,h,t),s(e,V,t),s(e,c,t),s(e,F,t),s(e,y,t),s(e,X,t),s(e,p,t),s(e,A,t),k(b,e,t),s(e,N,t),s(e,$,t),s(e,q,t),k(v,e,t),s(e,Q,t),s(e,w,t),s(e,I,t),k(x,e,t),s(e,Y,t),k(M,e,t),s(e,K,t),s(e,_,t),s(e,O,t),s(e,T,t),s(e,ee,t),k(C,e,t),s(e,te,t),s(e,H,t),s(e,ie,t),s(e,J,t),se=!0},p:ve,i(e){se||(L(u.$$.fragment,e),L(m.$$.fragment,e),L(b.$$.fragment,e),L(v.$$.fragment,e),L(x.$$.fragment,e),L(M.$$.fragment,e),L(C.$$.fragment,e),se=!0)},o(e){G(u.$$.fragment,e),G(m.$$.fragment,e),G(b.$$.fragment,e),G(v.$$.fragment,e),G(x.$$.fragment,e),G(M.$$.fragment,e),G(C.$$.fragment,e),se=!1},d(e){e&&(i(B),i(P),i(D),i(R),i(d),i(z),i(E),i(g),i(S),i(h),i(V),i(c),i(F),i(y),i(X),i(p),i(A),i(N),i($),i(q),i(Q),i(w),i(I),i(Y),i(K),i(_),i(O),i(T),i(ee),i(te),i(H),i(ie),i(J)),i(f),j(u,e),j(m,e),j(b,e),j(v,e),j(x,e),j(M,e),j(C,e)}}}const He='{"title":"Using 🧨 diffusers at Hugging Face","local":"using--diffusers-at-hugging-face","sections":[{"title":"Exploring Diffusers in the Hub","local":"exploring-diffusers-in-the-hub","sections":[],"depth":2},{"title":"Using existing pipelines","local":"using-existing-pipelines","sections":[],"depth":2},{"title":"Sharing your pipelines and models","local":"sharing-your-pipelines-and-models","sections":[],"depth":2},{"title":"Additional resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function Ze(ne){return we(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends xe{constructor(f){super(),Me(this,f,Ze,Ce,$e,{})}}export{je as component};
