Buckets:

download
raw
10.9 kB
import{s as ie,n as le,o as de}from"../chunks/scheduler.53228c21.js";import{S as ce,i as me,e as s,s as a,c,h as fe,a as i,d as n,b as r,f as E,g as m,j as J,k as P,l as Q,m as o,n as f,t as p,o as u,p as h}from"../chunks/index.cac5d66a.js";import{C as pe}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as X}from"../chunks/Docstring.9de32ff4.js";import{H as Y,E as ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function he(ee){let l,O,L,z,g,A,_,H,$,te='The ControlNet model was introduced in <a href="https://huggingface.co/papers/2302.05543" rel="nofollow">Adding Conditional Control to Text-to-Image Diffusion Models</a> by Lvmin Zhang, Anyi Rao, Maneesh Agrawala. It provides a greater degree of control over text-to-image generation by conditioning the model on additional inputs such as edge maps, depth maps, segmentation maps, and keypoints for pose detection.',I,v,ne="The abstract from the paper is:",V,b,oe="<em>We present ControlNet, a neural network architecture to add spatial conditioning controls to large, pretrained text-to-image diffusion models. ControlNet locks the production-ready large diffusion models, and reuses their deep and robust encoding layers pretrained with billions of images as a strong backbone to learn a diverse set of conditional controls. The neural architecture is connected with “zero convolutions” (zero-initialized convolution layers) that progressively grow the parameters from zero and ensure that no harmful noise could affect the finetuning. We test various conditioning controls, eg, edges, depth, segmentation, human pose, etc, with Stable Diffusion, using single or multiple conditions, with or without prompts. We show that the training of ControlNets is robust with small (&lt;50k) and large (&gt;1m) datasets. Extensive results show that ControlNet may facilitate wider applications to control image diffusion models.</em>",W,w,ae=`This model was contributed by <a href="https://huggingface.co/ishan24" rel="nofollow">ishan24</a>. ❤️
The original codebase can be found at <a href="https://github.com/NVlabs/Sana" rel="nofollow">NVlabs/Sana</a>, and you can find official ControlNet checkpoints on <a href="https://huggingface.co/Efficient-Large-Model" rel="nofollow">Efficient-Large-Model’s</a> Hub profile.`,F,N,R,d,C,K,k,T,U,M,j,x,S,q,y,G,D,Z;return g=new pe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),_=new Y({props:{title:"SanaControlNetModel",local:"sanacontrolnetmodel",headingTag:"h1"}}),N=new Y({props:{title:"SanaControlNetModel",local:"diffusers.SanaControlNetModel",headingTag:"h2"}}),C=new X({props:{name:"class diffusers.SanaControlNetModel",anchor:"diffusers.SanaControlNetModel",parameters:[{name:"in_channels",val:": int = 32"},{name:"out_channels",val:": int | None = 32"},{name:"num_attention_heads",val:": int = 70"},{name:"attention_head_dim",val:": int = 32"},{name:"num_layers",val:": int = 7"},{name:"num_cross_attention_heads",val:": int | None = 20"},{name:"cross_attention_head_dim",val:": int | None = 112"},{name:"cross_attention_dim",val:": int | None = 2240"},{name:"caption_channels",val:": int = 2304"},{name:"mlp_ratio",val:": float = 2.5"},{name:"dropout",val:": float = 0.0"},{name:"attention_bias",val:": bool = False"},{name:"sample_size",val:": int = 32"},{name:"patch_size",val:": int = 1"},{name:"norm_elementwise_affine",val:": bool = False"},{name:"norm_eps",val:": float = 1e-06"},{name:"interpolation_scale",val:": int | None = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/controlnets/controlnet_sana.py#L41"}}),T=new X({props:{name:"forward",anchor:"diffusers.SanaControlNetModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"controlnet_cond",val:": Tensor"},{name:"conditioning_scale",val:": float = 1.0"},{name:"encoder_attention_mask",val:": torch.Tensor | None = None"},{name:"attention_mask",val:": torch.Tensor | None = None"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SanaControlNetModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, channel, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.SanaControlNetModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.SanaControlNetModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.SanaControlNetModel.forward.controlnet_cond",description:`<strong>controlnet_cond</strong> (<code>torch.Tensor</code>) &#x2014;
The conditional input tensor for the ControlNet.`,name:"controlnet_cond"},{anchor:"diffusers.SanaControlNetModel.forward.conditioning_scale",description:`<strong>conditioning_scale</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1.0</code>) &#x2014;
The scale factor for ControlNet outputs.`,name:"conditioning_scale"},{anchor:"diffusers.SanaControlNetModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask applied to <code>encoder_hidden_states</code>.`,name:"encoder_attention_mask"},{anchor:"diffusers.SanaControlNetModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask applied to <code>hidden_states</code>.`,name:"attention_mask"},{anchor:"diffusers.SanaControlNetModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.SanaControlNetModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain
tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/controlnets/controlnet_sana.py#L120",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> is True, a <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise
a plain <code>tuple</code> is returned.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>~models.transformer_2d.Transformer2DModelOutput</code> or <code>tuple</code></p>
`}}),M=new Y({props:{title:"SanaControlNetOutput",local:"diffusers.models.controlnets.controlnet_sana.SanaControlNetOutput",headingTag:"h2"}}),S=new X({props:{name:"class diffusers.models.controlnets.controlnet_sana.SanaControlNetOutput",anchor:"diffusers.models.controlnets.controlnet_sana.SanaControlNetOutput",parameters:[{name:"controlnet_block_samples",val:": tuple"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/controlnets/controlnet_sana.py#L37"}}),y=new ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/controlnet_sana.md"}}),{c(){l=s("meta"),O=a(),L=s("p"),z=a(),c(g.$$.fragment),A=a(),c(_.$$.fragment),H=a(),$=s("p"),$.innerHTML=te,I=a(),v=s("p"),v.textContent=ne,V=a(),b=s("p"),b.innerHTML=oe,W=a(),w=s("p"),w.innerHTML=ae,F=a(),c(N.$$.fragment),R=a(),d=s("div"),c(C.$$.fragment),K=a(),k=s("div"),c(T.$$.fragment),U=a(),c(M.$$.fragment),j=a(),x=s("div"),c(S.$$.fragment),q=a(),c(y.$$.fragment),G=a(),D=s("p"),this.h()},l(e){const t=fe("svelte-u9bgzb",document.head);l=i(t,"META",{name:!0,content:!0}),t.forEach(n),O=r(e),L=i(e,"P",{}),E(L).forEach(n),z=r(e),m(g.$$.fragment,e),A=r(e),m(_.$$.fragment,e),H=r(e),$=i(e,"P",{"data-svelte-h":!0}),J($)!=="svelte-1s65p96"&&($.innerHTML=te),I=r(e),v=i(e,"P",{"data-svelte-h":!0}),J(v)!=="svelte-1cwsb16"&&(v.textContent=ne),V=r(e),b=i(e,"P",{"data-svelte-h":!0}),J(b)!=="svelte-fbiw6t"&&(b.innerHTML=oe),W=r(e),w=i(e,"P",{"data-svelte-h":!0}),J(w)!=="svelte-106mph8"&&(w.innerHTML=ae),F=r(e),m(N.$$.fragment,e),R=r(e),d=i(e,"DIV",{class:!0});var B=E(d);m(C.$$.fragment,B),K=r(B),k=i(B,"DIV",{class:!0});var re=E(k);m(T.$$.fragment,re),re.forEach(n),B.forEach(n),U=r(e),m(M.$$.fragment,e),j=r(e),x=i(e,"DIV",{class:!0});var se=E(x);m(S.$$.fragment,se),se.forEach(n),q=r(e),m(y.$$.fragment,e),G=r(e),D=i(e,"P",{}),E(D).forEach(n),this.h()},h(){P(l,"name","hf:doc:metadata"),P(l,"content",ge),P(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){Q(document.head,l),o(e,O,t),o(e,L,t),o(e,z,t),f(g,e,t),o(e,A,t),f(_,e,t),o(e,H,t),o(e,$,t),o(e,I,t),o(e,v,t),o(e,V,t),o(e,b,t),o(e,W,t),o(e,w,t),o(e,F,t),f(N,e,t),o(e,R,t),o(e,d,t),f(C,d,null),Q(d,K),Q(d,k),f(T,k,null),o(e,U,t),f(M,e,t),o(e,j,t),o(e,x,t),f(S,x,null),o(e,q,t),f(y,e,t),o(e,G,t),o(e,D,t),Z=!0},p:le,i(e){Z||(p(g.$$.fragment,e),p(_.$$.fragment,e),p(N.$$.fragment,e),p(C.$$.fragment,e),p(T.$$.fragment,e),p(M.$$.fragment,e),p(S.$$.fragment,e),p(y.$$.fragment,e),Z=!0)},o(e){u(g.$$.fragment,e),u(_.$$.fragment,e),u(N.$$.fragment,e),u(C.$$.fragment,e),u(T.$$.fragment,e),u(M.$$.fragment,e),u(S.$$.fragment,e),u(y.$$.fragment,e),Z=!1},d(e){e&&(n(O),n(L),n(z),n(A),n(H),n($),n(I),n(v),n(V),n(b),n(W),n(w),n(F),n(R),n(d),n(U),n(j),n(x),n(q),n(G),n(D)),n(l),h(g,e),h(_,e),h(N,e),h(C),h(T),h(M,e),h(S),h(y,e)}}}const ge='{"title":"SanaControlNetModel","local":"sanacontrolnetmodel","sections":[{"title":"SanaControlNetModel","local":"diffusers.SanaControlNetModel","sections":[],"depth":2},{"title":"SanaControlNetOutput","local":"diffusers.models.controlnets.controlnet_sana.SanaControlNetOutput","sections":[],"depth":2}],"depth":1}';function _e(ee){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ce extends ce{constructor(l){super(),me(this,l,_e,he,ie,{})}}export{Ce as component};

Xet Storage Details

Size:
10.9 kB
·
Xet hash:
b08acec1f5935d934a36db4264b8a680706caf0f3d91e4a9db6f856a3d9b0f3b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.