import{s as $t,o as xt,n as ve}from"../chunks/scheduler.8c3d61f6.js";import{S as Mt,i as wt,g as p,s as d,r as g,A as yt,h as c,f as a,c as i,j as T,u,x as y,k as A,y as s,a as f,v as h,d as _,t as b,w as $}from"../chunks/index.da70eac4.js";import{T as vt}from"../chunks/Tip.1d9b8c37.js";import{D as j}from"../chunks/Docstring.6b390b9a.js";import{C as Be}from"../chunks/CodeBlock.00a903b3.js";import{E as Se}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as Ge,E as It}from"../chunks/EditOnGithub.1e64e623.js";function Pt(U){let o,M='Learn how to load an IP-Adapter checkpoint and image in the IP-Adapter <a href="../../using-diffusers/loading_adapters#ip-adapter">loading</a> guide, and you can see how to use it in the <a href="../../using-diffusers/ip_adapter">usage</a> guide.';return{c(){o=p("p"),o.innerHTML=M},l(l){o=c(l,"P",{"data-svelte-h":!0}),y(o)!=="svelte-xt8bs9"&&(o.innerHTML=M)},m(l,r){f(l,o,r)},p:ve,d(l){l&&a(o)}}}function Tt(U){let o,M="Example:",l,r,m;return r=new Be({props:{code:"JTIzJTIwVG8lMjB1c2UlMjBvcmlnaW5hbCUyMElQLUFkYXB0ZXIlMEFzY2FsZSUyMCUzRCUyMDEuMCUwQXBpcGVsaW5lLnNldF9pcF9hZGFwdGVyX3NjYWxlKHNjYWxlKSUwQSUwQSUyMyUyMFRvJTIwdXNlJTIwc3R5bGUlMjBibG9jayUyMG9ubHklMEFzY2FsZSUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnVwJTIyJTNBJTIwJTdCJTIyYmxvY2tfMCUyMiUzQSUyMCU1QjAuMCUyQyUyMDEuMCUyQyUyMDAuMCU1RCU3RCUyQyUwQSU3RCUwQXBpcGVsaW5lLnNldF9pcF9hZGFwdGVyX3NjYWxlKHNjYWxlKSUwQSUwQSUyMyUyMFRvJTIwdXNlJTIwc3R5bGUlMkJsYXlvdXQlMjBibG9ja3MlMEFzY2FsZSUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmRvd24lMjIlM0ElMjAlN0IlMjJibG9ja18yJTIyJTNBJTIwJTVCMC4wJTJDJTIwMS4wJTVEJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIydXAlMjIlM0ElMjAlN0IlMjJibG9ja18wJTIyJTNBJTIwJTVCMC4wJTJDJTIwMS4wJTJDJTIwMC4wJTVEJTdEJTJDJTBBJTdEJTBBcGlwZWxpbmUuc2V0X2lwX2FkYXB0ZXJfc2NhbGUoc2NhbGUpJTBBJTBBJTIzJTIwVG8lMjB1c2UlMjBzdHlsZSUyMGFuZCUyMGxheW91dCUyMGZyb20lMjAyJTIwcmVmZXJlbmNlJTIwaW1hZ2VzJTBBc2NhbGVzJTIwJTNEJTIwJTVCJTdCJTIyZG93biUyMiUzQSUyMCU3QiUyMmJsb2NrXzIlMjIlM0ElMjAlNUIwLjAlMkMlMjAxLjAlNUQlN0QlN0QlMkMlMjAlN0IlMjJ1cCUyMiUzQSUyMCU3QiUyMmJsb2NrXzAlMjIlM0ElMjAlNUIwLjAlMkMlMjAxLjAlMkMlMjAwLjAlNUQlN0QlN0QlNUQlMEFwaXBlbGluZS5zZXRfaXBfYWRhcHRlcl9zY2FsZShzY2FsZXMp",highlighted:`<span class="hljs-comment"># To use original IP-Adapter</span>
scale = <span class="hljs-number">1.0</span>
pipeline.set_ip_adapter_scale(scale)

<span class="hljs-comment"># To use style block only</span>
scale = {
    <span class="hljs-string">&quot;up&quot;</span>: {<span class="hljs-string">&quot;block_0&quot;</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>, <span class="hljs-number">0.0</span>]},
}
pipeline.set_ip_adapter_scale(scale)

<span class="hljs-comment"># To use style+layout blocks</span>
scale = {
    <span class="hljs-string">&quot;down&quot;</span>: {<span class="hljs-string">&quot;block_2&quot;</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>]},
    <span class="hljs-string">&quot;up&quot;</span>: {<span class="hljs-string">&quot;block_0&quot;</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>, <span class="hljs-number">0.0</span>]},
}
pipeline.set_ip_adapter_scale(scale)

<span class="hljs-comment"># To use style and layout from 2 reference images</span>
scales = [{<span class="hljs-string">&quot;down&quot;</span>: {<span class="hljs-string">&quot;block_2&quot;</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>]}}, {<span class="hljs-string">&quot;up&quot;</span>: {<span class="hljs-string">&quot;block_0&quot;</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>, <span class="hljs-number">0.0</span>]}}]
pipeline.set_ip_adapter_scale(scales)`,wrap:!1}}),{c(){o=p("p"),o.textContent=M,l=d(),g(r.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),y(o)!=="svelte-11lpom8"&&(o.textContent=M),l=i(t),u(r.$$.fragment,t)},m(t,x){f(t,o,x),f(t,l,x),h(r,t,x),m=!0},p:ve,i(t){m||(_(r.$$.fragment,t),m=!0)},o(t){b(r.$$.fragment,t),m=!1},d(t){t&&(a(o),a(l)),$(r,t)}}}function At(U){let o,M="Examples:",l,r,m;return r=new Be({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(){o=p("p"),o.textContent=M,l=d(),g(r.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),y(o)!=="svelte-kvfsh7"&&(o.textContent=M),l=i(t),u(r.$$.fragment,t)},m(t,x){f(t,o,x),f(t,l,x),h(r,t,x),m=!0},p:ve,i(t){m||(_(r.$$.fragment,t),m=!0)},o(t){b(r.$$.fragment,t),m=!1},d(t){t&&(a(o),a(l)),$(r,t)}}}function Ut(U){let o,M="Example:",l,r,m;return r=new Be({props:{code:"JTIzJTIwQXNzdW1pbmclMjAlNjBwaXBlbGluZSU2MCUyMGlzJTIwYWxyZWFkeSUyMGxvYWRlZCUyMHdpdGglMjB0aGUlMjBJUCUyMEFkYXB0ZXIlMjB3ZWlnaHRzLiUwQXBpcGVsaW5lLnNldF9pcF9hZGFwdGVyX3NjYWxlKDAuNiklMEEuLi4=",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.set_ip_adapter_scale(<span class="hljs-number">0.6</span>)\n<span class="hljs-meta">&gt;&gt;&gt; </span>...',wrap:!1}}),{c(){o=p("p"),o.textContent=M,l=d(),g(r.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),y(o)!=="svelte-11lpom8"&&(o.textContent=M),l=i(t),u(r.$$.fragment,t)},m(t,x){f(t,o,x),f(t,l,x),h(r,t,x),m=!0},p:ve,i(t){m||(_(r.$$.fragment,t),m=!0)},o(t){b(r.$$.fragment,t),m=!1},d(t){t&&(a(o),a(l)),$(r,t)}}}function Ct(U){let o,M="Example:",l,r,m;return r=new Be({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(){o=p("p"),o.textContent=M,l=d(),g(r.$$.fragment)},l(t){o=c(t,"P",{"data-svelte-h":!0}),y(o)!=="svelte-11lpom8"&&(o.textContent=M),l=i(t),u(r.$$.fragment,t)},m(t,x){f(t,o,x),f(t,l,x),h(r,t,x),m=!0},p:ve,i(t){m||(_(r.$$.fragment,t),m=!0)},o(t){b(r.$$.fragment,t),m=!1},d(t){t&&(a(o),a(l)),$(r,t)}}}function jt(U){let o,M,l,r,m,t,x,dt='<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.',Ie,E,Pe,X,Te,v,Z,Ee,ne,it="Mixin for handling IP Adapters.",Le,de,V,qe,k,Q,Fe,ie,lt=`Set IP-Adapter scales per-transformer block. Input <code>scale</code> could be a single config or a list of configs for
granular control over each IP-Adapter behavior. A config can be a float or a dictionary.`,Ne,L,We,J,H,Xe,le,pt="Unloads the IP Adapter weights",Ze,q,Ae,Y,Ue,w,R,Ve,pe,ct="Mixin for handling StableDiffusion 3 IP Adapters.",Qe,z,K,He,ce,mt="Checks if IP-Adapter is loaded and scale > 0.",Ye,me,ft=`IP-Adapter scale controls the influence of the image prompt versus text prompt. When this value is set to 0,
the image context is irrelevant.`,Re,fe,O,Ke,D,ee,Oe,ge,gt=`Set IP-Adapter scale, which controls image prompt conditioning. A value of 1.0 means the model is only
conditioned on the image prompt, and 0.0 only conditioned by the text prompt. Lowering this value encourages
the model to produce more diverse images, but they may not be as aligned with the image prompt.`,et,F,tt,S,te,ot,ue,ut="Unloads the IP Adapter weights.",at,N,Ce,oe,je,C,ae,st,he,ht="Image processor for IP Adapter image masks.",rt,W,se,nt,_e,_t=`Downsamples the provided mask tensor to match the expected dimensions for scaled dot-product attention. If the
aspect ratio of the mask does not match the aspect ratio of the output image, a warning is issued.`,ke,re,Je,we,ze;return m=new Ge({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h1"}}),E=new vt({props:{$$slots:{default:[Pt]},$$scope:{ctx:U}}}),X=new Ge({props:{title:"IPAdapterMixin",local:"diffusers.loaders.IPAdapterMixin",headingTag:"h2"}}),Z=new j({props:{name:"class diffusers.loaders.IPAdapterMixin",anchor:"diffusers.loaders.IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L54"}}),V=new j({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.List[str], typing.Dict[str, torch.Tensor]]"},{name:"subfolder",val:": typing.Union[str, typing.List[str]]"},{name:"weight_name",val:": typing.Union[str, typing.List[str]]"},{name:"image_encoder_folder",val:": typing.Optional[str] = 'image_encoder'"},{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>List[str]</code> or <code>os.PathLike</code> or <code>List[os.PathLike]</code> or <code>dict</code> or <code>List[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/pr_10123/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.subfolder",description:`<strong>subfolder</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The subfolder location of a model file within a larger model repository on the Hub or locally. If a
list is passed, it should have the same length as <code>weight_name</code>.`,name:"subfolder"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.weight_name",description:`<strong>weight_name</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The name of the weight file to load. If a list is passed, it should have the same length as
<code>subfolder</code>.`,name:"weight_name"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.image_encoder_folder",description:`<strong>image_encoder_folder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>image_encoder</code>) &#x2014;
The subfolder location of the image encoder within a larger model repository on the Hub or locally.
Pass <code>None</code> to not load the image encoder. If the image encoder is located in a folder inside
<code>subfolder</code>, you only need to pass the name of the folder that contains image encoder weights, e.g.
<code>image_encoder_folder=&quot;image_encoder&quot;</code>. If the image encoder is located in a folder other than
<code>subfolder</code>, you should pass the path to the folder that contains image encoder weights, for example,
<code>image_encoder_folder=&quot;different_subfolder/image_encoder&quot;</code>.`,name:"image_encoder_folder"},{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.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.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code> if torch version &gt;= 1.9.0 else <code>False</code>) &#x2014;
Speed up model loading only loading the pretrained weights and not initializing the weights. This also
tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
Only supported for PyTorch &gt;= 1.9.0. If you are using an older version of PyTorch, setting this
argument to <code>True</code> will raise an error.`,name:"low_cpu_mem_usage"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L57"}}),Q=new j({props:{name:"set_ip_adapter_scale",anchor:"diffusers.loaders.IPAdapterMixin.set_ip_adapter_scale",parameters:[{name:"scale",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L254"}}),L=new Se({props:{anchor:"diffusers.loaders.IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[Tt]},$$scope:{ctx:U}}}),H=new j({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L308"}}),q=new Se({props:{anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[At]},$$scope:{ctx:U}}}),Y=new Ge({props:{title:"SD3IPAdapterMixin",local:"diffusers.loaders.SD3IPAdapterMixin",headingTag:"h2"}}),R=new j({props:{name:"class diffusers.loaders.SD3IPAdapterMixin",anchor:"diffusers.loaders.SD3IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L642"}}),K=new j({props:{name:"is_ip_adapter_active",anchor:"diffusers.loaders.SD3IPAdapterMixin.is_ip_adapter_active",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L645",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>True when IP-Adapter is loaded and any layer has scale > 0.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>bool</code></p>
`}}),O=new j({props:{name:"load_ip_adapter",anchor:"diffusers.loaders.SD3IPAdapterMixin.load_ip_adapter",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"weight_name",val:": str = 'ip-adapter.safetensors'"},{name:"subfolder",val:": typing.Optional[str] = None"},{name:"image_encoder_folder",val:": typing.Optional[str] = 'image_encoder'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.SD3IPAdapterMixin.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:<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/pr_10123/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.SD3IPAdapterMixin.load_ip_adapter.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, defaults to &#x201C;ip-adapter.safetensors&#x201D;) &#x2014;
The name of the weight file to load. If a list is passed, it should have the same length as
<code>subfolder</code>.`,name:"weight_name"},{anchor:"diffusers.loaders.SD3IPAdapterMixin.load_ip_adapter.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The subfolder location of a model file within a larger model repository on the Hub or locally. If a
list is passed, it should have the same length as <code>weight_name</code>.`,name:"subfolder"},{anchor:"diffusers.loaders.SD3IPAdapterMixin.load_ip_adapter.image_encoder_folder",description:`<strong>image_encoder_folder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>image_encoder</code>) &#x2014;
The subfolder location of the image encoder within a larger model repository on the Hub or locally.
Pass <code>None</code> to not load the image encoder. If the image encoder is located in a folder inside
<code>subfolder</code>, you only need to pass the name of the folder that contains image encoder weights, e.g.
<code>image_encoder_folder=&quot;image_encoder&quot;</code>. If the image encoder is located in a folder other than
<code>subfolder</code>, you should pass the path to the folder that contains image encoder weights, for example,
<code>image_encoder_folder=&quot;different_subfolder/image_encoder&quot;</code>.`,name:"image_encoder_folder"},{anchor:"diffusers.loaders.SD3IPAdapterMixin.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.SD3IPAdapterMixin.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.SD3IPAdapterMixin.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.SD3IPAdapterMixin.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.SD3IPAdapterMixin.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.SD3IPAdapterMixin.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.SD3IPAdapterMixin.load_ip_adapter.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code> if torch version &gt;= 1.9.0 else <code>False</code>) &#x2014;
Speed up model loading only loading the pretrained weights and not initializing the weights. This also
tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
Only supported for PyTorch &gt;= 1.9.0. If you are using an older version of PyTorch, setting this
argument to <code>True</code> will raise an error.`,name:"low_cpu_mem_usage"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L663"}}),ee=new j({props:{name:"set_ip_adapter_scale",anchor:"diffusers.loaders.SD3IPAdapterMixin.set_ip_adapter_scale",parameters:[{name:"scale",val:": float"}],parametersDescription:[{anchor:"diffusers.loaders.SD3IPAdapterMixin.set_ip_adapter_scale.scale",description:`<strong>scale</strong> (float) &#x2014;
IP-Adapter scale to be set.`,name:"scale"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L816"}}),F=new Se({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[Ut]},$$scope:{ctx:U}}}),te=new j({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/loaders/ip_adapter.py#L839"}}),N=new Se({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[Ct]},$$scope:{ctx:U}}}),oe=new Ge({props:{title:"IPAdapterMaskProcessor",local:"diffusers.image_processor.IPAdapterMaskProcessor",headingTag:"h2"}}),ae=new j({props:{name:"class diffusers.image_processor.IPAdapterMaskProcessor",anchor:"diffusers.image_processor.IPAdapterMaskProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"vae_scale_factor",val:": int = 8"},{name:"resample",val:": str = 'lanczos'"},{name:"do_normalize",val:": bool = False"},{name:"do_binarize",val:": bool = True"},{name:"do_convert_grayscale",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to downscale the image&#x2019;s (height, width) dimensions to multiples of <code>vae_scale_factor</code>.`,name:"do_resize"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.vae_scale_factor",description:`<strong>vae_scale_factor</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8</code>) &#x2014;
VAE scale factor. If <code>do_resize</code> is <code>True</code>, the image is automatically resized to multiples of this factor.`,name:"vae_scale_factor"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.resample",description:`<strong>resample</strong> (<code>str</code>, <em>optional</em>, defaults to <code>lanczos</code>) &#x2014;
Resampling filter to use when resizing the image.`,name:"resample"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to normalize the image to [-1,1].`,name:"do_normalize"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.do_binarize",description:`<strong>do_binarize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to binarize the image to 0/1.`,name:"do_binarize"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.do_convert_grayscale",description:`<strong>do_convert_grayscale</strong> (<code>bool</code>, <em>optional</em>, defaults to be <code>True</code>) &#x2014;
Whether to convert the images to grayscale format.`,name:"do_convert_grayscale"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/image_processor.py#L1116"}}),se=new j({props:{name:"downsample",anchor:"diffusers.image_processor.IPAdapterMaskProcessor.downsample",parameters:[{name:"mask",val:": Tensor"},{name:"batch_size",val:": int"},{name:"num_queries",val:": int"},{name:"value_embed_dim",val:": int"}],parametersDescription:[{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.downsample.mask",description:`<strong>mask</strong> (<code>torch.Tensor</code>) &#x2014;
The input mask tensor generated with <code>IPAdapterMaskProcessor.preprocess()</code>.`,name:"mask"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.downsample.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
The batch size.`,name:"batch_size"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.downsample.num_queries",description:`<strong>num_queries</strong> (<code>int</code>) &#x2014;
The number of queries.`,name:"num_queries"},{anchor:"diffusers.image_processor.IPAdapterMaskProcessor.downsample.value_embed_dim",description:`<strong>value_embed_dim</strong> (<code>int</code>) &#x2014;
The dimensionality of the value embeddings.`,name:"value_embed_dim"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/image_processor.py#L1157",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The downsampled mask tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),re=new It({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/ip_adapter.md"}}),{c(){o=p("meta"),M=d(),l=p("p"),r=d(),g(m.$$.fragment),t=d(),x=p("p"),x.innerHTML=dt,Ie=d(),g(E.$$.fragment),Pe=d(),g(X.$$.fragment),Te=d(),v=p("div"),g(Z.$$.fragment),Ee=d(),ne=p("p"),ne.textContent=it,Le=d(),de=p("div"),g(V.$$.fragment),qe=d(),k=p("div"),g(Q.$$.fragment),Fe=d(),ie=p("p"),ie.innerHTML=lt,Ne=d(),g(L.$$.fragment),We=d(),J=p("div"),g(H.$$.fragment),Xe=d(),le=p("p"),le.textContent=pt,Ze=d(),g(q.$$.fragment),Ae=d(),g(Y.$$.fragment),Ue=d(),w=p("div"),g(R.$$.fragment),Ve=d(),pe=p("p"),pe.textContent=ct,Qe=d(),z=p("div"),g(K.$$.fragment),He=d(),ce=p("p"),ce.textContent=mt,Ye=d(),me=p("p"),me.textContent=ft,Re=d(),fe=p("div"),g(O.$$.fragment),Ke=d(),D=p("div"),g(ee.$$.fragment),Oe=d(),ge=p("p"),ge.textContent=gt,et=d(),g(F.$$.fragment),tt=d(),S=p("div"),g(te.$$.fragment),ot=d(),ue=p("p"),ue.textContent=ut,at=d(),g(N.$$.fragment),Ce=d(),g(oe.$$.fragment),je=d(),C=p("div"),g(ae.$$.fragment),st=d(),he=p("p"),he.textContent=ht,rt=d(),W=p("div"),g(se.$$.fragment),nt=d(),_e=p("p"),_e.textContent=_t,ke=d(),g(re.$$.fragment),Je=d(),we=p("p"),this.h()},l(e){const n=yt("svelte-u9bgzb",document.head);o=c(n,"META",{name:!0,content:!0}),n.forEach(a),M=i(e),l=c(e,"P",{}),T(l).forEach(a),r=i(e),u(m.$$.fragment,e),t=i(e),x=c(e,"P",{"data-svelte-h":!0}),y(x)!=="svelte-nxzt54"&&(x.innerHTML=dt),Ie=i(e),u(E.$$.fragment,e),Pe=i(e),u(X.$$.fragment,e),Te=i(e),v=c(e,"DIV",{class:!0});var P=T(v);u(Z.$$.fragment,P),Ee=i(P),ne=c(P,"P",{"data-svelte-h":!0}),y(ne)!=="svelte-geelri"&&(ne.textContent=it),Le=i(P),de=c(P,"DIV",{class:!0});var ye=T(de);u(V.$$.fragment,ye),ye.forEach(a),qe=i(P),k=c(P,"DIV",{class:!0});var G=T(k);u(Q.$$.fragment,G),Fe=i(G),ie=c(G,"P",{"data-svelte-h":!0}),y(ie)!=="svelte-vgoyt3"&&(ie.innerHTML=lt),Ne=i(G),u(L.$$.fragment,G),G.forEach(a),We=i(P),J=c(P,"DIV",{class:!0});var B=T(J);u(H.$$.fragment,B),Xe=i(B),le=c(B,"P",{"data-svelte-h":!0}),y(le)!=="svelte-io61ja"&&(le.textContent=pt),Ze=i(B),u(q.$$.fragment,B),B.forEach(a),P.forEach(a),Ae=i(e),u(Y.$$.fragment,e),Ue=i(e),w=c(e,"DIV",{class:!0});var I=T(w);u(R.$$.fragment,I),Ve=i(I),pe=c(I,"P",{"data-svelte-h":!0}),y(pe)!=="svelte-k0v077"&&(pe.textContent=ct),Qe=i(I),z=c(I,"DIV",{class:!0});var be=T(z);u(K.$$.fragment,be),He=i(be),ce=c(be,"P",{"data-svelte-h":!0}),y(ce)!=="svelte-1w93ehb"&&(ce.textContent=mt),Ye=i(be),me=c(be,"P",{"data-svelte-h":!0}),y(me)!=="svelte-gdsgj6"&&(me.textContent=ft),be.forEach(a),Re=i(I),fe=c(I,"DIV",{class:!0});var bt=T(fe);u(O.$$.fragment,bt),bt.forEach(a),Ke=i(I),D=c(I,"DIV",{class:!0});var $e=T(D);u(ee.$$.fragment,$e),Oe=i($e),ge=c($e,"P",{"data-svelte-h":!0}),y(ge)!=="svelte-1d5sqjz"&&(ge.textContent=gt),et=i($e),u(F.$$.fragment,$e),$e.forEach(a),tt=i(I),S=c(I,"DIV",{class:!0});var xe=T(S);u(te.$$.fragment,xe),ot=i(xe),ue=c(xe,"P",{"data-svelte-h":!0}),y(ue)!=="svelte-fo5c0g"&&(ue.textContent=ut),at=i(xe),u(N.$$.fragment,xe),xe.forEach(a),I.forEach(a),Ce=i(e),u(oe.$$.fragment,e),je=i(e),C=c(e,"DIV",{class:!0});var Me=T(C);u(ae.$$.fragment,Me),st=i(Me),he=c(Me,"P",{"data-svelte-h":!0}),y(he)!=="svelte-mxmwf6"&&(he.textContent=ht),rt=i(Me),W=c(Me,"DIV",{class:!0});var De=T(W);u(se.$$.fragment,De),nt=i(De),_e=c(De,"P",{"data-svelte-h":!0}),y(_e)!=="svelte-1jm7ypm"&&(_e.textContent=_t),De.forEach(a),Me.forEach(a),ke=i(e),u(re.$$.fragment,e),Je=i(e),we=c(e,"P",{}),T(we).forEach(a),this.h()},h(){A(o,"name","hf:doc:metadata"),A(o,"content",kt),A(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(C,"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,n){s(document.head,o),f(e,M,n),f(e,l,n),f(e,r,n),h(m,e,n),f(e,t,n),f(e,x,n),f(e,Ie,n),h(E,e,n),f(e,Pe,n),h(X,e,n),f(e,Te,n),f(e,v,n),h(Z,v,null),s(v,Ee),s(v,ne),s(v,Le),s(v,de),h(V,de,null),s(v,qe),s(v,k),h(Q,k,null),s(k,Fe),s(k,ie),s(k,Ne),h(L,k,null),s(v,We),s(v,J),h(H,J,null),s(J,Xe),s(J,le),s(J,Ze),h(q,J,null),f(e,Ae,n),h(Y,e,n),f(e,Ue,n),f(e,w,n),h(R,w,null),s(w,Ve),s(w,pe),s(w,Qe),s(w,z),h(K,z,null),s(z,He),s(z,ce),s(z,Ye),s(z,me),s(w,Re),s(w,fe),h(O,fe,null),s(w,Ke),s(w,D),h(ee,D,null),s(D,Oe),s(D,ge),s(D,et),h(F,D,null),s(w,tt),s(w,S),h(te,S,null),s(S,ot),s(S,ue),s(S,at),h(N,S,null),f(e,Ce,n),h(oe,e,n),f(e,je,n),f(e,C,n),h(ae,C,null),s(C,st),s(C,he),s(C,rt),s(C,W),h(se,W,null),s(W,nt),s(W,_e),f(e,ke,n),h(re,e,n),f(e,Je,n),f(e,we,n),ze=!0},p(e,[n]){const P={};n&2&&(P.$$scope={dirty:n,ctx:e}),E.$set(P);const ye={};n&2&&(ye.$$scope={dirty:n,ctx:e}),L.$set(ye);const G={};n&2&&(G.$$scope={dirty:n,ctx:e}),q.$set(G);const B={};n&2&&(B.$$scope={dirty:n,ctx:e}),F.$set(B);const I={};n&2&&(I.$$scope={dirty:n,ctx:e}),N.$set(I)},i(e){ze||(_(m.$$.fragment,e),_(E.$$.fragment,e),_(X.$$.fragment,e),_(Z.$$.fragment,e),_(V.$$.fragment,e),_(Q.$$.fragment,e),_(L.$$.fragment,e),_(H.$$.fragment,e),_(q.$$.fragment,e),_(Y.$$.fragment,e),_(R.$$.fragment,e),_(K.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(F.$$.fragment,e),_(te.$$.fragment,e),_(N.$$.fragment,e),_(oe.$$.fragment,e),_(ae.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),ze=!0)},o(e){b(m.$$.fragment,e),b(E.$$.fragment,e),b(X.$$.fragment,e),b(Z.$$.fragment,e),b(V.$$.fragment,e),b(Q.$$.fragment,e),b(L.$$.fragment,e),b(H.$$.fragment,e),b(q.$$.fragment,e),b(Y.$$.fragment,e),b(R.$$.fragment,e),b(K.$$.fragment,e),b(O.$$.fragment,e),b(ee.$$.fragment,e),b(F.$$.fragment,e),b(te.$$.fragment,e),b(N.$$.fragment,e),b(oe.$$.fragment,e),b(ae.$$.fragment,e),b(se.$$.fragment,e),b(re.$$.fragment,e),ze=!1},d(e){e&&(a(M),a(l),a(r),a(t),a(x),a(Ie),a(Pe),a(Te),a(v),a(Ae),a(Ue),a(w),a(Ce),a(je),a(C),a(ke),a(Je),a(we)),a(o),$(m,e),$(E,e),$(X,e),$(Z),$(V),$(Q),$(L),$(H),$(q),$(Y,e),$(R),$(K),$(O),$(ee),$(F),$(te),$(N),$(oe,e),$(ae),$(se),$(re,e)}}}const kt='{"title":"IP-Adapter","local":"ip-adapter","sections":[{"title":"IPAdapterMixin","local":"diffusers.loaders.IPAdapterMixin","sections":[],"depth":2},{"title":"SD3IPAdapterMixin","local":"diffusers.loaders.SD3IPAdapterMixin","sections":[],"depth":2},{"title":"IPAdapterMaskProcessor","local":"diffusers.image_processor.IPAdapterMaskProcessor","sections":[],"depth":2}],"depth":1}';function Jt(U){return xt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qt extends Mt{constructor(o){super(),wt(this,o,Jt,jt,$t,{})}}export{qt as component};
