import{s as yt,o as wt,n as Be}from"../chunks/scheduler.53228c21.js";import{S as vt,i as It,e as l,s as r,c as g,h as Pt,a as p,d as o,b as n,f as T,g as u,j as w,k as I,l as s,m as c,n as h,t as _,o as b,p as $}from"../chunks/index.100fac89.js";import{C as Tt}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as C}from"../chunks/Docstring.db856a1e.js";import{C as Ee}from"../chunks/CodeBlock.d30a6509.js";import{E as Ge}from"../chunks/ExampleCodeBlock.3eb26ae1.js";import{H as Le,E as At}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function Ut(j){let a,y="Example:",f,d,m;return d=new Ee({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(){a=l("p"),a.textContent=y,f=r(),g(d.$$.fragment)},l(t){a=p(t,"P",{"data-svelte-h":!0}),w(a)!=="svelte-11lpom8"&&(a.textContent=y),f=n(t),u(d.$$.fragment,t)},m(t,x){c(t,a,x),c(t,f,x),h(d,t,x),m=!0},p:Be,i(t){m||(_(d.$$.fragment,t),m=!0)},o(t){b(d.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(d,t)}}}function Ct(j){let a,y="Examples:",f,d,m;return d=new Ee({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(){a=l("p"),a.textContent=y,f=r(),g(d.$$.fragment)},l(t){a=p(t,"P",{"data-svelte-h":!0}),w(a)!=="svelte-kvfsh7"&&(a.textContent=y),f=n(t),u(d.$$.fragment,t)},m(t,x){c(t,a,x),c(t,f,x),h(d,t,x),m=!0},p:Be,i(t){m||(_(d.$$.fragment,t),m=!0)},o(t){b(d.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(d,t)}}}function jt(j){let a,y="Example:",f,d,m;return d=new Ee({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(){a=l("p"),a.textContent=y,f=r(),g(d.$$.fragment)},l(t){a=p(t,"P",{"data-svelte-h":!0}),w(a)!=="svelte-11lpom8"&&(a.textContent=y),f=n(t),u(d.$$.fragment,t)},m(t,x){c(t,a,x),c(t,f,x),h(d,t,x),m=!0},p:Be,i(t){m||(_(d.$$.fragment,t),m=!0)},o(t){b(d.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(d,t)}}}function kt(j){let a,y="Example:",f,d,m;return d=new Ee({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(){a=l("p"),a.textContent=y,f=r(),g(d.$$.fragment)},l(t){a=p(t,"P",{"data-svelte-h":!0}),w(a)!=="svelte-11lpom8"&&(a.textContent=y),f=n(t),u(d.$$.fragment,t)},m(t,x){c(t,a,x),c(t,f,x),h(d,t,x),m=!0},p:Be,i(t){m||(_(d.$$.fragment,t),m=!0)},o(t){b(d.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(d,t)}}}function Jt(j){let a,y,f,d,m,t,x,Ie,X,lt='<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.',Pe,B,pt='<p>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.</p>',Te,Z,Ae,v,Q,qe,ie,ct="Mixin for handling IP Adapters.",Fe,de,V,Ne,k,H,We,le,mt=`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.`,Xe,E,Ze,J,Y,Qe,pe,ft="Unloads the IP Adapter weights",Ve,q,Ue,R,Ce,M,K,He,ce,gt="Mixin for handling StableDiffusion 3 IP Adapters.",Ye,z,O,Re,me,ut="Checks if IP-Adapter is loaded and scale > 0.",Ke,fe,ht=`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.`,Oe,ge,ee,et,D,te,tt,ue,_t=`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.`,ot,F,at,S,oe,st,he,bt="Unloads the IP Adapter weights.",rt,N,je,ae,ke,U,se,nt,_e,$t="Image processor for IP Adapter image masks.",it,W,re,dt,be,xt=`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.`,Je,ne,ze,we,De;return m=new Tt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new Le({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h1"}}),Z=new Le({props:{title:"IPAdapterMixin",local:"diffusers.loaders.IPAdapterMixin",headingTag:"h2"}}),Q=new C({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#L54"}}),V=new C({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/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.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/main/src/diffusers/loaders/ip_adapter.py#L57"}}),H=new C({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/main/src/diffusers/loaders/ip_adapter.py#L252"}}),E=new Ge({props:{anchor:"diffusers.loaders.IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[Ut]},$$scope:{ctx:j}}}),Y=new C({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#L305"}}),q=new Ge({props:{anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[Ct]},$$scope:{ctx:j}}}),R=new Le({props:{title:"SD3IPAdapterMixin",local:"diffusers.loaders.SD3IPAdapterMixin",headingTag:"h2"}}),K=new C({props:{name:"class diffusers.loaders.SD3IPAdapterMixin",anchor:"diffusers.loaders.SD3IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L897"}}),O=new C({props:{name:"is_ip_adapter_active",anchor:"diffusers.loaders.SD3IPAdapterMixin.is_ip_adapter_active",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L900",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>
`}}),ee=new C({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/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.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/main/src/diffusers/loaders/ip_adapter.py#L918"}}),te=new C({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/main/src/diffusers/loaders/ip_adapter.py#L1066"}}),F=new Ge({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[jt]},$$scope:{ctx:j}}}),oe=new C({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py#L1089"}}),N=new Ge({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[kt]},$$scope:{ctx:j}}}),ae=new Le({props:{title:"IPAdapterMaskProcessor",local:"diffusers.image_processor.IPAdapterMaskProcessor",headingTag:"h2"}}),se=new C({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/main/src/diffusers/image_processor.py#L1253"}}),re=new C({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/main/src/diffusers/image_processor.py#L1294",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>
`}}),ne=new At({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/ip_adapter.md"}}),{c(){a=l("meta"),y=r(),f=l("p"),d=r(),g(m.$$.fragment),t=r(),g(x.$$.fragment),Ie=r(),X=l("p"),X.innerHTML=lt,Pe=r(),B=l("blockquote"),B.innerHTML=pt,Te=r(),g(Z.$$.fragment),Ae=r(),v=l("div"),g(Q.$$.fragment),qe=r(),ie=l("p"),ie.textContent=ct,Fe=r(),de=l("div"),g(V.$$.fragment),Ne=r(),k=l("div"),g(H.$$.fragment),We=r(),le=l("p"),le.innerHTML=mt,Xe=r(),g(E.$$.fragment),Ze=r(),J=l("div"),g(Y.$$.fragment),Qe=r(),pe=l("p"),pe.textContent=ft,Ve=r(),g(q.$$.fragment),Ue=r(),g(R.$$.fragment),Ce=r(),M=l("div"),g(K.$$.fragment),He=r(),ce=l("p"),ce.textContent=gt,Ye=r(),z=l("div"),g(O.$$.fragment),Re=r(),me=l("p"),me.textContent=ut,Ke=r(),fe=l("p"),fe.textContent=ht,Oe=r(),ge=l("div"),g(ee.$$.fragment),et=r(),D=l("div"),g(te.$$.fragment),tt=r(),ue=l("p"),ue.textContent=_t,ot=r(),g(F.$$.fragment),at=r(),S=l("div"),g(oe.$$.fragment),st=r(),he=l("p"),he.textContent=bt,rt=r(),g(N.$$.fragment),je=r(),g(ae.$$.fragment),ke=r(),U=l("div"),g(se.$$.fragment),nt=r(),_e=l("p"),_e.textContent=$t,it=r(),W=l("div"),g(re.$$.fragment),dt=r(),be=l("p"),be.textContent=xt,Je=r(),g(ne.$$.fragment),ze=r(),we=l("p"),this.h()},l(e){const i=Pt("svelte-u9bgzb",document.head);a=p(i,"META",{name:!0,content:!0}),i.forEach(o),y=n(e),f=p(e,"P",{}),T(f).forEach(o),d=n(e),u(m.$$.fragment,e),t=n(e),u(x.$$.fragment,e),Ie=n(e),X=p(e,"P",{"data-svelte-h":!0}),w(X)!=="svelte-nxzt54"&&(X.innerHTML=lt),Pe=n(e),B=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(B)!=="svelte-10rv8y2"&&(B.innerHTML=pt),Te=n(e),u(Z.$$.fragment,e),Ae=n(e),v=p(e,"DIV",{class:!0});var P=T(v);u(Q.$$.fragment,P),qe=n(P),ie=p(P,"P",{"data-svelte-h":!0}),w(ie)!=="svelte-geelri"&&(ie.textContent=ct),Fe=n(P),de=p(P,"DIV",{class:!0});var ve=T(de);u(V.$$.fragment,ve),ve.forEach(o),Ne=n(P),k=p(P,"DIV",{class:!0});var G=T(k);u(H.$$.fragment,G),We=n(G),le=p(G,"P",{"data-svelte-h":!0}),w(le)!=="svelte-vgoyt3"&&(le.innerHTML=mt),Xe=n(G),u(E.$$.fragment,G),G.forEach(o),Ze=n(P),J=p(P,"DIV",{class:!0});var L=T(J);u(Y.$$.fragment,L),Qe=n(L),pe=p(L,"P",{"data-svelte-h":!0}),w(pe)!=="svelte-io61ja"&&(pe.textContent=ft),Ve=n(L),u(q.$$.fragment,L),L.forEach(o),P.forEach(o),Ue=n(e),u(R.$$.fragment,e),Ce=n(e),M=p(e,"DIV",{class:!0});var A=T(M);u(K.$$.fragment,A),He=n(A),ce=p(A,"P",{"data-svelte-h":!0}),w(ce)!=="svelte-k0v077"&&(ce.textContent=gt),Ye=n(A),z=p(A,"DIV",{class:!0});var $e=T(z);u(O.$$.fragment,$e),Re=n($e),me=p($e,"P",{"data-svelte-h":!0}),w(me)!=="svelte-1w93ehb"&&(me.textContent=ut),Ke=n($e),fe=p($e,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-gdsgj6"&&(fe.textContent=ht),$e.forEach(o),Oe=n(A),ge=p(A,"DIV",{class:!0});var Mt=T(ge);u(ee.$$.fragment,Mt),Mt.forEach(o),et=n(A),D=p(A,"DIV",{class:!0});var xe=T(D);u(te.$$.fragment,xe),tt=n(xe),ue=p(xe,"P",{"data-svelte-h":!0}),w(ue)!=="svelte-1d5sqjz"&&(ue.textContent=_t),ot=n(xe),u(F.$$.fragment,xe),xe.forEach(o),at=n(A),S=p(A,"DIV",{class:!0});var Me=T(S);u(oe.$$.fragment,Me),st=n(Me),he=p(Me,"P",{"data-svelte-h":!0}),w(he)!=="svelte-fo5c0g"&&(he.textContent=bt),rt=n(Me),u(N.$$.fragment,Me),Me.forEach(o),A.forEach(o),je=n(e),u(ae.$$.fragment,e),ke=n(e),U=p(e,"DIV",{class:!0});var ye=T(U);u(se.$$.fragment,ye),nt=n(ye),_e=p(ye,"P",{"data-svelte-h":!0}),w(_e)!=="svelte-mxmwf6"&&(_e.textContent=$t),it=n(ye),W=p(ye,"DIV",{class:!0});var Se=T(W);u(re.$$.fragment,Se),dt=n(Se),be=p(Se,"P",{"data-svelte-h":!0}),w(be)!=="svelte-1jm7ypm"&&(be.textContent=xt),Se.forEach(o),ye.forEach(o),Je=n(e),u(ne.$$.fragment,e),ze=n(e),we=p(e,"P",{}),T(we).forEach(o),this.h()},h(){I(a,"name","hf:doc:metadata"),I(a,"content",zt),I(B,"class","tip"),I(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(U,"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,i){s(document.head,a),c(e,y,i),c(e,f,i),c(e,d,i),h(m,e,i),c(e,t,i),h(x,e,i),c(e,Ie,i),c(e,X,i),c(e,Pe,i),c(e,B,i),c(e,Te,i),h(Z,e,i),c(e,Ae,i),c(e,v,i),h(Q,v,null),s(v,qe),s(v,ie),s(v,Fe),s(v,de),h(V,de,null),s(v,Ne),s(v,k),h(H,k,null),s(k,We),s(k,le),s(k,Xe),h(E,k,null),s(v,Ze),s(v,J),h(Y,J,null),s(J,Qe),s(J,pe),s(J,Ve),h(q,J,null),c(e,Ue,i),h(R,e,i),c(e,Ce,i),c(e,M,i),h(K,M,null),s(M,He),s(M,ce),s(M,Ye),s(M,z),h(O,z,null),s(z,Re),s(z,me),s(z,Ke),s(z,fe),s(M,Oe),s(M,ge),h(ee,ge,null),s(M,et),s(M,D),h(te,D,null),s(D,tt),s(D,ue),s(D,ot),h(F,D,null),s(M,at),s(M,S),h(oe,S,null),s(S,st),s(S,he),s(S,rt),h(N,S,null),c(e,je,i),h(ae,e,i),c(e,ke,i),c(e,U,i),h(se,U,null),s(U,nt),s(U,_e),s(U,it),s(U,W),h(re,W,null),s(W,dt),s(W,be),c(e,Je,i),h(ne,e,i),c(e,ze,i),c(e,we,i),De=!0},p(e,[i]){const P={};i&2&&(P.$$scope={dirty:i,ctx:e}),E.$set(P);const ve={};i&2&&(ve.$$scope={dirty:i,ctx:e}),q.$set(ve);const G={};i&2&&(G.$$scope={dirty:i,ctx:e}),F.$set(G);const L={};i&2&&(L.$$scope={dirty:i,ctx:e}),N.$set(L)},i(e){De||(_(m.$$.fragment,e),_(x.$$.fragment,e),_(Z.$$.fragment,e),_(Q.$$.fragment,e),_(V.$$.fragment,e),_(H.$$.fragment,e),_(E.$$.fragment,e),_(Y.$$.fragment,e),_(q.$$.fragment,e),_(R.$$.fragment,e),_(K.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(te.$$.fragment,e),_(F.$$.fragment,e),_(oe.$$.fragment,e),_(N.$$.fragment,e),_(ae.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ne.$$.fragment,e),De=!0)},o(e){b(m.$$.fragment,e),b(x.$$.fragment,e),b(Z.$$.fragment,e),b(Q.$$.fragment,e),b(V.$$.fragment,e),b(H.$$.fragment,e),b(E.$$.fragment,e),b(Y.$$.fragment,e),b(q.$$.fragment,e),b(R.$$.fragment,e),b(K.$$.fragment,e),b(O.$$.fragment,e),b(ee.$$.fragment,e),b(te.$$.fragment,e),b(F.$$.fragment,e),b(oe.$$.fragment,e),b(N.$$.fragment,e),b(ae.$$.fragment,e),b(se.$$.fragment,e),b(re.$$.fragment,e),b(ne.$$.fragment,e),De=!1},d(e){e&&(o(y),o(f),o(d),o(t),o(Ie),o(X),o(Pe),o(B),o(Te),o(Ae),o(v),o(Ue),o(Ce),o(M),o(je),o(ke),o(U),o(Je),o(ze),o(we)),o(a),$(m,e),$(x,e),$(Z,e),$(Q),$(V),$(H),$(E),$(Y),$(q),$(R,e),$(K),$(O),$(ee),$(te),$(F),$(oe),$(N),$(ae,e),$(se),$(re),$(ne,e)}}}const zt='{"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 Dt(j){return wt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Nt extends vt{constructor(a){super(),It(this,a,Dt,Jt,yt,{})}}export{Nt as component};
