import{s as ve,n as xe,o as Me}from"../chunks/scheduler.d6170356.js";import{S as _e,i as Te,g as a,s as l,r as u,A as Ce,h as o,f as i,c as n,j as $e,u as d,x as r,k as ae,y as He,a as s,v as m,d as g,t as h,w as c}from"../chunks/index.fcd4cc08.js";import{C as we}from"../chunks/CodeBlock.7b16bdef.js";import{H as B,E as Ze}from"../chunks/EditOnGithub.da2b595c.js";function Ue(oe){let f,D,J,E,y,R,b,re="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,$,S,w,fe='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.',V,v,pe="You can find diffusion pipelines for many different tasks:",F,x,ue='<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>',X,M,de="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!",A,p,me='<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/refs%2Fpr%2F35/hub/libraries-diffusers_widget.png"/>',N,_,q,T,ge="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,C,I,H,he="If you want to load a specific pipeline component such as the UNet, you can do so by:",Y,Z,O,U,K,k,ce='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.',ee,G,ye='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>.',te,L,ie,j,be='<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>',se,P,le,W,ne;return y=new B({props:{title:"Using 🧨 diffusers at Hugging Face",local:"using--diffusers-at-hugging-face",headingTag:"h1"}}),$=new B({props:{title:"Exploring Diffusers in the Hub",local:"exploring-diffusers-in-the-hub",headingTag:"h2"}}),_=new B({props:{title:"Using existing pipelines",local:"using-existing-pipelines",headingTag:"h2"}}),C=new we({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}}),Z=new we({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}}),U=new B({props:{title:"Sharing your pipelines and models",local:"sharing-your-pipelines-and-models",headingTag:"h2"}}),L=new B({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),P=new Ze({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/diffusers.md"}}),{c(){f=a("meta"),D=l(),J=a("p"),E=l(),u(y.$$.fragment),R=l(),b=a("p"),b.textContent=re,z=l(),u($.$$.fragment),S=l(),w=a("p"),w.innerHTML=fe,V=l(),v=a("p"),v.textContent=pe,F=l(),x=a("ul"),x.innerHTML=ue,X=l(),M=a("p"),M.textContent=de,A=l(),p=a("div"),p.innerHTML=me,N=l(),u(_.$$.fragment),q=l(),T=a("p"),T.innerHTML=ge,Q=l(),u(C.$$.fragment),I=l(),H=a("p"),H.textContent=he,Y=l(),u(Z.$$.fragment),O=l(),u(U.$$.fragment),K=l(),k=a("p"),k.innerHTML=ce,ee=l(),G=a("p"),G.innerHTML=ye,te=l(),u(L.$$.fragment),ie=l(),j=a("ul"),j.innerHTML=be,se=l(),u(P.$$.fragment),le=l(),W=a("p"),this.h()},l(e){const t=Ce("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(i),D=n(e),J=o(e,"P",{}),$e(J).forEach(i),E=n(e),d(y.$$.fragment,e),R=n(e),b=o(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-m22y1p"&&(b.textContent=re),z=n(e),d($.$$.fragment,e),S=n(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-179vgjk"&&(w.innerHTML=fe),V=n(e),v=o(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-p27v5r"&&(v.textContent=pe),F=n(e),x=o(e,"UL",{"data-svelte-h":!0}),r(x)!=="svelte-q5vwlh"&&(x.innerHTML=ue),X=n(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-1fw1m0z"&&(M.textContent=de),A=n(e),p=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(p)!=="svelte-dzgzv4"&&(p.innerHTML=me),N=n(e),d(_.$$.fragment,e),q=n(e),T=o(e,"P",{"data-svelte-h":!0}),r(T)!=="svelte-1bbr56i"&&(T.innerHTML=ge),Q=n(e),d(C.$$.fragment,e),I=n(e),H=o(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-98dc3i"&&(H.textContent=he),Y=n(e),d(Z.$$.fragment,e),O=n(e),d(U.$$.fragment,e),K=n(e),k=o(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-1a9gnjr"&&(k.innerHTML=ce),ee=n(e),G=o(e,"P",{"data-svelte-h":!0}),r(G)!=="svelte-ehslmh"&&(G.innerHTML=ye),te=n(e),d(L.$$.fragment,e),ie=n(e),j=o(e,"UL",{"data-svelte-h":!0}),r(j)!=="svelte-478azc"&&(j.innerHTML=be),se=n(e),d(P.$$.fragment,e),le=n(e),W=o(e,"P",{}),$e(W).forEach(i),this.h()},h(){ae(f,"name","hf:doc:metadata"),ae(f,"content",ke),ae(p,"class","flex justify-center")},m(e,t){He(document.head,f),s(e,D,t),s(e,J,t),s(e,E,t),m(y,e,t),s(e,R,t),s(e,b,t),s(e,z,t),m($,e,t),s(e,S,t),s(e,w,t),s(e,V,t),s(e,v,t),s(e,F,t),s(e,x,t),s(e,X,t),s(e,M,t),s(e,A,t),s(e,p,t),s(e,N,t),m(_,e,t),s(e,q,t),s(e,T,t),s(e,Q,t),m(C,e,t),s(e,I,t),s(e,H,t),s(e,Y,t),m(Z,e,t),s(e,O,t),m(U,e,t),s(e,K,t),s(e,k,t),s(e,ee,t),s(e,G,t),s(e,te,t),m(L,e,t),s(e,ie,t),s(e,j,t),s(e,se,t),m(P,e,t),s(e,le,t),s(e,W,t),ne=!0},p:xe,i(e){ne||(g(y.$$.fragment,e),g($.$$.fragment,e),g(_.$$.fragment,e),g(C.$$.fragment,e),g(Z.$$.fragment,e),g(U.$$.fragment,e),g(L.$$.fragment,e),g(P.$$.fragment,e),ne=!0)},o(e){h(y.$$.fragment,e),h($.$$.fragment,e),h(_.$$.fragment,e),h(C.$$.fragment,e),h(Z.$$.fragment,e),h(U.$$.fragment,e),h(L.$$.fragment,e),h(P.$$.fragment,e),ne=!1},d(e){e&&(i(D),i(J),i(E),i(R),i(b),i(z),i(S),i(w),i(V),i(v),i(F),i(x),i(X),i(M),i(A),i(p),i(N),i(q),i(T),i(Q),i(I),i(H),i(Y),i(O),i(K),i(k),i(ee),i(G),i(te),i(ie),i(j),i(se),i(le),i(W)),i(f),c(y,e),c($,e),c(_,e),c(C,e),c(Z,e),c(U,e),c(L,e),c(P,e)}}}const ke='{"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 Ge(oe){return Me(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends _e{constructor(f){super(),Te(this,f,Ge,Ue,ve,{})}}export{We as component};
