Buckets:

HuggingFaceDocBuilder's picture
download
raw
11.2 kB
import{s as oe,n as te,o as ne}from"../chunks/scheduler.53228c21.js";import{S as re,i as se,e as d,s as r,c as M,h as ae,a as l,d as t,b as s,f as O,g as D,j as R,k as U,l as m,m as a,n as w,t as B,o as y,p as k}from"../chunks/index.cac5d66a.js";import{C as ie}from"../chunks/CopyLLMTxtMenu.5ac9ab94.js";import{D as Z}from"../chunks/Docstring.8a316450.js";import{H as ee,E as de}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92b2cd9d.js";function le(J){let i,N,j,z,p,P,u,C,_,K='A modified flux Transformer model from <a href="https://huggingface.co/briaai/BRIA-3.2" rel="nofollow">Bria</a>',E,h,A,n,g,W,$,Q="The Transformer model introduced in Flux. Based on FluxPipeline with several changes:",q,v,X=`<li>no pooled embeddings</li> <li>We use zero padding for prompts</li> <li>No guidance embedding since this is not a distilled version
Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a></li>`,G,c,b,V,x,Y='The <a href="/docs/diffusers/pr_13813/en/api/models/bria_transformer#diffusers.BriaTransformer2DModel">BriaTransformer2DModel</a> forward method.',H,T,F,L,I;return p=new ie({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),u=new ee({props:{title:"BriaTransformer2DModel",local:"briatransformer2dmodel",headingTag:"h1"}}),h=new ee({props:{title:"BriaTransformer2DModel",local:"diffusers.BriaTransformer2DModel",headingTag:"h2"}}),g=new Z({props:{name:"class diffusers.BriaTransformer2DModel",anchor:"diffusers.BriaTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"num_layers",val:": int = 19"},{name:"num_single_layers",val:": int = 38"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 24"},{name:"joint_attention_dim",val:": int = 4096"},{name:"pooled_projection_dim",val:": int = None"},{name:"guidance_embeds",val:": bool = False"},{name:"axes_dims_rope",val:": list = [16, 56, 56]"},{name:"rope_theta",val:" = 10000"},{name:"time_theta",val:" = 10000"}],parametersDescription:[{anchor:"diffusers.BriaTransformer2DModel.patch_size",description:"<strong>patch_size</strong> (<code>int</code>) &#x2014; Patch size to turn the input data into small patches.",name:"patch_size"},{anchor:"diffusers.BriaTransformer2DModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014; The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.BriaTransformer2DModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of layers of MMDiT blocks to use.",name:"num_layers"},{anchor:"diffusers.BriaTransformer2DModel.num_single_layers",description:"<strong>num_single_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of layers of single DiT blocks to use.",name:"num_single_layers"},{anchor:"diffusers.BriaTransformer2DModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014; The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.BriaTransformer2DModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 18) &#x2014; The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.BriaTransformer2DModel.joint_attention_dim",description:"<strong>joint_attention_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The number of <code>encoder_hidden_states</code> dimensions to use.",name:"joint_attention_dim"},{anchor:"diffusers.BriaTransformer2DModel.pooled_projection_dim",description:"<strong>pooled_projection_dim</strong> (<code>int</code>) &#x2014; Number of dimensions to use when projecting the <code>pooled_projections</code>.",name:"pooled_projection_dim"},{anchor:"diffusers.BriaTransformer2DModel.guidance_embeds",description:"<strong>guidance_embeds</strong> (<code>bool</code>, defaults to False) &#x2014; Whether to use guidance embeddings.",name:"guidance_embeds"}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/transformers/transformer_bria.py#L506"}}),b=new Z({props:{name:"forward",anchor:"diffusers.BriaTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"pooled_projections",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"img_ids",val:": Tensor = None"},{name:"txt_ids",val:": Tensor = None"},{name:"guidance",val:": Tensor = None"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"},{name:"controlnet_block_samples",val:" = None"},{name:"controlnet_single_block_samples",val:" = None"}],parametersDescription:[{anchor:"diffusers.BriaTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, channel, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.BriaTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, sequence_len, embed_dims)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.BriaTransformer2DModel.forward.pooled_projections",description:`<strong>pooled_projections</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, projection_dim)</code>) &#x2014; Embeddings projected
from the embeddings of input conditions.`,name:"pooled_projections"},{anchor:"diffusers.BriaTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.BriaTransformer2DModel.forward.img_ids",description:`<strong>img_ids</strong> (<code>torch.Tensor</code>) &#x2014;
Image position ids used to compute the rotary positional embeddings.`,name:"img_ids"},{anchor:"diffusers.BriaTransformer2DModel.forward.txt_ids",description:`<strong>txt_ids</strong> (<code>torch.Tensor</code>) &#x2014;
Text position ids used to compute the rotary positional embeddings.`,name:"txt_ids"},{anchor:"diffusers.BriaTransformer2DModel.forward.guidance",description:`<strong>guidance</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Guidance scale embedding used for guidance-distilled variants of the model.`,name:"guidance"},{anchor:"diffusers.BriaTransformer2DModel.forward.controlnet_block_samples",description:`<strong>controlnet_block_samples</strong> (<code>list</code> of <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"controlnet_block_samples"},{anchor:"diffusers.BriaTransformer2DModel.forward.controlnet_single_block_samples",description:`<strong>controlnet_single_block_samples</strong> (<code>list</code> of <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
A list of tensors that if specified are added to the residuals of single transformer blocks.`,name:"controlnet_single_block_samples"},{anchor:"diffusers.BriaTransformer2DModel.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.BriaTransformer2DModel.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_13813/src/diffusers/models/transformers/transformer_bria.py#L584",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> is True, an <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise a
<code>tuple</code> where the first element is the sample tensor.</p>
`}}),T=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/bria_transformer.md"}}),{c(){i=d("meta"),N=r(),j=d("p"),z=r(),M(p.$$.fragment),P=r(),M(u.$$.fragment),C=r(),_=d("p"),_.innerHTML=K,E=r(),M(h.$$.fragment),A=r(),n=d("div"),M(g.$$.fragment),W=r(),$=d("p"),$.textContent=Q,q=r(),v=d("ul"),v.innerHTML=X,G=r(),c=d("div"),M(b.$$.fragment),V=r(),x=d("p"),x.innerHTML=Y,H=r(),M(T.$$.fragment),F=r(),L=d("p"),this.h()},l(e){const o=ae("svelte-u9bgzb",document.head);i=l(o,"META",{name:!0,content:!0}),o.forEach(t),N=s(e),j=l(e,"P",{}),O(j).forEach(t),z=s(e),D(p.$$.fragment,e),P=s(e),D(u.$$.fragment,e),C=s(e),_=l(e,"P",{"data-svelte-h":!0}),R(_)!=="svelte-vdk7rf"&&(_.innerHTML=K),E=s(e),D(h.$$.fragment,e),A=s(e),n=l(e,"DIV",{class:!0});var f=O(n);D(g.$$.fragment,f),W=s(f),$=l(f,"P",{"data-svelte-h":!0}),R($)!=="svelte-j29xf4"&&($.textContent=Q),q=s(f),v=l(f,"UL",{"data-svelte-h":!0}),R(v)!=="svelte-y346xd"&&(v.innerHTML=X),G=s(f),c=l(f,"DIV",{class:!0});var S=O(c);D(b.$$.fragment,S),V=s(S),x=l(S,"P",{"data-svelte-h":!0}),R(x)!=="svelte-jy7ztf"&&(x.innerHTML=Y),S.forEach(t),f.forEach(t),H=s(e),D(T.$$.fragment,e),F=s(e),L=l(e,"P",{}),O(L).forEach(t),this.h()},h(){U(i,"name","hf:doc:metadata"),U(i,"content",me),U(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(n,"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,o){m(document.head,i),a(e,N,o),a(e,j,o),a(e,z,o),w(p,e,o),a(e,P,o),w(u,e,o),a(e,C,o),a(e,_,o),a(e,E,o),w(h,e,o),a(e,A,o),a(e,n,o),w(g,n,null),m(n,W),m(n,$),m(n,q),m(n,v),m(n,G),m(n,c),w(b,c,null),m(c,V),m(c,x),a(e,H,o),w(T,e,o),a(e,F,o),a(e,L,o),I=!0},p:te,i(e){I||(B(p.$$.fragment,e),B(u.$$.fragment,e),B(h.$$.fragment,e),B(g.$$.fragment,e),B(b.$$.fragment,e),B(T.$$.fragment,e),I=!0)},o(e){y(p.$$.fragment,e),y(u.$$.fragment,e),y(h.$$.fragment,e),y(g.$$.fragment,e),y(b.$$.fragment,e),y(T.$$.fragment,e),I=!1},d(e){e&&(t(N),t(j),t(z),t(P),t(C),t(_),t(E),t(A),t(n),t(H),t(F),t(L)),t(i),k(p,e),k(u,e),k(h,e),k(g),k(b),k(T,e)}}}const me='{"title":"BriaTransformer2DModel","local":"briatransformer2dmodel","sections":[{"title":"BriaTransformer2DModel","local":"diffusers.BriaTransformer2DModel","sections":[],"depth":2}],"depth":1}';function ce(J){return ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends re{constructor(i){super(),se(this,i,ce,le,oe,{})}}export{ge as component};

Xet Storage Details

Size:
11.2 kB
·
Xet hash:
926065df44a59bbd45d18d915036ffb9e3072b8fdc46d5ad1a23cf71bad84fac

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