import{s as pe,n as oe,o as fe}from"../chunks/scheduler.53228c21.js";import{S as re,i as me,e as n,s,c as T,h as ue,a as p,d as t,b as a,f as ae,g as j,j as f,k as ne,l as de,m as l,n as U,t as _,o as W,p as $}from"../chunks/index.100fac89.js";import{C as ce}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{C as z}from"../chunks/CodeBlock.d30a6509.js";import{H as he,E as Me}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function ge(D){let o,X,P,G,r,k,m,v,u,N='<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.',x,d,K='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.',L,c,O='<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.',S,h,A,M,ee='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.',C,g,q,b,ie='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.',Y,y,te="Trying to load an unsupported model returns an error.",B,J,H,w,le='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.',F,I,se='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.',Q,Z,V,E,R;return r=new ce({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),m=new he({props:{title:"AutoPipeline",local:"autopipeline",headingTag:"h1"}}),h=new z({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}}),g=new z({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}}),J=new z({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}}),Z=new Me({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/tutorials/autopipeline.md"}}),{c(){o=n("meta"),X=s(),P=n("p"),G=s(),T(r.$$.fragment),k=s(),T(m.$$.fragment),v=s(),u=n("p"),u.innerHTML=N,x=s(),d=n("p"),d.innerHTML=K,L=s(),c=n("p"),c.innerHTML=O,S=s(),T(h.$$.fragment),A=s(),M=n("p"),M.innerHTML=ee,C=s(),T(g.$$.fragment),q=s(),b=n("p"),b.innerHTML=ie,Y=s(),y=n("p"),y.textContent=te,B=s(),T(J.$$.fragment),H=s(),w=n("p"),w.innerHTML=le,F=s(),I=n("p"),I.innerHTML=se,Q=s(),T(Z.$$.fragment),V=s(),E=n("p"),this.h()},l(e){const i=ue("svelte-u9bgzb",document.head);o=p(i,"META",{name:!0,content:!0}),i.forEach(t),X=a(e),P=p(e,"P",{}),ae(P).forEach(t),G=a(e),j(r.$$.fragment,e),k=a(e),j(m.$$.fragment,e),v=a(e),u=p(e,"P",{"data-svelte-h":!0}),f(u)!=="svelte-15pjr1q"&&(u.innerHTML=N),x=a(e),d=p(e,"P",{"data-svelte-h":!0}),f(d)!=="svelte-xgpkk6"&&(d.innerHTML=K),L=a(e),c=p(e,"P",{"data-svelte-h":!0}),f(c)!=="svelte-qczk43"&&(c.innerHTML=O),S=a(e),j(h.$$.fragment,e),A=a(e),M=p(e,"P",{"data-svelte-h":!0}),f(M)!=="svelte-15q8tzs"&&(M.innerHTML=ee),C=a(e),j(g.$$.fragment,e),q=a(e),b=p(e,"P",{"data-svelte-h":!0}),f(b)!=="svelte-1jztso9"&&(b.innerHTML=ie),Y=a(e),y=p(e,"P",{"data-svelte-h":!0}),f(y)!=="svelte-72na4b"&&(y.textContent=te),B=a(e),j(J.$$.fragment,e),H=a(e),w=p(e,"P",{"data-svelte-h":!0}),f(w)!=="svelte-tqh96g"&&(w.innerHTML=le),F=a(e),I=p(e,"P",{"data-svelte-h":!0}),f(I)!=="svelte-1ybkpq8"&&(I.innerHTML=se),Q=a(e),j(Z.$$.fragment,e),V=a(e),E=p(e,"P",{}),ae(E).forEach(t),this.h()},h(){ne(o,"name","hf:doc:metadata"),ne(o,"content",be)},m(e,i){de(document.head,o),l(e,X,i),l(e,P,i),l(e,G,i),U(r,e,i),l(e,k,i),U(m,e,i),l(e,v,i),l(e,u,i),l(e,x,i),l(e,d,i),l(e,L,i),l(e,c,i),l(e,S,i),U(h,e,i),l(e,A,i),l(e,M,i),l(e,C,i),U(g,e,i),l(e,q,i),l(e,b,i),l(e,Y,i),l(e,y,i),l(e,B,i),U(J,e,i),l(e,H,i),l(e,w,i),l(e,F,i),l(e,I,i),l(e,Q,i),U(Z,e,i),l(e,V,i),l(e,E,i),R=!0},p:oe,i(e){R||(_(r.$$.fragment,e),_(m.$$.fragment,e),_(h.$$.fragment,e),_(g.$$.fragment,e),_(J.$$.fragment,e),_(Z.$$.fragment,e),R=!0)},o(e){W(r.$$.fragment,e),W(m.$$.fragment,e),W(h.$$.fragment,e),W(g.$$.fragment,e),W(J.$$.fragment,e),W(Z.$$.fragment,e),R=!1},d(e){e&&(t(X),t(P),t(G),t(k),t(v),t(u),t(x),t(d),t(L),t(c),t(S),t(A),t(M),t(C),t(q),t(b),t(Y),t(y),t(B),t(H),t(w),t(F),t(I),t(Q),t(V),t(E)),t(o),$(r,e),$(m,e),$(h,e),$(g,e),$(J,e),$(Z,e)}}}const be='{"title":"AutoPipeline","local":"autopipeline","sections":[],"depth":1}';function ye(D){return fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends re{constructor(o){super(),me(this,o,ye,ge,pe,{})}}export{je as component};
