import{S as Al,i as Hl,s as Ll,e as o,k as d,w as b,t as r,M as Ol,c as a,d as s,m as p,a as n,x as v,h as l,b as i,N as Kl,G as e,g as m,y as w,q as y,o as T,B as J,v as ei,L as Ql}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mr}from"../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ns}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as le}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ql}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ti(W){let u,j,f,g,M;return g=new Ns({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERvbnV0U3dpbkNvbmZpZyUyQyUyMERvbnV0U3dpbk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMERvbnV0JTIwbmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMERvbnV0U3dpbkNvbmZpZygpJTBBJTBBJTIzJTIwUmFuZG9tbHklMjBpbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwbmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBEb251dFN3aW5Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DonutSwinConfig, DonutSwinModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Donut naver-clova-ix/donut-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = DonutSwinConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Randomly initializing a model from the naver-clova-ix/donut-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DonutSwinModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){u=o("p"),j=r("Example:"),f=d(),b(g.$$.fragment)},l(h){u=a(h,"P",{});var _=n(u);j=l(_,"Example:"),_.forEach(s),f=p(h),v(g.$$.fragment,h)},m(h,_){m(h,u,_),e(u,j),m(h,f,_),w(g,h,_),M=!0},p:Ql,i(h){M||(y(g.$$.fragment,h),M=!0)},o(h){T(g.$$.fragment,h),M=!1},d(h){h&&s(u),h&&s(f),J(g,h)}}}function si(W){let u,j,f,g,M,h,_,R,$,U,Z;return{c(){u=o("p"),j=r(`This class method is simply calling the feature extractor
`),f=o("a"),g=r("from_pretrained()"),M=r(`, image processor
`),h=o("a"),_=r("ImageProcessingMixin"),R=r(` and the tokenizer
`),$=o("code"),U=r("~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),Z=r(` methods. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(D){u=a(D,"P",{});var x=n(u);j=l(x,`This class method is simply calling the feature extractor
`),f=a(x,"A",{href:!0});var F=n(f);g=l(F,"from_pretrained()"),F.forEach(s),M=l(x,`, image processor
`),h=a(x,"A",{href:!0});var yt=n(h);_=l(yt,"ImageProcessingMixin"),yt.forEach(s),R=l(x,` and the tokenizer
`),$=a(x,"CODE",{});var ie=n($);U=l(ie,"~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),ie.forEach(s),Z=l(x,` methods. Please refer to the docstrings of the
methods above for more information.`),x.forEach(s),this.h()},h(){i(f,"href","/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),i(h,"href","/docs/transformers/v4.31.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin")},m(D,x){m(D,u,x),e(u,j),e(u,f),e(f,g),e(u,M),e(u,h),e(h,_),e(u,R),e(u,$),e($,U),e(u,Z)},d(D){D&&s(u)}}}function oi(W){let u,j,f,g,M,h,_,R;return{c(){u=o("p"),j=r("This class method is simply calling "),f=o("a"),g=r("save_pretrained()"),M=r(` and
`),h=o("a"),_=r("save_pretrained()"),R=r(`. Please refer to the docstrings of the
methods above for more information.`),this.h()},l($){u=a($,"P",{});var U=n(u);j=l(U,"This class method is simply calling "),f=a(U,"A",{href:!0});var Z=n(f);g=l(Z,"save_pretrained()"),Z.forEach(s),M=l(U,` and
`),h=a(U,"A",{href:!0});var D=n(h);_=l(D,"save_pretrained()"),D.forEach(s),R=l(U,`. Please refer to the docstrings of the
methods above for more information.`),U.forEach(s),this.h()},h(){i(f,"href","/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained"),i(h,"href","/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.save_pretrained")},m($,U){m($,u,U),e(u,j),e(u,f),e(f,g),e(u,M),e(u,h),e(h,_),e(u,R)},d($){$&&s(u)}}}function ai(W){let u,j,f,g,M;return{c(){u=o("p"),j=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=o("code"),g=r("Module"),M=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(h){u=a(h,"P",{});var _=n(u);j=l(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(_,"CODE",{});var R=n(f);g=l(R,"Module"),R.forEach(s),M=l(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(s)},m(h,_){m(h,u,_),e(u,j),e(u,f),e(f,g),e(u,M)},d(h){h&&s(u)}}}function ni(W){let u,j,f,g,M;return g=new Ns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yword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, DonutSwinModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;https://huggingface.co/naver-clova-ix/donut-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DonutSwinModel.from_pretrained(<span class="hljs-string">&quot;https://huggingface.co/naver-clova-ix/donut-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">49</span>, <span class="hljs-number">768</span>]`}}),{c(){u=o("p"),j=r("Example:"),f=d(),b(g.$$.fragment)},l(h){u=a(h,"P",{});var _=n(u);j=l(_,"Example:"),_.forEach(s),f=p(h),v(g.$$.fragment,h)},m(h,_){m(h,u,_),e(u,j),m(h,f,_),w(g,h,_),M=!0},p:Ql,i(h){M||(y(g.$$.fragment,h),M=!0)},o(h){T(g.$$.fragment,h),M=!1},d(h){h&&s(u),h&&s(f),J(g,h)}}}function ri(W){let u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lJTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShvdXRwdXRzLnNlcXVlbmNlcyklNUIwJTVEJTBBc2VxdWVuY2UlMjAlM0QlMjBzZXF1ZW5jZS5yZXBsYWNlKHByb2Nlc3Nvci50b2tlbml6ZXIuZW9zX3Rva2VuJTJDJTIwJTIyJTIyKS5yZXBsYWNlKHByb2Nlc3Nvci50b2tlbml6ZXIucGFkX3Rva2VuJTJDJTIwJTIyJTIyKSUwQXNlcXVlbmNlJTIwJTNEJTIwcmUuc3ViKHIlMjIlM0MuKiUzRiUzRSUyMiUyQyUyMCUyMiUyMiUyQyUyMHNlcXVlbmNlJTJDJTIwY291bnQlM0QxKS5zdHJpcCgpJTIwJTIwJTIzJTIwcmVtb3ZlJTIwZmlyc3QlMjB0YXNrJTIwc3RhcnQlMjB0b2tlbiUwQXByaW50KHByb2Nlc3Nvci50b2tlbjJqc29uKHNlcXVlbmNlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> re

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DonutProcessor, VisionEncoderDecoderModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = DonutProcessor.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-rvlcdip&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-rvlcdip&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load document image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/example-documents&quot;</span>, split=<span class="hljs-string">&quot;test&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-number">1</span>][<span class="hljs-string">&quot;image&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare decoder inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>task_prompt = <span class="hljs-string">&quot;&lt;s_rvlcdip&gt;&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = processor.tokenizer(task_prompt, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(
<span class="hljs-meta">... </span>    pixel_values.to(device),
<span class="hljs-meta">... </span>    decoder_input_ids=decoder_input_ids.to(device),
<span class="hljs-meta">... </span>    max_length=model.decoder.config.max_position_embeddings,
<span class="hljs-meta">... </span>    early_stopping=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    pad_token_id=processor.tokenizer.pad_token_id,
<span class="hljs-meta">... </span>    eos_token_id=processor.tokenizer.eos_token_id,
<span class="hljs-meta">... </span>    use_cache=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_beams=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    bad_words_ids=[[processor.tokenizer.unk_token_id]],
<span class="hljs-meta">... </span>    return_dict_in_generate=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = processor.batch_decode(outputs.sequences)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = sequence.replace(processor.tokenizer.eos_token, <span class="hljs-string">&quot;&quot;</span>).replace(processor.tokenizer.pad_token, <span class="hljs-string">&quot;&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = re.sub(<span class="hljs-string">r&quot;&lt;.*?&gt;&quot;</span>, <span class="hljs-string">&quot;&quot;</span>, sequence, count=<span class="hljs-number">1</span>).strip()  <span class="hljs-comment"># remove first task start token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.token2json(sequence))
{<span class="hljs-string">&#x27;class&#x27;</span>: <span class="hljs-string">&#x27;advertisement&#x27;</span>}`}}),Ge=new Ns({props:{code:"aW1wb3J0JTIwcmUlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwRG9udXRQcm9jZXNzb3IlMkMlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBEb251dFByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlLWZpbmV0dW5lZC1jb3JkLXYyJTIyKSUwQW1vZGVsJTIwJTNEJTIwVmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlLWZpbmV0dW5lZC1jb3JkLXYyJTIyKSUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjBpZiUyMHRvcmNoLmN1ZGEuaXNfYXZhaWxhYmxlKCklMjBlbHNlJTIwJTIyY3B1JTIyJTBBbW9kZWwudG8oZGV2aWNlK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aXplci5wYWRfdG9rZW5faWQlMkMlMEElMjAlMjAlMjAlMjBlb3NfdG9rZW5faWQlM0Rwcm9jZXNzb3IudG9rZW5pemVyLmVvc190b2tlbl9pZCUyQyUwQSUyMCUyMCUyMCUyMHVzZV9jYWNoZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBudW1fYmVhbXMlM0QxJTJDJTBBJTIwJTIwJTIwJTIwYmFkX3dvcmRzX2lkcyUzRCU1QiU1QnByb2Nlc3Nvci50b2tlbml6ZXIudW5rX3Rva2VuX2lkJTVEJTVEJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2RpY3RfaW5fZ2VuZXJhdGUlM0RUcnVlJTJDJTBBKSUwQSUwQXNlcXVlbmNlJTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShvdXRwdXRzLnNlcXVlbmNlcyklNUIwJTVEJTBBc2VxdWVuY2UlMjAlM0QlMjBzZXF1ZW5jZS5yZXBsYWNlKHByb2Nlc3Nvci50b2tlbml6ZXIuZW9zX3Rva2VuJTJDJTIwJTIyJTIyKS5yZXBsYWNlKHByb2Nlc3Nvci50b2tlbml6ZXIucGFkX3Rva2VuJTJDJTIwJTIyJTIyKSUwQXNlcXVlbmNlJTIwJTNEJTIwcmUuc3ViKHIlMjIlM0MuKiUzRiUzRSUyMiUyQyUyMCUyMiUyMiUyQyUyMHNlcXVlbmNlJTJDJTIwY291bnQlM0QxKS5zdHJpcCgpJTIwJTIwJTIzJTIwcmVtb3ZlJTIwZmlyc3QlMjB0YXNrJTIwc3RhcnQlMjB0b2tlbiUwQXByaW50KHByb2Nlc3Nvci50b2tlbjJqc29uKHNlcXVlbmNlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> re

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DonutProcessor, VisionEncoderDecoderModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = DonutProcessor.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-cord-v2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-cord-v2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load document image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/example-documents&quot;</span>, split=<span class="hljs-string">&quot;test&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-number">2</span>][<span class="hljs-string">&quot;image&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare decoder inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>task_prompt = <span class="hljs-string">&quot;&lt;s_cord-v2&gt;&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = processor.tokenizer(task_prompt, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(
<span class="hljs-meta">... </span>    pixel_values.to(device),
<span class="hljs-meta">... </span>    decoder_input_ids=decoder_input_ids.to(device),
<span class="hljs-meta">... </span>    max_length=model.decoder.config.max_position_embeddings,
<span class="hljs-meta">... </span>    early_stopping=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    pad_token_id=processor.tokenizer.pad_token_id,
<span class="hljs-meta">... </span>    eos_token_id=processor.tokenizer.eos_token_id,
<span class="hljs-meta">... </span>    use_cache=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_beams=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    bad_words_ids=[[processor.tokenizer.unk_token_id]],
<span class="hljs-meta">... </span>    return_dict_in_generate=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = processor.batch_decode(outputs.sequences)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = sequence.replace(processor.tokenizer.eos_token, <span class="hljs-string">&quot;&quot;</span>).replace(processor.tokenizer.pad_token, <span class="hljs-string">&quot;&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = re.sub(<span class="hljs-string">r&quot;&lt;.*?&gt;&quot;</span>, <span class="hljs-string">&quot;&quot;</span>, sequence, count=<span class="hljs-number">1</span>).strip()  <span class="hljs-comment"># remove first task start token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.token2json(sequence))
{<span class="hljs-string">&#x27;menu&#x27;</span>: {<span class="hljs-string">&#x27;nm&#x27;</span>: <span class="hljs-string">&#x27;CINNAMON SUGAR&#x27;</span>, <span class="hljs-string">&#x27;unitprice&#x27;</span>: <span class="hljs-string">&#x27;17,000&#x27;</span>, <span class="hljs-string">&#x27;cnt&#x27;</span>: <span class="hljs-string">&#x27;1 x&#x27;</span>, <span class="hljs-string">&#x27;price&#x27;</span>: <span class="hljs-string">&#x27;17,000&#x27;</span>}, <span class="hljs-string">&#x27;sub_total&#x27;</span>: {<span class="hljs-string">&#x27;subtotal_price&#x27;</span>: <span class="hljs-string">&#x27;17,000&#x27;</span>}, <span class="hljs-string">&#x27;total&#x27;</span>: {<span class="hljs-string">&#x27;total_price&#x27;</span>: <span class="hljs-string">&#x27;17,000&#x27;</span>, <span class="hljs-string">&#x27;cashprice&#x27;</span>: <span class="hljs-string">&#x27;20,000&#x27;</span>, <span class="hljs-string">&#x27;changeprice&#x27;</span>: <span class="hljs-string">&#x27;3,000&#x27;</span>}}`}}),Pe=new Ns({props:{code:"aW1wb3J0JTIwcmUlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwRG9udXRQcm9jZXNzb3IlMkMlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBEb251dFByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlLWZpbmV0dW5lZC1kb2N2cWElMjIpJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJuYXZlci1jbG92YS1peCUyRmRvbnV0LWJhc2UtZmluZXR1bmVkLWRvY3ZxYSUyMiklMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQW1vZGVsLnRvKGRldmljZSklMEElMjMlMjBsb2FkJTIwZG9jdW1lbnQlMjBpbWFnZSUyMGZyb20lMjB0aGUlMjBEb2NWUUElMjBkYXRhc2V0JTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZXhhbXBsZS1kb2N1bWVudHMl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ljs-keyword">import</span> re

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DonutProcessor, VisionEncoderDecoderModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = DonutProcessor.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-docvqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;naver-clova-ix/donut-base-finetuned-docvqa&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load document image from the DocVQA dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/example-documents&quot;</span>, split=<span class="hljs-string">&quot;test&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;image&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare decoder inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>task_prompt = <span class="hljs-string">&quot;&lt;s_docvqa&gt;&lt;s_question&gt;{user_input}&lt;/s_question&gt;&lt;s_answer&gt;&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;When is the coffee break?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = task_prompt.replace(<span class="hljs-string">&quot;{user_input}&quot;</span>, question)
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = processor.tokenizer(prompt, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(
<span class="hljs-meta">... </span>    pixel_values.to(device),
<span class="hljs-meta">... </span>    decoder_input_ids=decoder_input_ids.to(device),
<span class="hljs-meta">... </span>    max_length=model.decoder.config.max_position_embeddings,
<span class="hljs-meta">... </span>    early_stopping=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    pad_token_id=processor.tokenizer.pad_token_id,
<span class="hljs-meta">... </span>    eos_token_id=processor.tokenizer.eos_token_id,
<span class="hljs-meta">... </span>    use_cache=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_beams=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    bad_words_ids=[[processor.tokenizer.unk_token_id]],
<span class="hljs-meta">... </span>    return_dict_in_generate=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = processor.batch_decode(outputs.sequences)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = sequence.replace(processor.tokenizer.eos_token, <span class="hljs-string">&quot;&quot;</span>).replace(processor.tokenizer.pad_token, <span class="hljs-string">&quot;&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence = re.sub(<span class="hljs-string">r&quot;&lt;.*?&gt;&quot;</span>, <span class="hljs-string">&quot;&quot;</span>, sequence, count=<span class="hljs-number">1</span>).strip()  <span class="hljs-comment"># remove first task start token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(processor.token2json(sequence))
{<span class="hljs-string">&#x27;question&#x27;</span>: <span class="hljs-string">&#x27;When is the coffee break?&#x27;</span>, <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;11-14 to 11:39 a.m.&#x27;</span>}`}}),Ye=new le({}),Qe=new le({}),Ae=new B({props:{name:"class transformers.DonutSwinConfig",anchor:"transformers.DonutSwinConfig",parameters:[{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"embed_dim",val:" = 96"},{name:"depths",val:" = [2, 2, 6, 2]"},{name:"num_heads",val:" = [3, 6, 12, 24]"},{name:"window_size",val:" = 7"},{name:"mlp_ratio",val:" = 4.0"},{name:"qkv_bias",val:" = True"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.1"},{name:"hidden_act",val:" = 'gelu'"},{name:"use_absolute_embeddings",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutSwinConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.DonutSwinConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.DonutSwinConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.DonutSwinConfig.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 96) &#x2014;
Dimensionality of patch embedding.`,name:"embed_dim"},{anchor:"transformers.DonutSwinConfig.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to [2, 2, 6, 2]) &#x2014;
Depth of each layer in the Transformer encoder.`,name:"depths"},{anchor:"transformers.DonutSwinConfig.num_heads",description:`<strong>num_heads</strong> (<code>list(int)</code>, <em>optional</em>, defaults to [3, 6, 12, 24]) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.DonutSwinConfig.window_size",description:`<strong>window_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Size of windows.`,name:"window_size"},{anchor:"transformers.DonutSwinConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Ratio of MLP hidden dimensionality to embedding dimensionality.`,name:"mlp_ratio"},{anchor:"transformers.DonutSwinConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to True) &#x2014;
Whether or not a learnable bias should be added to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.DonutSwinConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings and encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.DonutSwinConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.DonutSwinConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Stochastic depth rate.`,name:"drop_path_rate"},{anchor:"transformers.DonutSwinConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder. If string, <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>,
<code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.DonutSwinConfig.use_absolute_embeddings",description:`<strong>use_absolute_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to False) &#x2014;
Whether or not to add absolute position embeddings to the patch embeddings.`,name:"use_absolute_embeddings"},{anchor:"transformers.DonutSwinConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.DonutSwinConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/configuration_donut_swin.py#L29"}}),be=new ql({props:{anchor:"transformers.DonutSwinConfig.example",$$slots:{default:[ti]},$$scope:{ctx:W}}}),Le=new le({}),Oe=new B({props:{name:"class transformers.DonutImageProcessor",anchor:"transformers.DonutImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_thumbnail",val:": bool = True"},{name:"do_align_long_axis",val:": bool = False"},{name:"do_pad",val:": bool = True"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.DonutImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.DonutImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.DonutImageProcessor.do_thumbnail",description:`<strong>do_thumbnail</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image using thumbnail method.`,name:"do_thumbnail"},{anchor:"transformers.DonutImageProcessor.do_align_long_axis",description:`<strong>do_align_long_axis</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to align the long axis of the image with the long axis of <code>size</code> by rotating by 90 degrees.`,name:"do_align_long_axis"},{anchor:"transformers.DonutImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image. If <code>random_padding</code> is set to <code>True</code> in <code>preprocess</code>, each image is padded with a
random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images are
padded to the largest image size in the batch.`,name:"do_pad"},{anchor:"transformers.DonutImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.DonutImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.DonutImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.DonutImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Image standard deviation.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/image_processing_donut.py#L52"}}),Ke=new B({props:{name:"preprocess",anchor:"transformers.DonutImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = None"},{name:"do_thumbnail",val:": bool = None"},{name:"do_align_long_axis",val:": bool = None"},{name:"do_pad",val:": bool = None"},{name:"random_padding",val:": bool = False"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.DonutImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.DonutImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to min(size[&#x201C;height&#x201D;],
size[&#x201C;width&#x201D;]) with the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.DonutImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.DonutImageProcessor.preprocess.do_thumbnail",description:`<strong>do_thumbnail</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_thumbnail</code>) &#x2014;
Whether to resize the image using thumbnail method.`,name:"do_thumbnail"},{anchor:"transformers.DonutImageProcessor.preprocess.do_align_long_axis",description:`<strong>do_align_long_axis</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_align_long_axis</code>) &#x2014;
Whether to align the long axis of the image with the long axis of <code>size</code> by rotating by 90 degrees.`,name:"do_align_long_axis"},{anchor:"transformers.DonutImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_pad</code>) &#x2014;
Whether to pad the image. If <code>random_padding</code> is set to <code>True</code>, each image is padded with a random
amont of padding on each size, up to the largest image size in the batch. Otherwise, all images are
padded to the largest image size in the batch.`,name:"do_pad"},{anchor:"transformers.DonutImageProcessor.preprocess.random_padding",description:`<strong>random_padding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.random_padding</code>) &#x2014;
Whether to use random padding when padding the image. If <code>True</code>, each image in the batch with be padded
with a random amount of padding on each side up to the size of the largest image in the batch.`,name:"random_padding"},{anchor:"transformers.DonutImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image pixel values.`,name:"do_rescale"},{anchor:"transformers.DonutImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.DonutImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.DonutImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization.`,name:"image_mean"},{anchor:"transformers.DonutImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization.`,name:"image_std"},{anchor:"transformers.DonutImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.DonutImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/image_processing_donut.py#L309"}}),et=new le({}),tt=new B({props:{name:"class transformers.DonutFeatureExtractor",anchor:"transformers.DonutFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/feature_extraction_donut.py#L26"}}),st=new B({props:{name:"__call__",anchor:"transformers.DonutFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/image_processing_utils.py#L492"}}),ot=new le({}),at=new B({props:{name:"class transformers.DonutProcessor",anchor:"transformers.DonutProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutImageProcessor">DonutImageProcessor</a>) &#x2014;
An instance of <a href="/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutImageProcessor">DonutImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.DonutProcessor.tokenizer",description:`<strong>tokenizer</strong> ([<code>XLMRobertaTokenizer</code>/<code>XLMRobertaTokenizerFast</code>]) &#x2014;
An instance of [<code>XLMRobertaTokenizer</code>/<code>XLMRobertaTokenizerFast</code>]. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/processing_donut.py#L25"}}),rt=new B({props:{name:"__call__",anchor:"transformers.DonutProcessor.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/processing_donut.py#L64"}}),lt=new B({props:{name:"from_pretrained",anchor:"transformers.DonutProcessor.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"cache_dir",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": typing.Union[bool, str, NoneType] = None"},{name:"revision",val:": str = 'main'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutProcessor.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
This can be either:</p>
<ul>
<li>a string, the <em>model id</em> of a pretrained feature_extractor hosted inside a model repo on
huggingface.co. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or
namespaced under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>a path to a <em>directory</em> containing a feature extractor file saved using the
<a href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained">save_pretrained()</a> method, e.g., <code>./my_model_directory/</code>.</li>
<li>a path or url to a saved feature extractor JSON <em>file</em>, e.g.,
<code>./my_model_directory/preprocessor_config.json</code>.
**kwargs &#x2014;
Additional keyword arguments passed along to both
<a href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained">from_pretrained()</a> and
<code>~tokenization_utils_base.PreTrainedTokenizer.from_pretrained</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/processing_utils.py#L155"}}),je=new Mr({props:{$$slots:{default:[si]},$$scope:{ctx:W}}}),it=new B({props:{name:"save_pretrained",anchor:"transformers.DonutProcessor.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutProcessor.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory where the feature extractor JSON file and the tokenizer files will be saved (directory will
be created if it does not exist).`,name:"save_directory"},{anchor:"transformers.DonutProcessor.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).`,name:"push_to_hub"},{anchor:"transformers.DonutProcessor.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.31.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/processing_utils.py#L93"}}),Ie=new Mr({props:{$$slots:{default:[oi]},$$scope:{ctx:W}}}),dt=new B({props:{name:"batch_decode",anchor:"transformers.DonutProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/processing_donut.py#L97"}}),mt=new B({props:{name:"decode",anchor:"transformers.DonutProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/processing_donut.py#L104"}}),ut=new le({}),ft=new B({props:{name:"class transformers.DonutSwinModel",anchor:"transformers.DonutSwinModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"},{name:"use_mask_token",val:" = False"}],parametersDescription:[{anchor:"transformers.DonutSwinModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutSwinConfig">DonutSwinConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/modeling_donut_swin.py#L871"}}),bt=new B({props:{name:"forward",anchor:"transformers.DonutSwinModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DonutSwinModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.31.0/en/model_doc/perceiver#transformers.PerceiverFeatureExtractor.__call__">DonutImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.DonutSwinModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.DonutSwinModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DonutSwinModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.DonutSwinModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DonutSwinModel.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/donut/modeling_donut_swin.py#L897",returnDescription:`
<p>A <code>transformers.models.donut.modeling_donut_swin.DonutSwinModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutSwinConfig"
>DonutSwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>, <em>optional</em>, returned when <code>add_pooling_layer=True</code> is passed) \u2014 Average pooling of the last layer hidden-state.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.donut.modeling_donut_swin.DonutSwinModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Re=new Mr({props:{$$slots:{default:[ai]},$$scope:{ctx:W}}}),Ze=new ql({props:{anchor:"transformers.DonutSwinModel.forward.example",$$slots:{default:[ni]},$$scope:{ctx:W}}}),{c(){u=o("meta"),j=d(),f=o("h1"),g=o("a"),M=o("span"),b(h.$$.fragment),_=d(),R=o("span"),$=r("Donut"),U=d(),Z=o("h2"),D=o("a"),x=o("span"),b(F.$$.fragment),yt=d(),ie=o("span"),Wo=r("Overview"),Vs=d(),ce=o("p"),Co=r("The Donut model was proposed in "),Xe=o("a"),So=r("OCR-free Document Understanding Transformer"),Go=r(` by
Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park.
Donut consists of an image Transformer encoder and an autoregressive text Transformer decoder to perform document understanding
tasks such as document image classification, form understanding and visual question answering.`),Bs=d(),Tt=o("p"),Po=r("The abstract from the paper is the following:"),Ws=d(),Jt=o("p"),Kt=o("em"),Fo=r("Understanding document images (e.g., invoices) is a core but challenging task since it requires complex functions such as reading text and a holistic understanding of the document. Current Visual Document Understanding (VDU) methods outsource the task of reading text to off-the-shelf Optical Character Recognition (OCR) engines and focus on the understanding task with the OCR outputs. Although such OCR-based approaches have shown promising performance, they suffer from 1) high computational costs for using OCR; 2) inflexibility of OCR models on languages or types of document; 3) OCR error propagation to the subsequent process. To address these issues, in this paper, we introduce a novel OCR-free VDU model named Donut, which stands for Document understanding transformer. As the first step in OCR-free VDU research, we propose a simple architecture (i.e., Transformer) with a pre-training objective (i.e., cross-entropy loss). Donut is conceptually simple yet effective. Through extensive experiments and analyses, we show a simple OCR-free VDU model, Donut, achieves state-of-the-art performances on various VDU tasks in terms of both speed and accuracy. In addition, we offer a synthetic data generator that helps the model pre-training to be flexible in various languages and domains."),Cs=d(),de=o("img"),Ss=d(),pe=o("small"),Yo=r("Donut high-level overview. Taken from the "),Mt=o("a"),qo=r("original paper"),Qo=r("."),Gs=d(),Y=o("p"),Ao=r("This model was contributed by "),$e=o("a"),Ho=r("nielsr"),Lo=r(`. The original code can be found
`),Ne=o("a"),Oo=r("here"),Ko=r("."),Ps=d(),jt=o("p"),ea=r("Tips:"),Fs=d(),me=o("ul"),Ve=o("li"),ta=r("The quickest way to get started with Donut is by checking the "),Be=o("a"),sa=r(`tutorial
notebooks`),oa=r(`, which show how to use the model
at inference time as well as fine-tuning on custom data.`),aa=d(),We=o("li"),na=r("Donut is always used within the "),It=o("a"),ra=r("VisionEncoderDecoder"),la=r(" framework."),Ys=d(),H=o("h2"),he=o("a"),es=o("span"),b(Ce.$$.fragment),ia=d(),ts=o("span"),ca=r("Inference"),qs=d(),q=o("p"),da=r("Donut\u2019s "),ss=o("code"),pa=r("VisionEncoderDecoder"),ma=r(` model accepts images as input and makes use of
`),kt=o("a"),ha=r("generate()"),ua=r(" to autoregressively generate text given the input image."),Qs=d(),k=o("p"),fa=r("The "),Ut=o("a"),ga=r("DonutImageProcessor"),_a=r(` class is responsible for preprocessing the input image and
[`),os=o("code"),ba=r("XLMRobertaTokenizer"),va=r("/"),as=o("code"),wa=r("XLMRobertaTokenizerFast"),ya=r(`] decodes the generated target tokens to the target string. The
`),Dt=o("a"),Ta=r("DonutProcessor"),Ja=r(" wraps "),Rt=o("a"),Ma=r("DonutImageProcessor"),ja=r(" and ["),ns=o("code"),Ia=r("XLMRobertaTokenizer"),ka=r("/"),rs=o("code"),Ua=r("XLMRobertaTokenizerFast"),Da=r(`]
into a single instance to both extract the input features and decode the predicted token ids.`),As=d(),Zt=o("ul"),ls=o("li"),Ra=r("Step-by-step Document Image Classification"),Hs=d(),b(Se.$$.fragment),Ls=d(),xt=o("ul"),is=o("li"),Za=r("Step-by-step Document Parsing"),Os=d(),b(Ge.$$.fragment),Ks=d(),zt=o("ul"),cs=o("li"),xa=r("Step-by-step Document Visual Question Answering (DocVQA)"),eo=d(),b(Pe.$$.fragment),to=d(),ue=o("p"),za=r("See the "),Fe=o("a"),Ea=r("model hub"),Xa=r(" to look for Donut checkpoints."),so=d(),L=o("h2"),fe=o("a"),ds=o("span"),b(Ye.$$.fragment),$a=d(),ps=o("span"),Na=r("Training"),oo=d(),ge=o("p"),Va=r("We refer to the "),qe=o("a"),Ba=r("tutorial notebooks"),Wa=r("."),ao=d(),O=o("h2"),_e=o("a"),ms=o("span"),b(Qe.$$.fragment),Ca=d(),hs=o("span"),Sa=r("DonutSwinConfig"),no=d(),N=o("div"),b(Ae.$$.fragment),Ga=d(),K=o("p"),Pa=r("This is the configuration class to store the configuration of a "),Et=o("a"),Fa=r("DonutSwinModel"),Ya=r(`. It is used to instantiate a
Donut model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the Donut
`),He=o("a"),qa=r("naver-clova-ix/donut-base"),Qa=r(" architecture."),Aa=d(),ee=o("p"),Ha=r("Configuration objects inherit from "),Xt=o("a"),La=r("PretrainedConfig"),Oa=r(` and can be used to control the model outputs. Read the
documentation from `),$t=o("a"),Ka=r("PretrainedConfig"),en=r(" for more information."),tn=d(),b(be.$$.fragment),ro=d(),te=o("h2"),ve=o("a"),us=o("span"),b(Le.$$.fragment),sn=d(),fs=o("span"),on=r("DonutImageProcessor"),lo=d(),S=o("div"),b(Oe.$$.fragment),an=d(),gs=o("p"),nn=r("Constructs a Donut image processor."),rn=d(),we=o("div"),b(Ke.$$.fragment),ln=d(),_s=o("p"),cn=r("Preprocess an image or batch of images."),io=d(),se=o("h2"),ye=o("a"),bs=o("span"),b(et.$$.fragment),dn=d(),vs=o("span"),pn=r("DonutFeatureExtractor"),co=d(),oe=o("div"),b(tt.$$.fragment),mn=d(),Te=o("div"),b(st.$$.fragment),hn=d(),ws=o("p"),un=r("Preprocess an image or a batch of images."),po=d(),ae=o("h2"),Je=o("a"),ys=o("span"),b(ot.$$.fragment),fn=d(),Ts=o("span"),gn=r("DonutProcessor"),mo=d(),I=o("div"),b(at.$$.fragment),_n=d(),Js=o("p"),bn=r(`Constructs a Donut processor which wraps a Donut image processor and an XLMRoBERTa tokenizer into a single
processor.`),vn=d(),z=o("p"),Nt=o("a"),wn=r("DonutProcessor"),yn=r(" offers all the functionalities of "),Vt=o("a"),Tn=r("DonutImageProcessor"),Jn=r(` and
[`),Ms=o("code"),Mn=r("XLMRobertaTokenizer"),jn=r("/"),js=o("code"),In=r("XLMRobertaTokenizerFast"),kn=r("]. See the "),nt=o("a"),Is=o("strong"),Un=r("call"),Dn=r("()"),Rn=r(` and
`),Bt=o("a"),Zn=r("decode()"),xn=r(" for more information."),zn=d(),Me=o("div"),b(rt.$$.fragment),En=d(),G=o("p"),Xn=r(`When used in normal mode, this method forwards all its arguments to AutoImageProcessor\u2019s
`),ks=o("code"),$n=r("__call__()"),Nn=r(` and returns its output. If used in the context
`),Us=o("code"),Vn=r("as_target_processor()"),Bn=r(` this method forwards all its arguments to DonutTokenizer\u2019s
`),Ds=o("code"),Wn=r("~DonutTokenizer.__call__"),Cn=r(". Please refer to the doctsring of the above two methods for more information."),Sn=d(),Q=o("div"),b(lt.$$.fragment),Gn=d(),Rs=o("p"),Pn=r("Instantiate a processor associated with a pretrained model."),Fn=d(),b(je.$$.fragment),Yn=d(),A=o("div"),b(it.$$.fragment),qn=d(),ct=o("p"),Qn=r(`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Wt=o("a"),An=r("from_pretrained()"),Hn=r(" method."),Ln=d(),b(Ie.$$.fragment),On=d(),ke=o("div"),b(dt.$$.fragment),Kn=d(),pt=o("p"),er=r("This method forwards all its arguments to DonutTokenizer\u2019s "),Ct=o("a"),tr=r("batch_decode()"),sr=r(`. Please refer
to the docstring of this method for more information.`),or=d(),Ue=o("div"),b(mt.$$.fragment),ar=d(),ht=o("p"),nr=r("This method forwards all its arguments to DonutTokenizer\u2019s "),St=o("a"),rr=r("decode()"),lr=r(`. Please refer to the
docstring of this method for more information.`),ho=d(),ne=o("h2"),De=o("a"),Zs=o("span"),b(ut.$$.fragment),ir=d(),xs=o("span"),cr=r("DonutSwinModel"),uo=d(),P=o("div"),b(ft.$$.fragment),dr=d(),gt=o("p"),pr=r(`The bare Donut Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),_t=o("a"),mr=r("torch.nn.Module"),hr=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ur=d(),C=o("div"),b(bt.$$.fragment),fr=d(),re=o("p"),gr=r("The "),Gt=o("a"),_r=r("DonutSwinModel"),br=r(" forward method, overrides the "),zs=o("code"),vr=r("__call__"),wr=r(" special method."),yr=d(),b(Re.$$.fragment),Tr=d(),b(Ze.$$.fragment),this.h()},l(t){const c=Ol('[data-svelte="svelte-1phssyn"]',document.head);u=a(c,"META",{name:!0,content:!0}),c.forEach(s),j=p(t),f=a(t,"H1",{class:!0});var vt=n(f);g=a(vt,"A",{id:!0,class:!0,href:!0});var Es=n(g);M=a(Es,"SPAN",{});var Xs=n(M);v(h.$$.fragment,Xs),Xs.forEach(s),Es.forEach(s),_=p(vt),R=a(vt,"SPAN",{});var $s=n(R);$=l($s,"Donut"),$s.forEach(s),vt.forEach(s),U=p(t),Z=a(t,"H2",{class:!0});var wt=n(Z);D=a(wt,"A",{id:!0,class:!0,href:!0});var Ir=n(D);x=a(Ir,"SPAN",{});var kr=n(x);v(F.$$.fragment,kr),kr.forEach(s),Ir.forEach(s),yt=p(wt),ie=a(wt,"SPAN",{});var Ur=n(ie);Wo=l(Ur,"Overview"),Ur.forEach(s),wt.forEach(s),Vs=p(t),ce=a(t,"P",{});var go=n(ce);Co=l(go,"The Donut model was proposed in "),Xe=a(go,"A",{href:!0,rel:!0});var Dr=n(Xe);So=l(Dr,"OCR-free Document Understanding Transformer"),Dr.forEach(s),Go=l(go,` by
Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park.
Donut consists of an image Transformer encoder and an autoregressive text Transformer decoder to perform document understanding
tasks such as document image classification, form understanding and visual question answering.`),go.forEach(s),Bs=p(t),Tt=a(t,"P",{});var Rr=n(Tt);Po=l(Rr,"The abstract from the paper is the following:"),Rr.forEach(s),Ws=p(t),Jt=a(t,"P",{});var Zr=n(Jt);Kt=a(Zr,"EM",{});var xr=n(Kt);Fo=l(xr,"Understanding document images (e.g., invoices) is a core but challenging task since it requires complex functions such as reading text and a holistic understanding of the document. Current Visual Document Understanding (VDU) methods outsource the task of reading text to off-the-shelf Optical Character Recognition (OCR) engines and focus on the understanding task with the OCR outputs. Although such OCR-based approaches have shown promising performance, they suffer from 1) high computational costs for using OCR; 2) inflexibility of OCR models on languages or types of document; 3) OCR error propagation to the subsequent process. To address these issues, in this paper, we introduce a novel OCR-free VDU model named Donut, which stands for Document understanding transformer. As the first step in OCR-free VDU research, we propose a simple architecture (i.e., Transformer) with a pre-training objective (i.e., cross-entropy loss). Donut is conceptually simple yet effective. Through extensive experiments and analyses, we show a simple OCR-free VDU model, Donut, achieves state-of-the-art performances on various VDU tasks in terms of both speed and accuracy. In addition, we offer a synthetic data generator that helps the model pre-training to be flexible in various languages and domains."),xr.forEach(s),Zr.forEach(s),Cs=p(t),de=a(t,"IMG",{src:!0,alt:!0,width:!0}),Ss=p(t),pe=a(t,"SMALL",{});var _o=n(pe);Yo=l(_o,"Donut high-level overview. Taken from the "),Mt=a(_o,"A",{href:!0});var zr=n(Mt);qo=l(zr,"original paper"),zr.forEach(s),Qo=l(_o,"."),_o.forEach(s),Gs=p(t),Y=a(t,"P",{});var Pt=n(Y);Ao=l(Pt,"This model was contributed by "),$e=a(Pt,"A",{href:!0,rel:!0});var Er=n($e);Ho=l(Er,"nielsr"),Er.forEach(s),Lo=l(Pt,`. The original code can be found
`),Ne=a(Pt,"A",{href:!0,rel:!0});var Xr=n(Ne);Oo=l(Xr,"here"),Xr.forEach(s),Ko=l(Pt,"."),Pt.forEach(s),Ps=p(t),jt=a(t,"P",{});var $r=n(jt);ea=l($r,"Tips:"),$r.forEach(s),Fs=p(t),me=a(t,"UL",{});var bo=n(me);Ve=a(bo,"LI",{});var vo=n(Ve);ta=l(vo,"The quickest way to get started with Donut is by checking the "),Be=a(vo,"A",{href:!0,rel:!0});var Nr=n(Be);sa=l(Nr,`tutorial
notebooks`),Nr.forEach(s),oa=l(vo,`, which show how to use the model
at inference time as well as fine-tuning on custom data.`),vo.forEach(s),aa=p(bo),We=a(bo,"LI",{});var wo=n(We);na=l(wo,"Donut is always used within the "),It=a(wo,"A",{href:!0});var Vr=n(It);ra=l(Vr,"VisionEncoderDecoder"),Vr.forEach(s),la=l(wo," framework."),wo.forEach(s),bo.forEach(s),Ys=p(t),H=a(t,"H2",{class:!0});var yo=n(H);he=a(yo,"A",{id:!0,class:!0,href:!0});var Br=n(he);es=a(Br,"SPAN",{});var Wr=n(es);v(Ce.$$.fragment,Wr),Wr.forEach(s),Br.forEach(s),ia=p(yo),ts=a(yo,"SPAN",{});var Cr=n(ts);ca=l(Cr,"Inference"),Cr.forEach(s),yo.forEach(s),qs=p(t),q=a(t,"P",{});var Ft=n(q);da=l(Ft,"Donut\u2019s "),ss=a(Ft,"CODE",{});var Sr=n(ss);pa=l(Sr,"VisionEncoderDecoder"),Sr.forEach(s),ma=l(Ft,` model accepts images as input and makes use of
`),kt=a(Ft,"A",{href:!0});var Gr=n(kt);ha=l(Gr,"generate()"),Gr.forEach(s),ua=l(Ft," to autoregressively generate text given the input image."),Ft.forEach(s),Qs=p(t),k=a(t,"P",{});var E=n(k);fa=l(E,"The "),Ut=a(E,"A",{href:!0});var Pr=n(Ut);ga=l(Pr,"DonutImageProcessor"),Pr.forEach(s),_a=l(E,` class is responsible for preprocessing the input image and
[`),os=a(E,"CODE",{});var Fr=n(os);ba=l(Fr,"XLMRobertaTokenizer"),Fr.forEach(s),va=l(E,"/"),as=a(E,"CODE",{});var Yr=n(as);wa=l(Yr,"XLMRobertaTokenizerFast"),Yr.forEach(s),ya=l(E,`] decodes the generated target tokens to the target string. The
`),Dt=a(E,"A",{href:!0});var qr=n(Dt);Ta=l(qr,"DonutProcessor"),qr.forEach(s),Ja=l(E," wraps "),Rt=a(E,"A",{href:!0});var Qr=n(Rt);Ma=l(Qr,"DonutImageProcessor"),Qr.forEach(s),ja=l(E," and ["),ns=a(E,"CODE",{});var Ar=n(ns);Ia=l(Ar,"XLMRobertaTokenizer"),Ar.forEach(s),ka=l(E,"/"),rs=a(E,"CODE",{});var Hr=n(rs);Ua=l(Hr,"XLMRobertaTokenizerFast"),Hr.forEach(s),Da=l(E,`]
into a single instance to both extract the input features and decode the predicted token ids.`),E.forEach(s),As=p(t),Zt=a(t,"UL",{});var Lr=n(Zt);ls=a(Lr,"LI",{});var Or=n(ls);Ra=l(Or,"Step-by-step Document Image Classification"),Or.forEach(s),Lr.forEach(s),Hs=p(t),v(Se.$$.fragment,t),Ls=p(t),xt=a(t,"UL",{});var Kr=n(xt);is=a(Kr,"LI",{});var el=n(is);Za=l(el,"Step-by-step Document Parsing"),el.forEach(s),Kr.forEach(s),Os=p(t),v(Ge.$$.fragment,t),Ks=p(t),zt=a(t,"UL",{});var tl=n(zt);cs=a(tl,"LI",{});var sl=n(cs);xa=l(sl,"Step-by-step Document Visual Question Answering (DocVQA)"),sl.forEach(s),tl.forEach(s),eo=p(t),v(Pe.$$.fragment,t),to=p(t),ue=a(t,"P",{});var To=n(ue);za=l(To,"See the "),Fe=a(To,"A",{href:!0,rel:!0});var ol=n(Fe);Ea=l(ol,"model hub"),ol.forEach(s),Xa=l(To," to look for Donut checkpoints."),To.forEach(s),so=p(t),L=a(t,"H2",{class:!0});var Jo=n(L);fe=a(Jo,"A",{id:!0,class:!0,href:!0});var al=n(fe);ds=a(al,"SPAN",{});var nl=n(ds);v(Ye.$$.fragment,nl),nl.forEach(s),al.forEach(s),$a=p(Jo),ps=a(Jo,"SPAN",{});var rl=n(ps);Na=l(rl,"Training"),rl.forEach(s),Jo.forEach(s),oo=p(t),ge=a(t,"P",{});var Mo=n(ge);Va=l(Mo,"We refer to the "),qe=a(Mo,"A",{href:!0,rel:!0});var ll=n(qe);Ba=l(ll,"tutorial notebooks"),ll.forEach(s),Wa=l(Mo,"."),Mo.forEach(s),ao=p(t),O=a(t,"H2",{class:!0});var jo=n(O);_e=a(jo,"A",{id:!0,class:!0,href:!0});var il=n(_e);ms=a(il,"SPAN",{});var cl=n(ms);v(Qe.$$.fragment,cl),cl.forEach(s),il.forEach(s),Ca=p(jo),hs=a(jo,"SPAN",{});var dl=n(hs);Sa=l(dl,"DonutSwinConfig"),dl.forEach(s),jo.forEach(s),no=p(t),N=a(t,"DIV",{class:!0});var xe=n(N);v(Ae.$$.fragment,xe),Ga=p(xe),K=a(xe,"P",{});var Yt=n(K);Pa=l(Yt,"This is the configuration class to store the configuration of a "),Et=a(Yt,"A",{href:!0});var pl=n(Et);Fa=l(pl,"DonutSwinModel"),pl.forEach(s),Ya=l(Yt,`. It is used to instantiate a
Donut model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the Donut
`),He=a(Yt,"A",{href:!0,rel:!0});var ml=n(He);qa=l(ml,"naver-clova-ix/donut-base"),ml.forEach(s),Qa=l(Yt," architecture."),Yt.forEach(s),Aa=p(xe),ee=a(xe,"P",{});var qt=n(ee);Ha=l(qt,"Configuration objects inherit from "),Xt=a(qt,"A",{href:!0});var hl=n(Xt);La=l(hl,"PretrainedConfig"),hl.forEach(s),Oa=l(qt,` and can be used to control the model outputs. Read the
documentation from `),$t=a(qt,"A",{href:!0});var ul=n($t);Ka=l(ul,"PretrainedConfig"),ul.forEach(s),en=l(qt," for more information."),qt.forEach(s),tn=p(xe),v(be.$$.fragment,xe),xe.forEach(s),ro=p(t),te=a(t,"H2",{class:!0});var Io=n(te);ve=a(Io,"A",{id:!0,class:!0,href:!0});var fl=n(ve);us=a(fl,"SPAN",{});var gl=n(us);v(Le.$$.fragment,gl),gl.forEach(s),fl.forEach(s),sn=p(Io),fs=a(Io,"SPAN",{});var _l=n(fs);on=l(_l,"DonutImageProcessor"),_l.forEach(s),Io.forEach(s),lo=p(t),S=a(t,"DIV",{class:!0});var Qt=n(S);v(Oe.$$.fragment,Qt),an=p(Qt),gs=a(Qt,"P",{});var bl=n(gs);nn=l(bl,"Constructs a Donut image processor."),bl.forEach(s),rn=p(Qt),we=a(Qt,"DIV",{class:!0});var ko=n(we);v(Ke.$$.fragment,ko),ln=p(ko),_s=a(ko,"P",{});var vl=n(_s);cn=l(vl,"Preprocess an image or batch of images."),vl.forEach(s),ko.forEach(s),Qt.forEach(s),io=p(t),se=a(t,"H2",{class:!0});var Uo=n(se);ye=a(Uo,"A",{id:!0,class:!0,href:!0});var wl=n(ye);bs=a(wl,"SPAN",{});var yl=n(bs);v(et.$$.fragment,yl),yl.forEach(s),wl.forEach(s),dn=p(Uo),vs=a(Uo,"SPAN",{});var Tl=n(vs);pn=l(Tl,"DonutFeatureExtractor"),Tl.forEach(s),Uo.forEach(s),co=p(t),oe=a(t,"DIV",{class:!0});var Do=n(oe);v(tt.$$.fragment,Do),mn=p(Do),Te=a(Do,"DIV",{class:!0});var Ro=n(Te);v(st.$$.fragment,Ro),hn=p(Ro),ws=a(Ro,"P",{});var Jl=n(ws);un=l(Jl,"Preprocess an image or a batch of images."),Jl.forEach(s),Ro.forEach(s),Do.forEach(s),po=p(t),ae=a(t,"H2",{class:!0});var Zo=n(ae);Je=a(Zo,"A",{id:!0,class:!0,href:!0});var Ml=n(Je);ys=a(Ml,"SPAN",{});var jl=n(ys);v(ot.$$.fragment,jl),jl.forEach(s),Ml.forEach(s),fn=p(Zo),Ts=a(Zo,"SPAN",{});var Il=n(Ts);gn=l(Il,"DonutProcessor"),Il.forEach(s),Zo.forEach(s),mo=p(t),I=a(t,"DIV",{class:!0});var X=n(I);v(at.$$.fragment,X),_n=p(X),Js=a(X,"P",{});var kl=n(Js);bn=l(kl,`Constructs a Donut processor which wraps a Donut image processor and an XLMRoBERTa tokenizer into a single
processor.`),kl.forEach(s),vn=p(X),z=a(X,"P",{});var V=n(z);Nt=a(V,"A",{href:!0});var Ul=n(Nt);wn=l(Ul,"DonutProcessor"),Ul.forEach(s),yn=l(V," offers all the functionalities of "),Vt=a(V,"A",{href:!0});var Dl=n(Vt);Tn=l(Dl,"DonutImageProcessor"),Dl.forEach(s),Jn=l(V,` and
[`),Ms=a(V,"CODE",{});var Rl=n(Ms);Mn=l(Rl,"XLMRobertaTokenizer"),Rl.forEach(s),jn=l(V,"/"),js=a(V,"CODE",{});var Zl=n(js);In=l(Zl,"XLMRobertaTokenizerFast"),Zl.forEach(s),kn=l(V,"]. See the "),nt=a(V,"A",{href:!0});var Jr=n(nt);Is=a(Jr,"STRONG",{});var xl=n(Is);Un=l(xl,"call"),xl.forEach(s),Dn=l(Jr,"()"),Jr.forEach(s),Rn=l(V,` and
`),Bt=a(V,"A",{href:!0});var zl=n(Bt);Zn=l(zl,"decode()"),zl.forEach(s),xn=l(V," for more information."),V.forEach(s),zn=p(X),Me=a(X,"DIV",{class:!0});var xo=n(Me);v(rt.$$.fragment,xo),En=p(xo),G=a(xo,"P",{});var ze=n(G);Xn=l(ze,`When used in normal mode, this method forwards all its arguments to AutoImageProcessor\u2019s
`),ks=a(ze,"CODE",{});var El=n(ks);$n=l(El,"__call__()"),El.forEach(s),Nn=l(ze,` and returns its output. If used in the context
`),Us=a(ze,"CODE",{});var Xl=n(Us);Vn=l(Xl,"as_target_processor()"),Xl.forEach(s),Bn=l(ze,` this method forwards all its arguments to DonutTokenizer\u2019s
`),Ds=a(ze,"CODE",{});var $l=n(Ds);Wn=l($l,"~DonutTokenizer.__call__"),$l.forEach(s),Cn=l(ze,". Please refer to the doctsring of the above two methods for more information."),ze.forEach(s),xo.forEach(s),Sn=p(X),Q=a(X,"DIV",{class:!0});var At=n(Q);v(lt.$$.fragment,At),Gn=p(At),Rs=a(At,"P",{});var Nl=n(Rs);Pn=l(Nl,"Instantiate a processor associated with a pretrained model."),Nl.forEach(s),Fn=p(At),v(je.$$.fragment,At),At.forEach(s),Yn=p(X),A=a(X,"DIV",{class:!0});var Ht=n(A);v(it.$$.fragment,Ht),qn=p(Ht),ct=a(Ht,"P",{});var zo=n(ct);Qn=l(zo,`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Wt=a(zo,"A",{href:!0});var Vl=n(Wt);An=l(Vl,"from_pretrained()"),Vl.forEach(s),Hn=l(zo," method."),zo.forEach(s),Ln=p(Ht),v(Ie.$$.fragment,Ht),Ht.forEach(s),On=p(X),ke=a(X,"DIV",{class:!0});var Eo=n(ke);v(dt.$$.fragment,Eo),Kn=p(Eo),pt=a(Eo,"P",{});var Xo=n(pt);er=l(Xo,"This method forwards all its arguments to DonutTokenizer\u2019s "),Ct=a(Xo,"A",{href:!0});var Bl=n(Ct);tr=l(Bl,"batch_decode()"),Bl.forEach(s),sr=l(Xo,`. Please refer
to the docstring of this method for more information.`),Xo.forEach(s),Eo.forEach(s),or=p(X),Ue=a(X,"DIV",{class:!0});var $o=n(Ue);v(mt.$$.fragment,$o),ar=p($o),ht=a($o,"P",{});var No=n(ht);nr=l(No,"This method forwards all its arguments to DonutTokenizer\u2019s "),St=a(No,"A",{href:!0});var Wl=n(St);rr=l(Wl,"decode()"),Wl.forEach(s),lr=l(No,`. Please refer to the
docstring of this method for more information.`),No.forEach(s),$o.forEach(s),X.forEach(s),ho=p(t),ne=a(t,"H2",{class:!0});var Vo=n(ne);De=a(Vo,"A",{id:!0,class:!0,href:!0});var Cl=n(De);Zs=a(Cl,"SPAN",{});var Sl=n(Zs);v(ut.$$.fragment,Sl),Sl.forEach(s),Cl.forEach(s),ir=p(Vo),xs=a(Vo,"SPAN",{});var Gl=n(xs);cr=l(Gl,"DonutSwinModel"),Gl.forEach(s),Vo.forEach(s),uo=p(t),P=a(t,"DIV",{class:!0});var Lt=n(P);v(ft.$$.fragment,Lt),dr=p(Lt),gt=a(Lt,"P",{});var Bo=n(gt);pr=l(Bo,`The bare Donut Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),_t=a(Bo,"A",{href:!0,rel:!0});var Pl=n(_t);mr=l(Pl,"torch.nn.Module"),Pl.forEach(s),hr=l(Bo,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bo.forEach(s),ur=p(Lt),C=a(Lt,"DIV",{class:!0});var Ee=n(C);v(bt.$$.fragment,Ee),fr=p(Ee),re=a(Ee,"P",{});var Ot=n(re);gr=l(Ot,"The "),Gt=a(Ot,"A",{href:!0});var Fl=n(Gt);_r=l(Fl,"DonutSwinModel"),Fl.forEach(s),br=l(Ot," forward method, overrides the "),zs=a(Ot,"CODE",{});var Yl=n(zs);vr=l(Yl,"__call__"),Yl.forEach(s),wr=l(Ot," special method."),Ot.forEach(s),yr=p(Ee),v(Re.$$.fragment,Ee),Tr=p(Ee),v(Ze.$$.fragment,Ee),Ee.forEach(s),Lt.forEach(s),this.h()},h(){i(u,"name","hf:doc:metadata"),i(u,"content",JSON.stringify(li)),i(g,"id","donut"),i(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(g,"href","#donut"),i(f,"class","relative group"),i(D,"id","overview"),i(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(D,"href","#overview"),i(Z,"class","relative group"),i(Xe,"href","https://arxiv.org/abs/2111.15664"),i(Xe,"rel","nofollow"),Kl(de.src,jr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/donut_architecture.jpg")||i(de,"src",jr),i(de,"alt","drawing"),i(de,"width","600"),i(Mt,"href","https://arxiv.org/abs/2111.15664"),i($e,"href","https://huggingface.co/nielsr"),i($e,"rel","nofollow"),i(Ne,"href","https://github.com/clovaai/donut"),i(Ne,"rel","nofollow"),i(Be,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Donut"),i(Be,"rel","nofollow"),i(It,"href","vision-encoder-decoder"),i(he,"id","inference"),i(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(he,"href","#inference"),i(H,"class","relative group"),i(kt,"href","/docs/transformers/v4.31.0/en/main_classes/text_generation#transformers.GenerationMixin.generate"),i(Ut,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutImageProcessor"),i(Dt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutProcessor"),i(Rt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutImageProcessor"),i(Fe,"href","https://huggingface.co/models?filter=donut"),i(Fe,"rel","nofollow"),i(fe,"id","training"),i(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(fe,"href","#training"),i(L,"class","relative group"),i(qe,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Donut"),i(qe,"rel","nofollow"),i(_e,"id","transformers.DonutSwinConfig"),i(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(_e,"href","#transformers.DonutSwinConfig"),i(O,"class","relative group"),i(Et,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutSwinModel"),i(He,"href","https://huggingface.co/naver-clova-ix/donut-base"),i(He,"rel","nofollow"),i(Xt,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),i($t,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ve,"id","transformers.DonutImageProcessor"),i(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(ve,"href","#transformers.DonutImageProcessor"),i(te,"class","relative group"),i(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ye,"id","transformers.DonutFeatureExtractor"),i(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(ye,"href","#transformers.DonutFeatureExtractor"),i(se,"class","relative group"),i(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Je,"id","transformers.DonutProcessor"),i(Je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(Je,"href","#transformers.DonutProcessor"),i(ae,"class","relative group"),i(Nt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutProcessor"),i(Vt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutImageProcessor"),i(nt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutProcessor.__call__"),i(Bt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutProcessor.decode"),i(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Wt,"href","/docs/transformers/v4.31.0/en/model_doc/trocr#transformers.TrOCRProcessor.from_pretrained"),i(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Ct,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),i(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(St,"href","/docs/transformers/v4.31.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.decode"),i(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(De,"id","transformers.DonutSwinModel"),i(De,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(De,"href","#transformers.DonutSwinModel"),i(ne,"class","relative group"),i(_t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(_t,"rel","nofollow"),i(Gt,"href","/docs/transformers/v4.31.0/en/model_doc/donut#transformers.DonutSwinModel"),i(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,c){e(document.head,u),m(t,j,c),m(t,f,c),e(f,g),e(g,M),w(h,M,null),e(f,_),e(f,R),e(R,$),m(t,U,c),m(t,Z,c),e(Z,D),e(D,x),w(F,x,null),e(Z,yt),e(Z,ie),e(ie,Wo),m(t,Vs,c),m(t,ce,c),e(ce,Co),e(ce,Xe),e(Xe,So),e(ce,Go),m(t,Bs,c),m(t,Tt,c),e(Tt,Po),m(t,Ws,c),m(t,Jt,c),e(Jt,Kt),e(Kt,Fo),m(t,Cs,c),m(t,de,c),m(t,Ss,c),m(t,pe,c),e(pe,Yo),e(pe,Mt),e(Mt,qo),e(pe,Qo),m(t,Gs,c),m(t,Y,c),e(Y,Ao),e(Y,$e),e($e,Ho),e(Y,Lo),e(Y,Ne),e(Ne,Oo),e(Y,Ko),m(t,Ps,c),m(t,jt,c),e(jt,ea),m(t,Fs,c),m(t,me,c),e(me,Ve),e(Ve,ta),e(Ve,Be),e(Be,sa),e(Ve,oa),e(me,aa),e(me,We),e(We,na),e(We,It),e(It,ra),e(We,la),m(t,Ys,c),m(t,H,c),e(H,he),e(he,es),w(Ce,es,null),e(H,ia),e(H,ts),e(ts,ca),m(t,qs,c),m(t,q,c),e(q,da),e(q,ss),e(ss,pa),e(q,ma),e(q,kt),e(kt,ha),e(q,ua),m(t,Qs,c),m(t,k,c),e(k,fa),e(k,Ut),e(Ut,ga),e(k,_a),e(k,os),e(os,ba),e(k,va),e(k,as),e(as,wa),e(k,ya),e(k,Dt),e(Dt,Ta),e(k,Ja),e(k,Rt),e(Rt,Ma),e(k,ja),e(k,ns),e(ns,Ia),e(k,ka),e(k,rs),e(rs,Ua),e(k,Da),m(t,As,c),m(t,Zt,c),e(Zt,ls),e(ls,Ra),m(t,Hs,c),w(Se,t,c),m(t,Ls,c),m(t,xt,c),e(xt,is),e(is,Za),m(t,Os,c),w(Ge,t,c),m(t,Ks,c),m(t,zt,c),e(zt,cs),e(cs,xa),m(t,eo,c),w(Pe,t,c),m(t,to,c),m(t,ue,c),e(ue,za),e(ue,Fe),e(Fe,Ea),e(ue,Xa),m(t,so,c),m(t,L,c),e(L,fe),e(fe,ds),w(Ye,ds,null),e(L,$a),e(L,ps),e(ps,Na),m(t,oo,c),m(t,ge,c),e(ge,Va),e(ge,qe),e(qe,Ba),e(ge,Wa),m(t,ao,c),m(t,O,c),e(O,_e),e(_e,ms),w(Qe,ms,null),e(O,Ca),e(O,hs),e(hs,Sa),m(t,no,c),m(t,N,c),w(Ae,N,null),e(N,Ga),e(N,K),e(K,Pa),e(K,Et),e(Et,Fa),e(K,Ya),e(K,He),e(He,qa),e(K,Qa),e(N,Aa),e(N,ee),e(ee,Ha),e(ee,Xt),e(Xt,La),e(ee,Oa),e(ee,$t),e($t,Ka),e(ee,en),e(N,tn),w(be,N,null),m(t,ro,c),m(t,te,c),e(te,ve),e(ve,us),w(Le,us,null),e(te,sn),e(te,fs),e(fs,on),m(t,lo,c),m(t,S,c),w(Oe,S,null),e(S,an),e(S,gs),e(gs,nn),e(S,rn),e(S,we),w(Ke,we,null),e(we,ln),e(we,_s),e(_s,cn),m(t,io,c),m(t,se,c),e(se,ye),e(ye,bs),w(et,bs,null),e(se,dn),e(se,vs),e(vs,pn),m(t,co,c),m(t,oe,c),w(tt,oe,null),e(oe,mn),e(oe,Te),w(st,Te,null),e(Te,hn),e(Te,ws),e(ws,un),m(t,po,c),m(t,ae,c),e(ae,Je),e(Je,ys),w(ot,ys,null),e(ae,fn),e(ae,Ts),e(Ts,gn),m(t,mo,c),m(t,I,c),w(at,I,null),e(I,_n),e(I,Js),e(Js,bn),e(I,vn),e(I,z),e(z,Nt),e(Nt,wn),e(z,yn),e(z,Vt),e(Vt,Tn),e(z,Jn),e(z,Ms),e(Ms,Mn),e(z,jn),e(z,js),e(js,In),e(z,kn),e(z,nt),e(nt,Is),e(Is,Un),e(nt,Dn),e(z,Rn),e(z,Bt),e(Bt,Zn),e(z,xn),e(I,zn),e(I,Me),w(rt,Me,null),e(Me,En),e(Me,G),e(G,Xn),e(G,ks),e(ks,$n),e(G,Nn),e(G,Us),e(Us,Vn),e(G,Bn),e(G,Ds),e(Ds,Wn),e(G,Cn),e(I,Sn),e(I,Q),w(lt,Q,null),e(Q,Gn),e(Q,Rs),e(Rs,Pn),e(Q,Fn),w(je,Q,null),e(I,Yn),e(I,A),w(it,A,null),e(A,qn),e(A,ct),e(ct,Qn),e(ct,Wt),e(Wt,An),e(ct,Hn),e(A,Ln),w(Ie,A,null),e(I,On),e(I,ke),w(dt,ke,null),e(ke,Kn),e(ke,pt),e(pt,er),e(pt,Ct),e(Ct,tr),e(pt,sr),e(I,or),e(I,Ue),w(mt,Ue,null),e(Ue,ar),e(Ue,ht),e(ht,nr),e(ht,St),e(St,rr),e(ht,lr),m(t,ho,c),m(t,ne,c),e(ne,De),e(De,Zs),w(ut,Zs,null),e(ne,ir),e(ne,xs),e(xs,cr),m(t,uo,c),m(t,P,c),w(ft,P,null),e(P,dr),e(P,gt),e(gt,pr),e(gt,_t),e(_t,mr),e(gt,hr),e(P,ur),e(P,C),w(bt,C,null),e(C,fr),e(C,re),e(re,gr),e(re,Gt),e(Gt,_r),e(re,br),e(re,zs),e(zs,vr),e(re,wr),e(C,yr),w(Re,C,null),e(C,Tr),w(Ze,C,null),fo=!0},p(t,[c]){const vt={};c&2&&(vt.$$scope={dirty:c,ctx:t}),be.$set(vt);const Es={};c&2&&(Es.$$scope={dirty:c,ctx:t}),je.$set(Es);const Xs={};c&2&&(Xs.$$scope={dirty:c,ctx:t}),Ie.$set(Xs);const $s={};c&2&&($s.$$scope={dirty:c,ctx:t}),Re.$set($s);const wt={};c&2&&(wt.$$scope={dirty:c,ctx:t}),Ze.$set(wt)},i(t){fo||(y(h.$$.fragment,t),y(F.$$.fragment,t),y(Ce.$$.fragment,t),y(Se.$$.fragment,t),y(Ge.$$.fragment,t),y(Pe.$$.fragment,t),y(Ye.$$.fragment,t),y(Qe.$$.fragment,t),y(Ae.$$.fragment,t),y(be.$$.fragment,t),y(Le.$$.fragment,t),y(Oe.$$.fragment,t),y(Ke.$$.fragment,t),y(et.$$.fragment,t),y(tt.$$.fragment,t),y(st.$$.fragment,t),y(ot.$$.fragment,t),y(at.$$.fragment,t),y(rt.$$.fragment,t),y(lt.$$.fragment,t),y(je.$$.fragment,t),y(it.$$.fragment,t),y(Ie.$$.fragment,t),y(dt.$$.fragment,t),y(mt.$$.fragment,t),y(ut.$$.fragment,t),y(ft.$$.fragment,t),y(bt.$$.fragment,t),y(Re.$$.fragment,t),y(Ze.$$.fragment,t),fo=!0)},o(t){T(h.$$.fragment,t),T(F.$$.fragment,t),T(Ce.$$.fragment,t),T(Se.$$.fragment,t),T(Ge.$$.fragment,t),T(Pe.$$.fragment,t),T(Ye.$$.fragment,t),T(Qe.$$.fragment,t),T(Ae.$$.fragment,t),T(be.$$.fragment,t),T(Le.$$.fragment,t),T(Oe.$$.fragment,t),T(Ke.$$.fragment,t),T(et.$$.fragment,t),T(tt.$$.fragment,t),T(st.$$.fragment,t),T(ot.$$.fragment,t),T(at.$$.fragment,t),T(rt.$$.fragment,t),T(lt.$$.fragment,t),T(je.$$.fragment,t),T(it.$$.fragment,t),T(Ie.$$.fragment,t),T(dt.$$.fragment,t),T(mt.$$.fragment,t),T(ut.$$.fragment,t),T(ft.$$.fragment,t),T(bt.$$.fragment,t),T(Re.$$.fragment,t),T(Ze.$$.fragment,t),fo=!1},d(t){s(u),t&&s(j),t&&s(f),J(h),t&&s(U),t&&s(Z),J(F),t&&s(Vs),t&&s(ce),t&&s(Bs),t&&s(Tt),t&&s(Ws),t&&s(Jt),t&&s(Cs),t&&s(de),t&&s(Ss),t&&s(pe),t&&s(Gs),t&&s(Y),t&&s(Ps),t&&s(jt),t&&s(Fs),t&&s(me),t&&s(Ys),t&&s(H),J(Ce),t&&s(qs),t&&s(q),t&&s(Qs),t&&s(k),t&&s(As),t&&s(Zt),t&&s(Hs),J(Se,t),t&&s(Ls),t&&s(xt),t&&s(Os),J(Ge,t),t&&s(Ks),t&&s(zt),t&&s(eo),J(Pe,t),t&&s(to),t&&s(ue),t&&s(so),t&&s(L),J(Ye),t&&s(oo),t&&s(ge),t&&s(ao),t&&s(O),J(Qe),t&&s(no),t&&s(N),J(Ae),J(be),t&&s(ro),t&&s(te),J(Le),t&&s(lo),t&&s(S),J(Oe),J(Ke),t&&s(io),t&&s(se),J(et),t&&s(co),t&&s(oe),J(tt),J(st),t&&s(po),t&&s(ae),J(ot),t&&s(mo),t&&s(I),J(at),J(rt),J(lt),J(je),J(it),J(Ie),J(dt),J(mt),t&&s(ho),t&&s(ne),J(ut),t&&s(uo),t&&s(P),J(ft),J(bt),J(Re),J(Ze)}}}const li={local:"donut",sections:[{local:"overview",title:"Overview"},{local:"inference",title:"Inference"},{local:"training",title:"Training"},{local:"transformers.DonutSwinConfig",title:"DonutSwinConfig"},{local:"transformers.DonutImageProcessor",title:"DonutImageProcessor"},{local:"transformers.DonutFeatureExtractor",title:"DonutFeatureExtractor"},{local:"transformers.DonutProcessor",title:"DonutProcessor"},{local:"transformers.DonutSwinModel",title:"DonutSwinModel"}],title:"Donut"};function ii(W){return ei(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fi extends Al{constructor(u){super();Hl(this,u,ii,ri,Ll,{})}}export{fi as default,li as metadata};
