import{s as K,o as N,n as O}from"../chunks/scheduler.182ea377.js";import{S as Q,i as X,g as c,s,r as v,A as Y,h as f,f as o,c as l,j as S,u as y,x as V,k as U,y as A,a as r,v as I,d as M,t as T,w as k}from"../chunks/index.abf12888.js";import{T as Z}from"../chunks/Tip.230e2334.js";import{D as R}from"../chunks/Docstring.93f6f462.js";import{H as J}from"../chunks/Heading.16916d63.js";function ee(H){let a,m='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(){a=c("p"),a.innerHTML=m},l(n){a=f(n,"P",{"data-svelte-h":!0}),V(a)!=="svelte-1tbuho3"&&(a.innerHTML=m)},m(n,$){r(n,a,$)},p:O,d(n){n&&o(a)}}}function te(H){let a,m,n,$,h,L,u,j='<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,p,C,g,D,i,_,W,b,B="Mixin for handling IP Adapters.",z,w,x,E,P,F;return h=new J({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h1"}}),p=new Z({props:{$$slots:{default:[ee]},$$scope:{ctx:H}}}),g=new J({props:{title:"IPAdapterMixin",local:"diffusers.loaders.IPAdapterMixin",headingTag:"h2"}}),_=new R({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"}}),x=new R({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(){a=c("meta"),m=s(),n=c("p"),$=s(),v(h.$$.fragment),L=s(),u=c("p"),u.innerHTML=j,q=s(),v(p.$$.fragment),C=s(),v(g.$$.fragment),D=s(),i=c("div"),v(_.$$.fragment),W=s(),b=c("p"),b.textContent=B,z=s(),w=c("div"),v(x.$$.fragment),E=s(),P=c("p"),this.h()},l(e){const t=Y("svelte-u9bgzb",document.head);a=f(t,"META",{name:!0,content:!0}),t.forEach(o),m=l(e),n=f(e,"P",{}),S(n).forEach(o),$=l(e),y(h.$$.fragment,e),L=l(e),u=f(e,"P",{"data-svelte-h":!0}),V(u)!=="svelte-of58ky"&&(u.innerHTML=j),q=l(e),y(p.$$.fragment,e),C=l(e),y(g.$$.fragment,e),D=l(e),i=f(e,"DIV",{class:!0});var d=S(i);y(_.$$.fragment,d),W=l(d),b=f(d,"P",{"data-svelte-h":!0}),V(b)!=="svelte-geelri"&&(b.textContent=B),z=l(d),w=f(d,"DIV",{class:!0});var G=S(w);y(x.$$.fragment,G),G.forEach(o),d.forEach(o),E=l(e),P=f(e,"P",{}),S(P).forEach(o),this.h()},h(){U(a,"name","hf:doc:metadata"),U(a,"content",oe),U(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(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,t){A(document.head,a),r(e,m,t),r(e,n,t),r(e,$,t),I(h,e,t),r(e,L,t),r(e,u,t),r(e,q,t),I(p,e,t),r(e,C,t),I(g,e,t),r(e,D,t),r(e,i,t),I(_,i,null),A(i,W),A(i,b),A(i,z),A(i,w),I(x,w,null),r(e,E,t),r(e,P,t),F=!0},p(e,[t]){const d={};t&2&&(d.$$scope={dirty:t,ctx:e}),p.$set(d)},i(e){F||(M(h.$$.fragment,e),M(p.$$.fragment,e),M(g.$$.fragment,e),M(_.$$.fragment,e),M(x.$$.fragment,e),F=!0)},o(e){T(h.$$.fragment,e),T(p.$$.fragment,e),T(g.$$.fragment,e),T(_.$$.fragment,e),T(x.$$.fragment,e),F=!1},d(e){e&&(o(m),o(n),o($),o(L),o(u),o(q),o(C),o(D),o(i),o(E),o(P)),o(a),k(h,e),k(p,e),k(g,e),k(_),k(x)}}}const oe='{"title":"IP-Adapter","local":"ip-adapter","sections":[{"title":"IPAdapterMixin","local":"diffusers.loaders.IPAdapterMixin","sections":[],"depth":2}],"depth":1}';function ae(H){return N(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class le extends Q{constructor(a){super(),X(this,a,ae,te,K,{})}}export{le as component};
