import{s as Je,f as je,o as Ge,n as Ae}from"../chunks/scheduler.25b97de1.js";import{S as Be,i as Fe,g as n,s as a,r as p,A as Ne,h as o,f as i,c as s,j as Ee,u,x as m,k as V,y as Ve,a as l,v as c,d,t as h,w as g}from"../chunks/index.d9030fc9.js";import{T as Ye}from"../chunks/Tip.baa67368.js";import{C as we}from"../chunks/CodeBlock.e6cd0d95.js";import{P as qe}from"../chunks/PipelineTag.5f100392.js";import{H as ve,E as Se}from"../chunks/EditOnGithub.91d95064.js";function ze(Y){let r,v='As DiT’s architecture is equivalent to that of BEiT, one can refer to <a href="beit">BEiT’s documentation page</a> for all tips, code examples and notebooks.';return{c(){r=n("p"),r.innerHTML=v},l(f){r=o(f,"P",{"data-svelte-h":!0}),m(r)!=="svelte-1m8yg77"&&(r.innerHTML=v)},m(f,F){l(f,r,F)},p:Ae,d(f){f&&i(r)}}}function Xe(Y){let r,v,f,F,w,q,y,S,T,ye=`DiT was proposed in <a href="https://arxiv.org/abs/2203.02378" rel="nofollow">DiT: Self-supervised Pre-training for Document Image Transformer</a> by Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
DiT applies the self-supervised objective of <a href="beit">BEiT</a> (BERT pre-training of Image Transformers) to 42 million document images, allowing for state-of-the-art results on tasks including:`,z,M,Te=`<li>document image classification: the <a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a> dataset (a collection of
400,000 images belonging to one of 16 classes).</li> <li>document layout analysis: the <a href="https://github.com/ibm-aur-nlp/PubLayNet" rel="nofollow">PubLayNet</a> dataset (a collection of more
than 360,000 document images constructed by automatically parsing PubMed XML files).</li> <li>table detection: the <a href="https://github.com/cndplab-founder/ICDAR2019_cTDaR" rel="nofollow">ICDAR 2019 cTDaR</a> dataset (a collection of
600 training images and 240 testing images).</li>`,X,_,Me="The abstract from the paper is the following:",Q,C,_e="<em>Image Transformer has recently achieved significant progress for natural image understanding, either using supervised (ViT, DeiT, etc.) or self-supervised (BEiT, MAE, etc.) pre-training techniques. In this paper, we propose DiT, a self-supervised pre-trained Document Image Transformer model using large-scale unlabeled text images for Document AI tasks, which is essential since no supervised counterparts ever exist due to the lack of human labeled document images. We leverage DiT as the backbone network in a variety of vision-based Document AI tasks, including document image classification, document layout analysis, as well as table detection. Experiment results have illustrated that the self-supervised pre-trained DiT model achieves new state-of-the-art results on these downstream tasks, e.g. document image classification (91.11 → 92.69), document layout analysis (91.0 → 94.9) and table detection (94.23 → 96.55).</em>",O,b,Ce,K,x,xe="Summary of the approach. Taken from the [original paper](https://arxiv.org/abs/2203.02378).",ee,k,ke='This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>. The original code can be found <a href="https://github.com/microsoft/unilm/tree/master/dit" rel="nofollow">here</a>.',te,L,ie,Z,Le="One can directly use the weights of DiT with the AutoModel API:",le,R,ae,I,Ze="This will load the model pre-trained on masked image modeling. Note that this won’t include the language modeling head on top, used to predict visual tokens.",se,P,Re="To include the head, you can load the weights into a <code>BeitForMaskedImageModeling</code> model, like so:",ne,W,oe,H,Ie='You can also load a fine-tuned model from the <a href="https://huggingface.co/models?other=dit" rel="nofollow">hub</a>, like so:',re,D,me,U,Pe=`This particular checkpoint was fine-tuned on <a href="https://www.cs.cmu.edu/~aharley/rvl-cdip/" rel="nofollow">RVL-CDIP</a>, an important benchmark for document image classification.
A notebook that illustrates inference for document image classification can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DiT/Inference_with_DiT_(Document_Image_Transformer)_for_document_image_classification.ipynb" rel="nofollow">here</a>.`,fe,E,pe,J,We="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with DiT.",ue,j,ce,G,He='<li><a href="/docs/transformers/pr_29969/en/model_doc/beit#transformers.BeitForImageClassification">BeitForImageClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">notebook</a>.</li>',de,A,De="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",he,$,ge,B,be,N,$e;return w=new ve({props:{title:"DiT",local:"dit",headingTag:"h1"}}),y=new ve({props:{title:"Overview",local:"overview",headingTag:"h2"}}),L=new ve({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),R=new we({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZkaXQtYmFzZSUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

model = AutoModel.from_pretrained(<span class="hljs-string">&quot;microsoft/dit-base&quot;</span>)`,wrap:!1}}),W=new we({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlaXRGb3JNYXNrZWRJbWFnZU1vZGVsaW5nJTBBJTBBbW9kZWwlMjAlM0QlMjBCZWl0Rm9yTWFza2VkSW1hZ2VNb2RlbGluZy5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGZGl0LWJhc2UlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BeitForMaskedImageModeling

model = BeitForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/dit-base&quot;</span>)`,wrap:!1}}),D=new we({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmRpdC1iYXNlLWZpbmV0dW5lZC1ydmxjZGlwJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification

model = AutoModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/dit-base-finetuned-rvlcdip&quot;</span>)`,wrap:!1}}),E=new ve({props:{title:"Resources",local:"resources",headingTag:"h2"}}),j=new qe({props:{pipeline:"image-classification"}}),$=new Ye({props:{$$slots:{default:[ze]},$$scope:{ctx:Y}}}),B=new Se({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/dit.md"}}),{c(){r=n("meta"),v=a(),f=n("p"),F=a(),p(w.$$.fragment),q=a(),p(y.$$.fragment),S=a(),T=n("p"),T.innerHTML=ye,z=a(),M=n("ul"),M.innerHTML=Te,X=a(),_=n("p"),_.textContent=Me,Q=a(),C=n("p"),C.innerHTML=_e,O=a(),b=n("img"),K=a(),x=n("small"),x.textContent=xe,ee=a(),k=n("p"),k.innerHTML=ke,te=a(),p(L.$$.fragment),ie=a(),Z=n("p"),Z.textContent=Le,le=a(),p(R.$$.fragment),ae=a(),I=n("p"),I.textContent=Ze,se=a(),P=n("p"),P.innerHTML=Re,ne=a(),p(W.$$.fragment),oe=a(),H=n("p"),H.innerHTML=Ie,re=a(),p(D.$$.fragment),me=a(),U=n("p"),U.innerHTML=Pe,fe=a(),p(E.$$.fragment),pe=a(),J=n("p"),J.textContent=We,ue=a(),p(j.$$.fragment),ce=a(),G=n("ul"),G.innerHTML=He,de=a(),A=n("p"),A.textContent=De,he=a(),p($.$$.fragment),ge=a(),p(B.$$.fragment),be=a(),N=n("p"),this.h()},l(e){const t=Ne("svelte-u9bgzb",document.head);r=o(t,"META",{name:!0,content:!0}),t.forEach(i),v=s(e),f=o(e,"P",{}),Ee(f).forEach(i),F=s(e),u(w.$$.fragment,e),q=s(e),u(y.$$.fragment,e),S=s(e),T=o(e,"P",{"data-svelte-h":!0}),m(T)!=="svelte-1gbdpy8"&&(T.innerHTML=ye),z=s(e),M=o(e,"UL",{"data-svelte-h":!0}),m(M)!=="svelte-1f9lxhv"&&(M.innerHTML=Te),X=s(e),_=o(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-vfdo9a"&&(_.textContent=Me),Q=s(e),C=o(e,"P",{"data-svelte-h":!0}),m(C)!=="svelte-s1efxi"&&(C.innerHTML=_e),O=s(e),b=o(e,"IMG",{src:!0,alt:!0,width:!0}),K=s(e),x=o(e,"SMALL",{"data-svelte-h":!0}),m(x)!=="svelte-1lej16g"&&(x.textContent=xe),ee=s(e),k=o(e,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1c0fpli"&&(k.innerHTML=ke),te=s(e),u(L.$$.fragment,e),ie=s(e),Z=o(e,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-vgbz98"&&(Z.textContent=Le),le=s(e),u(R.$$.fragment,e),ae=s(e),I=o(e,"P",{"data-svelte-h":!0}),m(I)!=="svelte-bff7eu"&&(I.textContent=Ze),se=s(e),P=o(e,"P",{"data-svelte-h":!0}),m(P)!=="svelte-167pfvb"&&(P.innerHTML=Re),ne=s(e),u(W.$$.fragment,e),oe=s(e),H=o(e,"P",{"data-svelte-h":!0}),m(H)!=="svelte-imixxa"&&(H.innerHTML=Ie),re=s(e),u(D.$$.fragment,e),me=s(e),U=o(e,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1ixff4z"&&(U.innerHTML=Pe),fe=s(e),u(E.$$.fragment,e),pe=s(e),J=o(e,"P",{"data-svelte-h":!0}),m(J)!=="svelte-1w25qz0"&&(J.textContent=We),ue=s(e),u(j.$$.fragment,e),ce=s(e),G=o(e,"UL",{"data-svelte-h":!0}),m(G)!=="svelte-13ch4ss"&&(G.innerHTML=He),de=s(e),A=o(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-1xesile"&&(A.textContent=De),he=s(e),u($.$$.fragment,e),ge=s(e),u(B.$$.fragment,e),be=s(e),N=o(e,"P",{}),Ee(N).forEach(i),this.h()},h(){V(r,"name","hf:doc:metadata"),V(r,"content",Qe),je(b.src,Ce="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/dit_architecture.jpg")||V(b,"src",Ce),V(b,"alt","drawing"),V(b,"width","600")},m(e,t){Ve(document.head,r),l(e,v,t),l(e,f,t),l(e,F,t),c(w,e,t),l(e,q,t),c(y,e,t),l(e,S,t),l(e,T,t),l(e,z,t),l(e,M,t),l(e,X,t),l(e,_,t),l(e,Q,t),l(e,C,t),l(e,O,t),l(e,b,t),l(e,K,t),l(e,x,t),l(e,ee,t),l(e,k,t),l(e,te,t),c(L,e,t),l(e,ie,t),l(e,Z,t),l(e,le,t),c(R,e,t),l(e,ae,t),l(e,I,t),l(e,se,t),l(e,P,t),l(e,ne,t),c(W,e,t),l(e,oe,t),l(e,H,t),l(e,re,t),c(D,e,t),l(e,me,t),l(e,U,t),l(e,fe,t),c(E,e,t),l(e,pe,t),l(e,J,t),l(e,ue,t),c(j,e,t),l(e,ce,t),l(e,G,t),l(e,de,t),l(e,A,t),l(e,he,t),c($,e,t),l(e,ge,t),c(B,e,t),l(e,be,t),l(e,N,t),$e=!0},p(e,[t]){const Ue={};t&2&&(Ue.$$scope={dirty:t,ctx:e}),$.$set(Ue)},i(e){$e||(d(w.$$.fragment,e),d(y.$$.fragment,e),d(L.$$.fragment,e),d(R.$$.fragment,e),d(W.$$.fragment,e),d(D.$$.fragment,e),d(E.$$.fragment,e),d(j.$$.fragment,e),d($.$$.fragment,e),d(B.$$.fragment,e),$e=!0)},o(e){h(w.$$.fragment,e),h(y.$$.fragment,e),h(L.$$.fragment,e),h(R.$$.fragment,e),h(W.$$.fragment,e),h(D.$$.fragment,e),h(E.$$.fragment,e),h(j.$$.fragment,e),h($.$$.fragment,e),h(B.$$.fragment,e),$e=!1},d(e){e&&(i(v),i(f),i(F),i(q),i(S),i(T),i(z),i(M),i(X),i(_),i(Q),i(C),i(O),i(b),i(K),i(x),i(ee),i(k),i(te),i(ie),i(Z),i(le),i(ae),i(I),i(se),i(P),i(ne),i(oe),i(H),i(re),i(me),i(U),i(fe),i(pe),i(J),i(ue),i(ce),i(G),i(de),i(A),i(he),i(ge),i(be),i(N)),i(r),g(w,e),g(y,e),g(L,e),g(R,e),g(W,e),g(D,e),g(E,e),g(j,e),g($,e),g(B,e)}}}const Qe='{"title":"DiT","local":"dit","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2}],"depth":1}';function Oe(Y){return Ge(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class st extends Be{constructor(r){super(),Fe(this,r,Oe,Xe,Je,{})}}export{st as component};
