import{s as ae,n as ne,o as pe}from"../chunks/scheduler.8c3d61f6.js";import{S as oe,i as fe,g as n,s,r as j,A as re,h as p,f as t,c as a,j as le,u as U,x as f,k as se,y as ue,a as l,v as _,d as W,t as P,w as E}from"../chunks/index.da70eac4.js";import{C as V}from"../chunks/CodeBlock.a9c4becf.js";import{H as me,E as de}from"../chunks/getInferenceSnippets.cd165132.js";function ce(R){let o,X,Z,G,r,k,u,D='<a href="../api/models/auto_model">AutoPipeline</a> is a <em>task-and-model</em> pipeline that automatically selects the correct pipeline subclass based on the task. It handles the complexity of loading different pipeline subclasses without needing to know the specific pipeline subclass name.',v,m,z='This is unlike <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>, a <em>model-only</em> pipeline that automatically selects the pipeline subclass based on the model.',$,d,N='<a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForImage2Image">AutoPipelineForImage2Image</a> returns a specific pipeline subclass, (for example, <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline">StableDiffusionXLImg2ImgPipeline</a>), which can only be used for image-to-image tasks.',x,c,L,h,K='Loading the same model with <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> returns the <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline">StableDiffusionXLPipeline</a> subclass. It can be used for text-to-image, image-to-image, or inpainting tasks depending on the inputs.',A,M,S,g,O='Check the <a href="https://github.com/huggingface/diffusers/blob/130fd8df54f24ffb006d84787b598d8adc899f23/src/diffusers/pipelines/auto_pipeline.py#L114" rel="nofollow">mappings</a> to see whether a model is supported or not.',q,b,ee="Trying to load an unsupported model returns an error.",C,y,Y,J,ie='There are three types of <a href="../api/models/auto_model">AutoPipeline</a> classes, <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForText2Image">AutoPipelineForText2Image</a>, <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForImage2Image">AutoPipelineForImage2Image</a> and <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForInpainting">AutoPipelineForInpainting</a>. Each of these classes have a predefined mapping, linking a pipeline to their task-specific subclass.',B,w,te='When <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForText2Image.from_pretrained">from_pretrained()</a> is called, it extracts the class name from the <code>model_index.json</code> file and selects the appropriate pipeline subclass for the task based on the mapping.',H,I,F,T,Q;return r=new me({props:{title:"AutoPipeline",local:"autopipeline",headingTag:"h1"}}),c=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UlMEElMEFwaXBlbGluZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjJSdW5EaWZmdXNpb24lMkZKdWdnZXJuYXV0LVhMLXY5JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUyMGRldmljZV9tYXAlM0QlMjJjdWRhJTIyJTJDJTBBKSUwQXByaW50KHBpcGVsaW5lKSUwQSUyMlN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lJTIwJTdCJTBBJTIwJTIwJTIyX2NsYXNzX25hbWUlMjIlM0ElMjAlMjJTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUyMiUyQyUwQSUyMCUyMC4uLiUwQSUyMg==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image

pipeline = AutoPipelineForImage2Image.from_pretrained(
  <span class="hljs-string">&quot;RunDiffusion/Juggernaut-XL-v9&quot;</span>, torch_dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;cuda&quot;</span>,
)
<span class="hljs-built_in">print</span>(pipeline)
<span class="hljs-string">&quot;StableDiffusionXLImg2ImgPipeline {
  &quot;</span>_class_name<span class="hljs-string">&quot;: &quot;</span>StableDiffusionXLImg2ImgPipeline<span class="hljs-string">&quot;,
  ...
&quot;</span>`,wrap:!1}}),M=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjJSdW5EaWZmdXNpb24lMkZKdWdnZXJuYXV0LVhMLXY5JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUyMGRldmljZV9tYXAlM0QlMjJjdWRhJTIyJTJDJTBBKSUwQXByaW50KHBpcGVsaW5lKSUwQSUyMlN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMjAlN0IlMEElMjAlMjAlMjJfY2xhc3NfbmFtZSUyMiUzQSUyMCUyMlN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMjIlMkMlMEElMjAlMjAuLi4lMEElMjI=",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;RunDiffusion/Juggernaut-XL-v9&quot;</span>, torch_dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;cuda&quot;</span>,
)
<span class="hljs-built_in">print</span>(pipeline)
<span class="hljs-string">&quot;StableDiffusionXLPipeline {
  &quot;</span>_class_name<span class="hljs-string">&quot;: &quot;</span>StableDiffusionXLPipeline<span class="hljs-string">&quot;,
  ...
&quot;</span>`,wrap:!1}}),y=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UlMEElMEFwaXBlbGluZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZzaGFwLWUtaW1nMmltZyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSklMEElMjJWYWx1ZUVycm9yJTNBJTIwQXV0b1BpcGVsaW5lJTIwY2FuJ3QlMjBmaW5kJTIwYSUyMHBpcGVsaW5lJTIwbGlua2VkJTIwdG8lMjBTaGFwRUltZzJJbWdQaXBlbGluZSUyMGZvciUyME5vbmUlMjI=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image

