Buckets:

download
raw
10 kB
import{s as oe,n as se,o as re}from"../chunks/scheduler.53228c21.js";import{S as ae,i as ie,e as d,s,c as $,h as de,a as m,d as n,b as r,f as q,g as y,j as G,k as V,l,m as a,n as I,t as x,o as M,p as D}from"../chunks/index.cac5d66a.js";import{C as me}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as te}from"../chunks/Docstring.9de32ff4.js";import{C as le}from"../chunks/CodeBlock.606cbaf4.js";import{H as ne,E as fe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function ce(X){let i,U,J,z,u,R,p,j,h,B="The model can be loaded with the following code snippet.",L,g,N,_,k,o,v,S,O,F="The Transformer model introduced in Ovis-Image.",A,w,K='Reference: <a href="https://github.com/AIDC-AI/Ovis-Image" rel="nofollow">https://github.com/AIDC-AI/Ovis-Image</a>',Y,f,T,Q,C,ee='The <a href="/docs/diffusers/pr_13921/en/api/models/ovisimage_transformer2d#diffusers.OvisImageTransformer2DModel">OvisImageTransformer2DModel</a> forward method.',E,b,H,Z,P;return u=new me({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new ne({props:{title:"OvisImageTransformer2DModel",local:"ovisimagetransformer2dmodel",headingTag:"h1"}}),g=new le({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyME92aXNJbWFnZVRyYW5zZm9ybWVyMkRNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwT3Zpc0ltYWdlVHJhbnNmb3JtZXIyRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJBSURDLUFJJTJGT3Zpcy1JbWFnZS03QiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> OvisImageTransformer2DModel
transformer = OvisImageTransformer2DModel.from_pretrained(<span class="hljs-string">&quot;AIDC-AI/Ovis-Image-7B&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,lang:"python",wrap:!1}}),_=new ne({props:{title:"OvisImageTransformer2DModel",local:"diffusers.OvisImageTransformer2DModel",headingTag:"h2"}}),v=new te({props:{name:"class diffusers.OvisImageTransformer2DModel",anchor:"diffusers.OvisImageTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": int | None = 64"},{name:"num_layers",val:": int = 6"},{name:"num_single_layers",val:": int = 27"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 24"},{name:"joint_attention_dim",val:": int = 2048"},{name:"axes_dims_rope",val:": tuple = (16, 56, 56)"}],parametersDescription:[{anchor:"diffusers.OvisImageTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
Patch size to turn the input data into small patches.`,name:"patch_size"},{anchor:"diffusers.OvisImageTransformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>64</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.OvisImageTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of channels in the output. If not specified, it defaults to <code>in_channels</code>.`,name:"out_channels"},{anchor:"diffusers.OvisImageTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>6</code>) &#x2014;
The number of layers of dual stream DiT blocks to use.`,name:"num_layers"},{anchor:"diffusers.OvisImageTransformer2DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>27</code>) &#x2014;
The number of layers of single stream DiT blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.OvisImageTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of dimensions to use for each attention head.`,name:"attention_head_dim"},{anchor:"diffusers.OvisImageTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of attention heads to use.`,name:"num_attention_heads"},{anchor:"diffusers.OvisImageTransformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>2048</code>) &#x2014;
The number of dimensions to use for the joint attention (embedding/channel dimension of
<code>encoder_hidden_states</code>).`,name:"joint_attention_dim"},{anchor:"diffusers.OvisImageTransformer2DModel.axes_dims_rope",description:`<strong>axes_dims_rope</strong> (<code>tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The dimensions to use for the rotary positional embeddings.`,name:"axes_dims_rope"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_ovis_image.py#L384"}}),T=new te({props:{name:"forward",anchor:"diffusers.OvisImageTransformer2DModel.forward",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:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.OvisImageTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, image_sequence_length, in_channels)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.OvisImageTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, text_sequence_length, joint_attention_dim)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.OvisImageTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.OvisImageTransformer2DModel.forward.img_ids",description:`<strong>img_ids</strong> &#x2014; (<code>torch.Tensor</code>):
The position ids for image tokens.`,name:"img_ids"},{anchor:"diffusers.OvisImageTransformer2DModel.forward.txt_ids",description:`<strong>txt_ids</strong> (<code>torch.Tensor</code>) &#x2014;
The position ids for text tokens.`,name:"txt_ids"},{anchor:"diffusers.OvisImageTransformer2DModel.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/transformers/transformer_ovis_image.py#L476",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>
`}}),b=new fe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/ovisimage_transformer2d.md"}}),{c(){i=d("meta"),U=s(),J=d("p"),z=s(),$(u.$$.fragment),R=s(),$(p.$$.fragment),j=s(),h=d("p"),h.textContent=B,L=s(),$(g.$$.fragment),N=s(),$(_.$$.fragment),k=s(),o=d("div"),$(v.$$.fragment),S=s(),O=d("p"),O.textContent=F,A=s(),w=d("p"),w.innerHTML=K,Y=s(),f=d("div"),$(T.$$.fragment),Q=s(),C=d("p"),C.innerHTML=ee,E=s(),$(b.$$.fragment),H=s(),Z=d("p"),this.h()},l(e){const t=de("svelte-u9bgzb",document.head);i=m(t,"META",{name:!0,content:!0}),t.forEach(n),U=r(e),J=m(e,"P",{}),q(J).forEach(n),z=r(e),y(u.$$.fragment,e),R=r(e),y(p.$$.fragment,e),j=r(e),h=m(e,"P",{"data-svelte-h":!0}),G(h)!=="svelte-1vuni30"&&(h.textContent=B),L=r(e),y(g.$$.fragment,e),N=r(e),y(_.$$.fragment,e),k=r(e),o=m(e,"DIV",{class:!0});var c=q(o);y(v.$$.fragment,c),S=r(c),O=m(c,"P",{"data-svelte-h":!0}),G(O)!=="svelte-pz7q0m"&&(O.textContent=F),A=r(c),w=m(c,"P",{"data-svelte-h":!0}),G(w)!=="svelte-fb5wma"&&(w.innerHTML=K),Y=r(c),f=m(c,"DIV",{class:!0});var W=q(f);y(T.$$.fragment,W),Q=r(W),C=m(W,"P",{"data-svelte-h":!0}),G(C)!=="svelte-1nq13of"&&(C.innerHTML=ee),W.forEach(n),c.forEach(n),E=r(e),y(b.$$.fragment,e),H=r(e),Z=m(e,"P",{}),q(Z).forEach(n),this.h()},h(){V(i,"name","hf:doc:metadata"),V(i,"content",ue),V(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),V(o,"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){l(document.head,i),a(e,U,t),a(e,J,t),a(e,z,t),I(u,e,t),a(e,R,t),I(p,e,t),a(e,j,t),a(e,h,t),a(e,L,t),I(g,e,t),a(e,N,t),I(_,e,t),a(e,k,t),a(e,o,t),I(v,o,null),l(o,S),l(o,O),l(o,A),l(o,w),l(o,Y),l(o,f),I(T,f,null),l(f,Q),l(f,C),a(e,E,t),I(b,e,t),a(e,H,t),a(e,Z,t),P=!0},p:se,i(e){P||(x(u.$$.fragment,e),x(p.$$.fragment,e),x(g.$$.fragment,e),x(_.$$.fragment,e),x(v.$$.fragment,e),x(T.$$.fragment,e),x(b.$$.fragment,e),P=!0)},o(e){M(u.$$.fragment,e),M(p.$$.fragment,e),M(g.$$.fragment,e),M(_.$$.fragment,e),M(v.$$.fragment,e),M(T.$$.fragment,e),M(b.$$.fragment,e),P=!1},d(e){e&&(n(U),n(J),n(z),n(R),n(j),n(h),n(L),n(N),n(k),n(o),n(E),n(H),n(Z)),n(i),D(u,e),D(p,e),D(g,e),D(_,e),D(v),D(T),D(b,e)}}}const ue='{"title":"OvisImageTransformer2DModel","local":"ovisimagetransformer2dmodel","sections":[{"title":"OvisImageTransformer2DModel","local":"diffusers.OvisImageTransformer2DModel","sections":[],"depth":2}],"depth":1}';function pe(X){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends ae{constructor(i){super(),ie(this,i,pe,ce,oe,{})}}export{$e as component};

Xet Storage Details

Size:
10 kB
·
Xet hash:
97f71bfc4659426d039a57061ba76c65ad2a4898dcf659b8911434fe77e155c2

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