Buckets:

download
raw
5.77 kB
import"../chunks/DsnmJJEf.js";import{i as y,h as I,C as L,H as c,a as w,D as g,E as D,s as C}from"../chunks/BtE7mKSK.js";import{p as x,o as J,s as e,f as Z,a as f,b as N,c as p,d as _,n as h,r as u}from"../chunks/jDjavuwI.js";const W='{"title":"LongCatImageTransformer2DModel","local":"longcatimagetransformer2dmodel","sections":[{"title":"LongCatImageTransformer2DModel","local":"diffusers.LongCatImageTransformer2DModel","sections":[],"depth":2}],"depth":1}';var j=_('<meta name="hf:doc:metadata"/>'),R=_('<p></p> <!> <!> <p>The model can be loaded with the following code snippet.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The Transformer model introduced in Longcat-Image.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The forward method.</p></div></div> <!> <p></p>',1);function H(T,b){x(b,!1),J(()=>{new URLSearchParams(window.location.search).get("fw")}),y();var r=R();I("1qrqpgn",m=>{var l=j();C(l,"content",W),f(m,l)});var a=e(Z(r),2);L(a,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var n=e(a,2);c(n,{title:"LongCatImageTransformer2DModel",local:"longcatimagetransformer2dmodel",headingTag:"h1"});var t=e(n,4);w(t,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExvbmdDYXRJbWFnZVRyYW5zZm9ybWVyMkRNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwTG9uZ0NhdEltYWdlVHJhbnNmb3JtZXIyRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtZWl0dWFuLWxvbmdjYXQlMkZMb25nQ2F0LUltYWdlJTIwJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LongCatImageTransformer2DModel
transformer = LongCatImageTransformer2DModel.from_pretrained(<span class="hljs-string">&quot;meituan-longcat/LongCat-Image &quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,lang:"python",wrap:!1});var s=e(t,2);c(s,{title:"LongCatImageTransformer2DModel",local:"diffusers.LongCatImageTransformer2DModel",headingTag:"h2"});var o=e(s,2),d=p(o);g(d,{name:"class diffusers.LongCatImageTransformer2DModel",anchor:"diffusers.LongCatImageTransformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_longcat_image.py#L395",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 = 3584"},{name:"pooled_projection_dim",val:": int = 3584"},{name:"axes_dims_rope",val:": list = [16, 56, 56]"}]});var i=e(d,4),v=p(i);g(v,{name:"forward",anchor:"diffusers.LongCatImageTransformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_longcat_image.py#L464",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",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:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LongCatImageTransformer2DModel.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.LongCatImageTransformer2DModel.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.LongCatImageTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.LongCatImageTransformer2DModel.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.LongCatImageTransformer2DModel.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.LongCatImageTransformer2DModel.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.LongCatImageTransformer2DModel.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"}],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>
`}),h(2),u(i),u(o);var M=e(o,2);D(M,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/longcat_image_transformer2d.md"}),h(2),f(T,r),N()}export{H as component};

Xet Storage Details

Size:
5.77 kB
·
Xet hash:
af6c9619e9da78c0f0c165f41b6e66730b9e7321ad00446b836882be094e6786

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