import{s as ae,o as re,n as oe}from"../chunks/scheduler.182ea377.js";import{S as ne,i as se,g as h,s as l,r as w,A as ie,h as u,f as a,c as p,j as G,u as v,x as D,k as W,y as $,a as i,v as P,d as M,t as y,w as I}from"../chunks/index.abf12888.js";import{T as de}from"../chunks/Tip.230e2334.js";import{D as Q}from"../chunks/Docstring.93f6f462.js";import{C as le}from"../chunks/CodeBlock.57fe6e13.js";import{E as pe}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as te}from"../chunks/Heading.16916d63.js";function ce(L){let t,g='Learn how to load an IP-Adapter checkpoint and image in the <a href="../../using-diffusers/loading_adapters#ip-adapter">IP-Adapter</a> loading guide.';return{c(){t=h("p"),t.innerHTML=g},l(n){t=u(n,"P",{"data-svelte-h":!0}),D(t)!=="svelte-1tbuho3"&&(t.innerHTML=g)},m(n,s){i(n,t,s)},p:oe,d(n){n&&a(t)}}}function fe(L){let t,g="Examples:",n,s,c;return s=new le({props:{code:"JTIzJTIwQXNzdW1pbmclMjAlNjBwaXBlbGluZSU2MCUyMGlzJTIwYWxyZWFkeSUyMGxvYWRlZCUyMHdpdGglMjB0aGUlMjBJUCUyMEFkYXB0ZXIlMjB3ZWlnaHRzLiUwQXBpcGVsaW5lLnVubG9hZF9pcF9hZGFwdGVyKCklMEEuLi4=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming `pipeline` is already loaded with the IP Adapter weights.</span>\n<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.unload_ip_adapter()\n<span class="hljs-meta">&gt;&gt;&gt; </span>...',wrap:!1}}),{c(){t=h("p"),t.textContent=g,n=l(),w(s.$$.fragment)},l(r){t=u(r,"P",{"data-svelte-h":!0}),D(t)!=="svelte-kvfsh7"&&(t.textContent=g),n=p(r),v(s.$$.fragment,r)},m(r,f){i(r,t,f),i(r,n,f),P(s,r,f),c=!0},p:oe,i(r){c||(M(s.$$.fragment,r),c=!0)},o(r){y(s.$$.fragment,r),c=!1},d(r){r&&(a(t),a(n)),I(s,r)}}}function me(L){let t,g,n,s,c,r,f,K='<a href="https://hf.co/papers/2308.06721" rel="nofollow">IP-Adapter</a> is a lightweight adapter that enables prompting a diffusion model with an image. This method decouples the cross-attention layers of the image and text features. The image features are generated from an image encoder. Files generated from IP-Adapter are only ~100MBs.',q,x,Z,A,z,d,T,X,E,O="Mixin for handling IP Adapters.",J,H,k,R,_,C,Y,U,ee="Unloads the IP Adapter weights",N,b,V,B,S;return c=new te({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h1"}}),x=new de({props:{$$slots:{default:[ce]},$$scope:{ctx:L}}}),A=new te({props:{title:"IPAdapterMixin",local:"diffusers.loaders.IPAdapterMixin",headingTag:"h2"}}),T=new Q({props:{name:"class diffusers.loaders.IPAdapterMixin",anchor:"diffusers.loaders.IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L42"}}),k=new Q({props:{name:"load_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"subfolder",val:": str"},{name:"weight_name",val:": str"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on
the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the model weights saved
with <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.save_pretrained">ModelMixin.save_pretrained()</a>.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
is not used.`,name:"cache_dir"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.token",description:`<strong>token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"token"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
allowed by Git.`,name:"revision"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L45"}}),C=new Q({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L163"}}),b=new pe({props:{anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[fe]},$$scope:{ctx:L}}}),{c(){t=h("meta"),g=l(),n=h("p"),s=l(),w(c.$$.fragment),r=l(),f=h("p"),f.innerHTML=K,q=l(),w(x.$$.fragment),Z=l(),w(A.$$.fragment),z=l(),d=h("div"),w(T.$$.fragment),X=l(),E=h("p"),E.textContent=O,J=l(),H=h("div"),w(k.$$.fragment),R=l(),_=h("div"),w(C.$$.fragment),Y=l(),U=h("p"),U.textContent=ee,N=l(),w(b.$$.fragment),V=l(),B=h("p"),this.h()},l(e){const o=ie("svelte-u9bgzb",document.head);t=u(o,"META",{name:!0,content:!0}),o.forEach(a),g=p(e),n=u(e,"P",{}),G(n).forEach(a),s=p(e),v(c.$$.fragment,e),r=p(e),f=u(e,"P",{"data-svelte-h":!0}),D(f)!=="svelte-of58ky"&&(f.innerHTML=K),q=p(e),v(x.$$.fragment,e),Z=p(e),v(A.$$.fragment,e),z=p(e),d=u(e,"DIV",{class:!0});var m=G(d);v(T.$$.fragment,m),X=p(m),E=u(m,"P",{"data-svelte-h":!0}),D(E)!=="svelte-geelri"&&(E.textContent=O),J=p(m),H=u(m,"DIV",{class:!0});var F=G(H);v(k.$$.fragment,F),F.forEach(a),R=p(m),_=u(m,"DIV",{class:!0});var j=G(_);v(C.$$.fragment,j),Y=p(j),U=u(j,"P",{"data-svelte-h":!0}),D(U)!=="svelte-io61ja"&&(U.textContent=ee),N=p(j),v(b.$$.fragment,j),j.forEach(a),m.forEach(a),V=p(e),B=u(e,"P",{}),G(B).forEach(a),this.h()},h(){W(t,"name","hf:doc:metadata"),W(t,"content",he),W(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,o){$(document.head,t),i(e,g,o),i(e,n,o),i(e,s,o),P(c,e,o),i(e,r,o),i(e,f,o),i(e,q,o),P(x,e,o),i(e,Z,o),P(A,e,o),i(e,z,o),i(e,d,o),P(T,d,null),$(d,X),$(d,E),$(d,J),$(d,H),P(k,H,null),$(d,R),$(d,_),P(C,_,null),$(_,Y),$(_,U),$(_,N),P(b,_,null),i(e,V,o),i(e,B,o),S=!0},p(e,[o]){const m={};o&2&&(m.$$scope={dirty:o,ctx:e}),x.$set(m);const F={};o&2&&(F.$$scope={dirty:o,ctx:e}),b.$set(F)},i(e){S||(M(c.$$.fragment,e),M(x.$$.fragment,e),M(A.$$.fragment,e),M(T.$$.fragment,e),M(k.$$.fragment,e),M(C.$$.fragment,e),M(b.$$.fragment,e),S=!0)},o(e){y(c.$$.fragment,e),y(x.$$.fragment,e),y(A.$$.fragment,e),y(T.$$.fragment,e),y(k.$$.fragment,e),y(C.$$.fragment,e),y(b.$$.fragment,e),S=!1},d(e){e&&(a(g),a(n),a(s),a(r),a(f),a(q),a(Z),a(z),a(d),a(V),a(B)),a(t),I(c,e),I(x,e),I(A,e),I(T),I(k),I(C),I(b)}}}const he='{"title":"IP-Adapter","local":"ip-adapter","sections":[{"title":"IPAdapterMixin","local":"diffusers.loaders.IPAdapterMixin","sections":[],"depth":2}],"depth":1}';function ue(L){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pe extends ne{constructor(t){super(),se(this,t,ue,me,ae,{})}}export{Pe as component};
