Buckets:
| import{s as wt,o as yt,n as Ee}from"../chunks/scheduler.53228c21.js";import{S as vt,i as It,e as l,s,c as u,h as Pt,a as c,d as o,b as n,f as T,g as h,j as y,k as I,l as r,m as p,n as g,t as _,o as b,p as $}from"../chunks/index.100fac89.js";import{C as Tt}from"../chunks/CopyLLMTxtMenu.af3e1493.js";import{D as U}from"../chunks/Docstring.147b33f1.js";import{C as qe}from"../chunks/CodeBlock.0adb3827.js";import{E as Ge}from"../chunks/ExampleCodeBlock.6be04f7a.js";import{H as Be,E as At}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.b5eefd91.js";function Ct(j){let a,w="Example:",f,i,m;return i=new qe({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">"up"</span>: {<span class="hljs-string">"block_0"</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">"down"</span>: {<span class="hljs-string">"block_2"</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>]}, | |
| <span class="hljs-string">"up"</span>: {<span class="hljs-string">"block_0"</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">"down"</span>: {<span class="hljs-string">"block_2"</span>: [<span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>]}}, {<span class="hljs-string">"up"</span>: {<span class="hljs-string">"block_0"</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)`,lang:"py",wrap:!1}}),{c(){a=l("p"),a.textContent=w,f=s(),u(i.$$.fragment)},l(t){a=c(t,"P",{"data-svelte-h":!0}),y(a)!=="svelte-11lpom8"&&(a.textContent=w),f=n(t),h(i.$$.fragment,t)},m(t,x){p(t,a,x),p(t,f,x),g(i,t,x),m=!0},p:Ee,i(t){m||(_(i.$$.fragment,t),m=!0)},o(t){b(i.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(i,t)}}}function Ut(j){let a,w="Examples:",f,i,m;return i=new qe({props:{code:"JTIzJTIwQXNzdW1pbmclMjAlNjBwaXBlbGluZSU2MCUyMGlzJTIwYWxyZWFkeSUyMGxvYWRlZCUyMHdpdGglMjB0aGUlMjBJUCUyMEFkYXB0ZXIlMjB3ZWlnaHRzLiUwQXBpcGVsaW5lLnVubG9hZF9pcF9hZGFwdGVyKCklMEEuLi4=",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming `pipeline` is already loaded with the IP Adapter weights.</span>\n<span class="hljs-meta">>>> </span>pipeline.unload_ip_adapter()\n<span class="hljs-meta">>>> </span>...',lang:"python",wrap:!1}}),{c(){a=l("p"),a.textContent=w,f=s(),u(i.$$.fragment)},l(t){a=c(t,"P",{"data-svelte-h":!0}),y(a)!=="svelte-kvfsh7"&&(a.textContent=w),f=n(t),h(i.$$.fragment,t)},m(t,x){p(t,a,x),p(t,f,x),g(i,t,x),m=!0},p:Ee,i(t){m||(_(i.$$.fragment,t),m=!0)},o(t){b(i.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(i,t)}}}function jt(j){let a,w="Example:",f,i,m;return i=new qe({props:{code:"JTIzJTIwQXNzdW1pbmclMjAlNjBwaXBlbGluZSU2MCUyMGlzJTIwYWxyZWFkeSUyMGxvYWRlZCUyMHdpdGglMjB0aGUlMjBJUCUyMEFkYXB0ZXIlMjB3ZWlnaHRzLiUwQXBpcGVsaW5lLnNldF9pcF9hZGFwdGVyX3NjYWxlKDAuNiklMEEuLi4=",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming `pipeline` is already loaded with the IP Adapter weights.</span>\n<span class="hljs-meta">>>> </span>pipeline.set_ip_adapter_scale(<span class="hljs-number">0.6</span>)\n<span class="hljs-meta">>>> </span>...',lang:"python",wrap:!1}}),{c(){a=l("p"),a.textContent=w,f=s(),u(i.$$.fragment)},l(t){a=c(t,"P",{"data-svelte-h":!0}),y(a)!=="svelte-11lpom8"&&(a.textContent=w),f=n(t),h(i.$$.fragment,t)},m(t,x){p(t,a,x),p(t,f,x),g(i,t,x),m=!0},p:Ee,i(t){m||(_(i.$$.fragment,t),m=!0)},o(t){b(i.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(i,t)}}}function kt(j){let a,w="Example:",f,i,m;return i=new qe({props:{code:"JTIzJTIwQXNzdW1pbmclMjAlNjBwaXBlbGluZSU2MCUyMGlzJTIwYWxyZWFkeSUyMGxvYWRlZCUyMHdpdGglMjB0aGUlMjBJUCUyMEFkYXB0ZXIlMjB3ZWlnaHRzLiUwQXBpcGVsaW5lLnVubG9hZF9pcF9hZGFwdGVyKCklMEEuLi4=",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming `pipeline` is already loaded with the IP Adapter weights.</span>\n<span class="hljs-meta">>>> </span>pipeline.unload_ip_adapter()\n<span class="hljs-meta">>>> </span>...',lang:"python",wrap:!1}}),{c(){a=l("p"),a.textContent=w,f=s(),u(i.$$.fragment)},l(t){a=c(t,"P",{"data-svelte-h":!0}),y(a)!=="svelte-11lpom8"&&(a.textContent=w),f=n(t),h(i.$$.fragment,t)},m(t,x){p(t,a,x),p(t,f,x),g(i,t,x),m=!0},p:Ee,i(t){m||(_(i.$$.fragment,t),m=!0)},o(t){b(i.$$.fragment,t),m=!1},d(t){t&&(o(a),o(f)),$(i,t)}}}function Jt(j){let a,w,f,i,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,E,ct='<p>Learn how to load and use an IP-Adapter checkpoint and image in the <a href="../../using-diffusers/ip_adapter">IP-Adapter</a> guide,.</p>',Te,Z,Ae,v,Q,Le,de,pt="Mixin for handling IP Adapters.",Ne,ie,V,Fe,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,q,Ze,J,Y,Qe,ce,ft="Unloads the IP Adapter weights",Ve,L,Ce,R,Ue,M,K,He,pe,ut="Mixin for handling StableDiffusion 3 IP Adapters.",Ye,z,O,Re,me,ht="Checks if IP-Adapter is loaded and scale > 0.",Ke,fe,gt=`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,ue,ee,et,S,te,tt,he,_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,N,at,D,oe,rt,ge,bt="Unloads the IP Adapter weights.",st,F,je,ae,ke,C,re,nt,_e,$t="Image processor for IP Adapter image masks.",dt,W,se,it,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,ye,Se;return m=new Tt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new Be({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h1"}}),Z=new Be({props:{title:"IPAdapterMixin",local:"diffusers.loaders.IPAdapterMixin",headingTag:"h2"}}),Q=new U({props:{name:"class diffusers.loaders.IPAdapterMixin",anchor:"diffusers.loaders.IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/loaders/ip_adapter.py#L54"}}),V=new U({props:{name:"load_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": str | list[str] | dict[str, torch.Tensor]"},{name:"subfolder",val:": str | list[str]"},{name:"weight_name",val:": str | list[str]"},{name:"image_encoder_folder",val:": str | None = '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>) — | |
| 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_13751/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>) — | |
| 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>) — | |
| 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>) — | |
| 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="image_encoder"</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="different_subfolder/image_encoder"</code>.`,name:"image_encoder_folder"},{anchor:"diffusers.loaders.IPAdapterMixin.load_ip_adapter.cache_dir",description:`<strong>cache_dir</strong> (<code>str | os.PathLike</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</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>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’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>) — | |
| 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>"main"</code>) — | |
| 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 >= 1.9.0 else <code>False</code>) — | |
| 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 >= 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_13751/src/diffusers/loaders/ip_adapter.py#L57"}}),H=new U({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_13751/src/diffusers/loaders/ip_adapter.py#L252"}}),q=new Ge({props:{anchor:"diffusers.loaders.IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[Ct]},$$scope:{ctx:j}}}),Y=new U({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/loaders/ip_adapter.py#L305"}}),L=new Ge({props:{anchor:"diffusers.loaders.IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[Ut]},$$scope:{ctx:j}}}),R=new Be({props:{title:"SD3IPAdapterMixin",local:"diffusers.loaders.SD3IPAdapterMixin",headingTag:"h2"}}),K=new U({props:{name:"class diffusers.loaders.SD3IPAdapterMixin",anchor:"diffusers.loaders.SD3IPAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/loaders/ip_adapter.py#L897"}}),O=new U({props:{name:"is_ip_adapter_active",anchor:"diffusers.loaders.SD3IPAdapterMixin.is_ip_adapter_active",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13751/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 U({props:{name:"load_ip_adapter",anchor:"diffusers.loaders.SD3IPAdapterMixin.load_ip_adapter",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": str | dict[str, torch.Tensor]"},{name:"weight_name",val:": str = 'ip-adapter.safetensors'"},{name:"subfolder",val:": str | None = None"},{name:"image_encoder_folder",val:": str | None = '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>) — | |
| 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_13751/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 “ip-adapter.safetensors”) — | |
| 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>) — | |
| 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>) — | |
| 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="image_encoder"</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="different_subfolder/image_encoder"</code>.`,name:"image_encoder_folder"},{anchor:"diffusers.loaders.SD3IPAdapterMixin.load_ip_adapter.cache_dir",description:`<strong>cache_dir</strong> (<code>str | os.PathLike</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</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>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’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>) — | |
| 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>"main"</code>) — | |
| 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 >= 1.9.0 else <code>False</code>) — | |
| 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 >= 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_13751/src/diffusers/loaders/ip_adapter.py#L918"}}),te=new U({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) — | |
| IP-Adapter scale to be set.`,name:"scale"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/loaders/ip_adapter.py#L1066"}}),N=new Ge({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.set_ip_adapter_scale.example",$$slots:{default:[jt]},$$scope:{ctx:j}}}),oe=new U({props:{name:"unload_ip_adapter",anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/loaders/ip_adapter.py#L1089"}}),F=new Ge({props:{anchor:"diffusers.loaders.SD3IPAdapterMixin.unload_ip_adapter.example",$$slots:{default:[kt]},$$scope:{ctx:j}}}),ae=new Be({props:{title:"IPAdapterMaskProcessor",local:"diffusers.IPAdapterMaskProcessor",headingTag:"h2"}}),re=new U({props:{name:"class diffusers.IPAdapterMaskProcessor",anchor:"diffusers.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.IPAdapterMaskProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to downscale the image’s (height, width) dimensions to multiples of <code>vae_scale_factor</code>.`,name:"do_resize"},{anchor:"diffusers.IPAdapterMaskProcessor.vae_scale_factor",description:`<strong>vae_scale_factor</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8</code>) — | |
| 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.IPAdapterMaskProcessor.resample",description:`<strong>resample</strong> (<code>str</code>, <em>optional</em>, defaults to <code>lanczos</code>) — | |
| Resampling filter to use when resizing the image.`,name:"resample"},{anchor:"diffusers.IPAdapterMaskProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to normalize the image to [-1,1].`,name:"do_normalize"},{anchor:"diffusers.IPAdapterMaskProcessor.do_binarize",description:`<strong>do_binarize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to binarize the image to 0/1.`,name:"do_binarize"},{anchor:"diffusers.IPAdapterMaskProcessor.do_convert_grayscale",description:`<strong>do_convert_grayscale</strong> (<code>bool</code>, <em>optional</em>, defaults to be <code>True</code>) — | |
| Whether to convert the images to grayscale format.`,name:"do_convert_grayscale"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/image_processor.py#L1270"}}),se=new U({props:{name:"downsample",anchor:"diffusers.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.IPAdapterMaskProcessor.downsample.mask",description:`<strong>mask</strong> (<code>torch.Tensor</code>) — | |
| The input mask tensor generated with <code>IPAdapterMaskProcessor.preprocess()</code>.`,name:"mask"},{anchor:"diffusers.IPAdapterMaskProcessor.downsample.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) — | |
| The batch size.`,name:"batch_size"},{anchor:"diffusers.IPAdapterMaskProcessor.downsample.num_queries",description:`<strong>num_queries</strong> (<code>int</code>) — | |
| The number of queries.`,name:"num_queries"},{anchor:"diffusers.IPAdapterMaskProcessor.downsample.value_embed_dim",description:`<strong>value_embed_dim</strong> (<code>int</code>) — | |
| The dimensionality of the value embeddings.`,name:"value_embed_dim"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/image_processor.py#L1311",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"),w=s(),f=l("p"),i=s(),u(m.$$.fragment),t=s(),u(x.$$.fragment),Ie=s(),X=l("p"),X.innerHTML=lt,Pe=s(),E=l("blockquote"),E.innerHTML=ct,Te=s(),u(Z.$$.fragment),Ae=s(),v=l("div"),u(Q.$$.fragment),Le=s(),de=l("p"),de.textContent=pt,Ne=s(),ie=l("div"),u(V.$$.fragment),Fe=s(),k=l("div"),u(H.$$.fragment),We=s(),le=l("p"),le.innerHTML=mt,Xe=s(),u(q.$$.fragment),Ze=s(),J=l("div"),u(Y.$$.fragment),Qe=s(),ce=l("p"),ce.textContent=ft,Ve=s(),u(L.$$.fragment),Ce=s(),u(R.$$.fragment),Ue=s(),M=l("div"),u(K.$$.fragment),He=s(),pe=l("p"),pe.textContent=ut,Ye=s(),z=l("div"),u(O.$$.fragment),Re=s(),me=l("p"),me.textContent=ht,Ke=s(),fe=l("p"),fe.textContent=gt,Oe=s(),ue=l("div"),u(ee.$$.fragment),et=s(),S=l("div"),u(te.$$.fragment),tt=s(),he=l("p"),he.textContent=_t,ot=s(),u(N.$$.fragment),at=s(),D=l("div"),u(oe.$$.fragment),rt=s(),ge=l("p"),ge.textContent=bt,st=s(),u(F.$$.fragment),je=s(),u(ae.$$.fragment),ke=s(),C=l("div"),u(re.$$.fragment),nt=s(),_e=l("p"),_e.textContent=$t,dt=s(),W=l("div"),u(se.$$.fragment),it=s(),be=l("p"),be.textContent=xt,Je=s(),u(ne.$$.fragment),ze=s(),ye=l("p"),this.h()},l(e){const d=Pt("svelte-u9bgzb",document.head);a=c(d,"META",{name:!0,content:!0}),d.forEach(o),w=n(e),f=c(e,"P",{}),T(f).forEach(o),i=n(e),h(m.$$.fragment,e),t=n(e),h(x.$$.fragment,e),Ie=n(e),X=c(e,"P",{"data-svelte-h":!0}),y(X)!=="svelte-nxzt54"&&(X.innerHTML=lt),Pe=n(e),E=c(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),y(E)!=="svelte-qhklyy"&&(E.innerHTML=ct),Te=n(e),h(Z.$$.fragment,e),Ae=n(e),v=c(e,"DIV",{class:!0});var P=T(v);h(Q.$$.fragment,P),Le=n(P),de=c(P,"P",{"data-svelte-h":!0}),y(de)!=="svelte-geelri"&&(de.textContent=pt),Ne=n(P),ie=c(P,"DIV",{class:!0});var ve=T(ie);h(V.$$.fragment,ve),ve.forEach(o),Fe=n(P),k=c(P,"DIV",{class:!0});var G=T(k);h(H.$$.fragment,G),We=n(G),le=c(G,"P",{"data-svelte-h":!0}),y(le)!=="svelte-vgoyt3"&&(le.innerHTML=mt),Xe=n(G),h(q.$$.fragment,G),G.forEach(o),Ze=n(P),J=c(P,"DIV",{class:!0});var B=T(J);h(Y.$$.fragment,B),Qe=n(B),ce=c(B,"P",{"data-svelte-h":!0}),y(ce)!=="svelte-io61ja"&&(ce.textContent=ft),Ve=n(B),h(L.$$.fragment,B),B.forEach(o),P.forEach(o),Ce=n(e),h(R.$$.fragment,e),Ue=n(e),M=c(e,"DIV",{class:!0});var A=T(M);h(K.$$.fragment,A),He=n(A),pe=c(A,"P",{"data-svelte-h":!0}),y(pe)!=="svelte-k0v077"&&(pe.textContent=ut),Ye=n(A),z=c(A,"DIV",{class:!0});var $e=T(z);h(O.$$.fragment,$e),Re=n($e),me=c($e,"P",{"data-svelte-h":!0}),y(me)!=="svelte-1w93ehb"&&(me.textContent=ht),Ke=n($e),fe=c($e,"P",{"data-svelte-h":!0}),y(fe)!=="svelte-gdsgj6"&&(fe.textContent=gt),$e.forEach(o),Oe=n(A),ue=c(A,"DIV",{class:!0});var Mt=T(ue);h(ee.$$.fragment,Mt),Mt.forEach(o),et=n(A),S=c(A,"DIV",{class:!0});var xe=T(S);h(te.$$.fragment,xe),tt=n(xe),he=c(xe,"P",{"data-svelte-h":!0}),y(he)!=="svelte-1d5sqjz"&&(he.textContent=_t),ot=n(xe),h(N.$$.fragment,xe),xe.forEach(o),at=n(A),D=c(A,"DIV",{class:!0});var Me=T(D);h(oe.$$.fragment,Me),rt=n(Me),ge=c(Me,"P",{"data-svelte-h":!0}),y(ge)!=="svelte-fo5c0g"&&(ge.textContent=bt),st=n(Me),h(F.$$.fragment,Me),Me.forEach(o),A.forEach(o),je=n(e),h(ae.$$.fragment,e),ke=n(e),C=c(e,"DIV",{class:!0});var we=T(C);h(re.$$.fragment,we),nt=n(we),_e=c(we,"P",{"data-svelte-h":!0}),y(_e)!=="svelte-mxmwf6"&&(_e.textContent=$t),dt=n(we),W=c(we,"DIV",{class:!0});var De=T(W);h(se.$$.fragment,De),it=n(De),be=c(De,"P",{"data-svelte-h":!0}),y(be)!=="svelte-1jm7ypm"&&(be.textContent=xt),De.forEach(o),we.forEach(o),Je=n(e),h(ne.$$.fragment,e),ze=n(e),ye=c(e,"P",{}),T(ye).forEach(o),this.h()},h(){I(a,"name","hf:doc:metadata"),I(a,"content",zt),I(E,"class","tip"),I(ie,"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(ue,"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(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(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(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,d){r(document.head,a),p(e,w,d),p(e,f,d),p(e,i,d),g(m,e,d),p(e,t,d),g(x,e,d),p(e,Ie,d),p(e,X,d),p(e,Pe,d),p(e,E,d),p(e,Te,d),g(Z,e,d),p(e,Ae,d),p(e,v,d),g(Q,v,null),r(v,Le),r(v,de),r(v,Ne),r(v,ie),g(V,ie,null),r(v,Fe),r(v,k),g(H,k,null),r(k,We),r(k,le),r(k,Xe),g(q,k,null),r(v,Ze),r(v,J),g(Y,J,null),r(J,Qe),r(J,ce),r(J,Ve),g(L,J,null),p(e,Ce,d),g(R,e,d),p(e,Ue,d),p(e,M,d),g(K,M,null),r(M,He),r(M,pe),r(M,Ye),r(M,z),g(O,z,null),r(z,Re),r(z,me),r(z,Ke),r(z,fe),r(M,Oe),r(M,ue),g(ee,ue,null),r(M,et),r(M,S),g(te,S,null),r(S,tt),r(S,he),r(S,ot),g(N,S,null),r(M,at),r(M,D),g(oe,D,null),r(D,rt),r(D,ge),r(D,st),g(F,D,null),p(e,je,d),g(ae,e,d),p(e,ke,d),p(e,C,d),g(re,C,null),r(C,nt),r(C,_e),r(C,dt),r(C,W),g(se,W,null),r(W,it),r(W,be),p(e,Je,d),g(ne,e,d),p(e,ze,d),p(e,ye,d),Se=!0},p(e,[d]){const P={};d&2&&(P.$$scope={dirty:d,ctx:e}),q.$set(P);const ve={};d&2&&(ve.$$scope={dirty:d,ctx:e}),L.$set(ve);const G={};d&2&&(G.$$scope={dirty:d,ctx:e}),N.$set(G);const B={};d&2&&(B.$$scope={dirty:d,ctx:e}),F.$set(B)},i(e){Se||(_(m.$$.fragment,e),_(x.$$.fragment,e),_(Z.$$.fragment,e),_(Q.$$.fragment,e),_(V.$$.fragment,e),_(H.$$.fragment,e),_(q.$$.fragment,e),_(Y.$$.fragment,e),_(L.$$.fragment,e),_(R.$$.fragment,e),_(K.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(te.$$.fragment,e),_(N.$$.fragment,e),_(oe.$$.fragment,e),_(F.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(se.$$.fragment,e),_(ne.$$.fragment,e),Se=!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(q.$$.fragment,e),b(Y.$$.fragment,e),b(L.$$.fragment,e),b(R.$$.fragment,e),b(K.$$.fragment,e),b(O.$$.fragment,e),b(ee.$$.fragment,e),b(te.$$.fragment,e),b(N.$$.fragment,e),b(oe.$$.fragment,e),b(F.$$.fragment,e),b(ae.$$.fragment,e),b(re.$$.fragment,e),b(se.$$.fragment,e),b(ne.$$.fragment,e),Se=!1},d(e){e&&(o(w),o(f),o(i),o(t),o(Ie),o(X),o(Pe),o(E),o(Te),o(Ae),o(v),o(Ce),o(Ue),o(M),o(je),o(ke),o(C),o(Je),o(ze),o(ye)),o(a),$(m,e),$(x,e),$(Z,e),$(Q),$(V),$(H),$(q),$(Y),$(L),$(R,e),$(K),$(O),$(ee),$(te),$(N),$(oe),$(F),$(ae,e),$(re),$(se),$(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.IPAdapterMaskProcessor","sections":[],"depth":2}],"depth":1}';function St(j){return yt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ft extends vt{constructor(a){super(),It(this,a,St,Jt,wt,{})}}export{Ft as component}; | |
Xet Storage Details
- Size:
- 33.8 kB
- Xet hash:
- 3dac1827fa245c45ac0009675e08f74237c5587d9e6f0ec5408fc541ef5ac9a3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.