pipeline = AutoPipelineForImage2Image.from_pretrained(
    <span class="hljs-string">&quot;openai/shap-e-img2img&quot;</span>, torch_dtype=torch.float16,
)
<span class="hljs-string">&quot;ValueError: AutoPipeline can&#x27;t find a pipeline linked to ShapEImg2ImgPipeline for None&quot;</span>`,wrap:!1}}),I=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/tutorials/autopipeline.md"}}),{c(){o=n("meta"),X=s(),Z=n("p"),G=s(),j(r.$$.fragment),k=s(),u=n("p"),u.innerHTML=D,v=s(),m=n("p"),m.innerHTML=z,$=s(),d=n("p"),d.innerHTML=N,x=s(),j(c.$$.fragment),L=s(),h=n("p"),h.innerHTML=K,A=s(),j(M.$$.fragment),S=s(),g=n("p"),g.innerHTML=O,q=s(),b=n("p"),b.textContent=ee,C=s(),j(y.$$.fragment),Y=s(),J=n("p"),J.innerHTML=ie,B=s(),w=n("p"),w.innerHTML=te,H=s(),j(I.$$.fragment),F=s(),T=n("p"),this.h()},l(e){const i=re("svelte-u9bgzb",document.head);o=p(i,"META",{name:!0,content:!0}),i.forEach(t),X=a(e),Z=p(e,"P",{}),le(Z).forEach(t),G=a(e),U(r.$$.fragment,e),k=a(e),u=p(e,"P",{"data-svelte-h":!0}),f(u)!=="svelte-15pjr1q"&&(u.innerHTML=D),v=a(e),m=p(e,"P",{"data-svelte-h":!0}),f(m)!=="svelte-xgpkk6"&&(m.innerHTML=z),$=a(e),d=p(e,"P",{"data-svelte-h":!0}),f(d)!=="svelte-qczk43"&&(d.innerHTML=N),x=a(e),U(c.$$.fragment,e),L=a(e),h=p(e,"P",{"data-svelte-h":!0}),f(h)!=="svelte-15q8tzs"&&(h.innerHTML=K),A=a(e),U(M.$$.fragment,e),S=a(e),g=p(e,"P",{"data-svelte-h":!0}),f(g)!=="svelte-1jztso9"&&(g.innerHTML=O),q=a(e),b=p(e,"P",{"data-svelte-h":!0}),f(b)!=="svelte-72na4b"&&(b.textContent=ee),C=a(e),U(y.$$.fragment,e),Y=a(e),J=p(e,"P",{"data-svelte-h":!0}),f(J)!=="svelte-tqh96g"&&(J.innerHTML=ie),B=a(e),w=p(e,"P",{"data-svelte-h":!0}),f(w)!=="svelte-1ybkpq8"&&(w.innerHTML=te),H=a(e),U(I.$$.fragment,e),F=a(e),T=p(e,"P",{}),le(T).forEach(t),this.h()},h(){se(o,"name","hf:doc:metadata"),se(o,"content",he)},m(e,i){ue(document.head,o),l(e,X,i),l(e,Z,i),l(e,G,i),_(r,e,i),l(e,k,i),l(e,u,i),l(e,v,i),l(e,m,i),l(e,$,i),l(e,d,i),l(e,x,i),_(c,e,i),l(e,L,i),l(e,h,i),l(e,A,i),_(M,e,i),l(e,S,i),l(e,g,i),l(e,q,i),l(e,b,i),l(e,C,i),_(y,e,i),l(e,Y,i),l(e,J,i),l(e,B,i),l(e,w,i),l(e,H,i),_(I,e,i),l(e,F,i),l(e,T,i),Q=!0},p:ne,i(e){Q||(W(r.$$.fragment,e),W(c.$$.fragment,e),W(M.$$.fragment,e),W(y.$$.fragment,e),W(I.$$.fragment,e),Q=!0)},o(e){P(r.$$.fragment,e),P(c.$$.fragment,e),P(M.$$.fragment,e),P(y.$$.fragment,e),P(I.$$.fragment,e),Q=!1},d(e){e&&(t(X),t(Z),t(G),t(k),t(u),t(v),t(m),t($),t(d),t(x),t(L),t(h),t(A),t(S),t(g),t(q),t(b),t(C),t(Y),t(J),t(B),t(w),t(H),t(F),t(T)),t(o),E(r,e),E(c,e),E(M,e),E(y,e),E(I,e)}}}const he='{"title":"AutoPipeline","local":"autopipeline","sections":[],"depth":1}';function Me(R){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class we extends oe{constructor(o){super(),fe(this,o,Me,ce,ae,{})}}export{we as component};
