import{s as ae,o as re,n as oe}from"../chunks/scheduler.182ea377.js";import{S as ne,i as se,g as u,s as l,r as w,A as de,h,f as a,c as p,j as G,u as v,x as q,k as W,y as $,a as d,v as P,d as M,t as I,w as y}from"../chunks/index.abf12888.js";import{T as ie}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=u("p"),t.innerHTML=g},l(n){t=h(n,"P",{"data-svelte-h":!0}),q(t)!=="svelte-1tbuho3"&&(t.innerHTML=g)},m(n,s){d(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=u("p"),t.textContent=g,n=l(),w(s.$$.fragment)},l(r){t=h(r,"P",{"data-svelte-h":!0}),q(t)!=="svelte-kvfsh7"&&(t.textContent=g),n=p(r),v(s.$$.fragment,r)},m(r,f){d(r,t,f),d(r,n,f),P(s,r,f),c=!0},p:oe,i(r){c||(M(s.$$.fragment,r),c=!0)},o(r){I(s.$$.fragment,r),c=!1},d(r){r&&(a(t),a(n)),y(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.',D,x,Z,A,z,i,T,X,U,O="Mixin for handling IP Adapters.",J,E,k,R,_,C,Y,H,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 ie({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/v0.26.3/src/diffusers/loaders/ip_adapter.py#L43"}}),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:": Union"},{name:"subfolder",val:": Union"},{name:"weight_name",val:": Union"},{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/v0.26.3/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/v0.26.3/src/diffusers/loaders/ip_adapter.py#L46"}}),C=new Q({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.26.3/src/diffusers/loaders/ip_adapter.py#L191"}}),b=new pe({props:{anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[fe]},$$scope:{ctx:L}}}),{c(){t=u("meta"),g=l(),n=u("p"),s=l(),w(c.$$.fragment),r=l(),f=u("p"),f.innerHTML=K,D=l(),w(x.$$.fragment),Z=l(),w(A.$$.fragment),z=l(),i=u("div"),w(T.$$.fragment),X=l(),U=u("p"),U.textContent=O,J=l(),E=u("div"),w(k.$$.fragment),R=l(),_=u("div"),w(C.$$.fragment),Y=l(),H=u("p"),H.textContent=ee,N=l(),w(b.$$.fragment),V=l(),B=u("p"),this.h()},l(e){const o=de("svelte-u9bgzb",document.head);t=h(o,"META",{name:!0,content:!0}),o.forEach(a),g=p(e),n=h(e,"P",{}),G(n).forEach(a),s=p(e),v(c.$$.fragment,e),r=p(e),f=h(e,"P",{"data-svelte-h":!0}),q(f)!=="svelte-of58ky"&&(f.innerHTML=K),D=p(e),v(x.$$.fragment,e),Z=p(e),v(A.$$.fragment,e),z=p(e),i=h(e,"DIV",{class:!0});var m=G(i);v(T.$$.fragment,m),X=p(m),U=h(m,"P",{"data-svelte-h":!0}),q(U)!=="svelte-geelri"&&(U.textContent=O),J=p(m),E=h(m,"DIV",{class:!0});var F=G(E);v(k.$$.fragment,F),F.forEach(a),R=p(m),_=h(m,"DIV",{class:!0});var j=G(_);v(C.$$.fragment,j),Y=p(j),H=h(j,"P",{"data-svelte-h":!0}),q(H)!=="svelte-io61ja"&&(H.textContent=ee),N=p(j),v(b.$$.fragment,j),j.forEach(a),m.forEach(a),V=p(e),B=h(e,"P",{}),G(B).forEach(a),this.h()},h(){W(t,"name","hf:doc:metadata"),W(t,"content",ue),W(E,"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(i,"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),d(e,g,o),d(e,n,o),d(e,s,o),P(c,e,o),d(e,r,o),d(e,f,o),d(e,D,o),P(x,e,o),d(e,Z,o),P(A,e,o),d(e,z,o),d(e,i,o),P(T,i,null),$(i,X),$(i,U),$(i,J),$(i,E),P(k,E,null),$(i,R),$(i,_),P(C,_,null),$(_,Y),$(_,H),$(_,N),P(b,_,null),d(e,V,o),d(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){I(c.$$.fragment,e),I(x.$$.fragment,e),I(A.$$.fragment,e),I(T.$$.fragment,e),I(k.$$.fragment,e),I(C.$$.fragment,e),I(b.$$.fragment,e),S=!1},d(e){e&&(a(g),a(n),a(s),a(r),a(f),a(D),a(Z),a(z),a(i),a(V),a(B)),a(t),y(c,e),y(x,e),y(A,e),y(T),y(k),y(C),y(b)}}}const ue='{"title":"IP-Adapter","local":"ip-adapter","sections":[{"title":"IPAdapterMixin","local":"diffusers.loaders.IPAdapterMixin","sections":[],"depth":2}],"depth":1}';function he(L){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pe extends ne{constructor(t){super(),se(this,t,he,me,ae,{})}}export{Pe as component};
