import{S as Ll,i as Hl,s as Ql,e as s,k as d,w as b,t as r,M as Ol,c as a,d as o,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 M,B as T,v as ei,L as Al}from"../../chunks/vendor-hf-doc-builder.js";import{T as jr}from"../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Co}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(N){let u,J,f,g,j;return g=new Co({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=s("p"),J=r("Example:"),f=d(),b(g.$$.fragment)},l(h){u=a(h,"P",{});var _=n(u);J=l(_,"Example:"),_.forEach(o),f=p(h),v(g.$$.fragment,h)},m(h,_){m(h,u,_),e(u,J),m(h,f,_),w(g,h,_),j=!0},p:Al,i(h){j||(y(g.$$.fragment,h),j=!0)},o(h){M(g.$$.fragment,h),j=!1},d(h){h&&o(u),h&&o(f),T(g,h)}}}function oi(N){let u,J,f,g,j,h,_,z,V,U,x;return{c(){u=s("p"),J=r(`This class method is simply calling the feature extractor
`),f=s("a"),g=r("from_pretrained()"),j=r(`, image processor
`),h=s("a"),_=r("ImageProcessingMixin"),z=r(` and the tokenizer
`),V=s("code"),U=r("~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),x=r(` methods. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(D){u=a(D,"P",{});var Z=n(u);J=l(Z,`This class method is simply calling the feature extractor
`),f=a(Z,"A",{href:!0});var F=n(f);g=l(F,"from_pretrained()"),F.forEach(o),j=l(Z,`, image processor
`),h=a(Z,"A",{href:!0});var yt=n(h);_=l(yt,"ImageProcessingMixin"),yt.forEach(o),z=l(Z,` and the tokenizer
`),V=a(Z,"CODE",{});var ie=n(V);U=l(ie,"~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),ie.forEach(o),x=l(Z,` methods. Please refer to the docstrings of the
methods above for more information.`),Z.forEach(o),this.h()},h(){i(f,"href","/docs/transformers/v4.33.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),i(h,"href","/docs/transformers/v4.33.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin")},m(D,Z){m(D,u,Z),e(u,J),e(u,f),e(f,g),e(u,j),e(u,h),e(h,_),e(u,z),e(u,V),e(V,U),e(u,x)},d(D){D&&o(u)}}}function si(N){let u,J,f,g,j,h,_,z;return{c(){u=s("p"),J=r("This class method is simply calling "),f=s("a"),g=r("save_pretrained()"),j=r(` and
`),h=s("a"),_=r("save_pretrained()"),z=r(`. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(V){u=a(V,"P",{});var U=n(u);J=l(U,"This class method is simply calling "),f=a(U,"A",{href:!0});var x=n(f);g=l(x,"save_pretrained()"),x.forEach(o),j=l(U,` and
`),h=a(U,"A",{href:!0});var D=n(h);_=l(D,"save_pretrained()"),D.forEach(o),z=l(U,`. Please refer to the docstrings of the
methods above for more information.`),U.forEach(o),this.h()},h(){i(f,"href","/docs/transformers/v4.33.0/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained"),i(h,"href","/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.save_pretrained")},m(V,U){m(V,u,U),e(u,J),e(u,f),e(f,g),e(u,j),e(u,h),e(h,_),e(u,z)},d(V){V&&o(u)}}}function ai(N){let u,J,f,g,j;return{c(){u=s("p"),J=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),g=r("Module"),j=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 z=n(f);g=l(z,"Module"),z.forEach(o),j=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(o)},m(h,_){m(h,u,_),e(u,J),e(u,f),e(f,g),e(u,j)},d(h){h&&o(u)}}}function ni(N){let u,J,f,g,j;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="hljs-keyword">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=s("p"),J=r("Example:"),f=d(),b(g.$$.fragment)},l(h){u=a(h,"P",{});var _=n(u);J=l(_,"Example:"),_.forEach(o),f=p(h),v(g.$$.fragment,h)},m(h,_){m(h,u,_),e(u,J),m(h,f,_),w(g,h,_),j=!0},p:Al,i(h){j||(y(g.$$.fragment,h),j=!0)},o(h){M(g.$$.fragment,h),j=!1},d(h){h&&o(u),h&&o(f),T(g,h)}}}function ri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MCUzRCUyMHNlcXVlbmNlLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5lb3NfdG9rZW4lMkMlMjAlMjIlMjIpLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5wYWRfdG9rZW4lMkMlMjAlMjIlMjIpJTBBc2VxdWVuY2UlMjAlM0QlMjByZS5zdWIociUyMiUzQy4qJTNGJTNFJTIyJTJDJTIwJTIyJTIyJTJDJTIwc2VxdWVuY2UlMkMlMjBjb3VudCUzRDEpLnN0cmlwKCklMjAlMjAlMjMlMjByZW1vdmUlMjBmaXJzdCUyMHRhc2slMjBzdGFydCUyMHRva2VuJTBBcHJpbnQocHJvY2Vzc29yLnRva2VuMmpzb24oc2VxdWVuY2UpKQ==",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>    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>    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>}`}}),Se=new Co({props:{code:"aW1wb3J0JTIwcmUlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwRG9udXRQcm9jZXNzb3IlMkMlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBEb251dFByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlLWZpbmV0dW5lZC1jb3JkLXYyJTIyKSUwQW1vZGVsJTIwJTNEJTIwVmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybmF2ZXItY2xvdmEtaXglMkZkb251dC1iYXNlLWZpbmV0dW5lZC1jb3JkLXYyJTIyKSUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjBpZiUyMHRvcmNoLmN1ZGEuaXNfYXZhaWxhYmxlKCklMjBlbHNlJTIwJTIyY3B1JTIyJTBBbW9kZWwudG8oZGV2aWNlKSUwQSUyMyUyMGxvYWQlMjBkb2N1bWVudCUyMGltYWdlJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZXhhbXBsZS1kb2N1bWVudHMlMjIlMkMlMjBzcGxpdCUzRCUyMnRlc3QlMjIpJTBBaW1h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5faWQlNUQlNUQlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdF9pbl9nZW5lcmF0ZSUzRFRydWUlMkMlMEEpJTBBJTBBc2VxdWVuY2UlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKG91dHB1dHMuc2VxdWVuY2VzKSU1QjAlNUQlMEFzZXF1ZW5jZSUyMCUzRCUyMHNlcXVlbmNlLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5lb3NfdG9rZW4lMkMlMjAlMjIlMjIpLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5wYWRfdG9rZW4lMkMlMjAlMjIlMjIpJTBBc2VxdWVuY2UlMjAlM0QlMjByZS5zdWIociUyMiUzQy4qJTNGJTNFJTIyJTJDJTIwJTIyJTIyJTJDJTIwc2VxdWVuY2UlMkMlMjBjb3VudCUzRDEpLnN0cmlwKCklMjAlMjAlMjMlMjByZW1vdmUlMjBmaXJzdCUyMHRhc2slMjBzdGFydCUyMHRva2VuJTBBcHJpbnQocHJvY2Vzc29yLnRva2VuMmpzb24oc2VxdWVuY2UpKQ==",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>    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>    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 Co({props:{code:"aW1wb3J0JTIwcmUlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwRG9udXRQcm9jZXNzb3IlMkMlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGV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ZSUzRFRydWUlMkMlMEEpJTBBJTBBc2VxdWVuY2UlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKG91dHB1dHMuc2VxdWVuY2VzKSU1QjAlNUQlMEFzZXF1ZW5jZSUyMCUzRCUyMHNlcXVlbmNlLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5lb3NfdG9rZW4lMkMlMjAlMjIlMjIpLnJlcGxhY2UocHJvY2Vzc29yLnRva2VuaXplci5wYWRfdG9rZW4lMkMlMjAlMjIlMjIpJTBBc2VxdWVuY2UlMjAlM0QlMjByZS5zdWIociUyMiUzQy4qJTNGJTNFJTIyJTJDJTIwJTIyJTIyJTJDJTIwc2VxdWVuY2UlMkMlMjBjb3VudCUzRDEpLnN0cmlwKCklMjAlMjAlMjMlMjByZW1vdmUlMjBmaXJzdCUyMHRhc2slMjBzdGFydCUyMHRva2VuJTBBcHJpbnQocHJvY2Vzc29yLnRva2VuMmpzb24oc2VxdWVuY2UpKQ==",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-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>    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>    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({}),Ae=new le({}),Le=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.33.0/src/transformers/models/donut/configuration_donut_swin.py#L29"}}),be=new ql({props:{anchor:"transformers.DonutSwinConfig.example",$$slots:{default:[ti]},$$scope:{ctx:N}}}),Qe=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.33.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:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DonutImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,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"},{anchor:"transformers.DonutImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/donut/image_processing_donut.py#L298"}}),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.33.0/src/transformers/models/donut/feature_extraction_donut.py#L26"}}),ot=new B({props:{name:"__call__",anchor:"transformers.DonutFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/image_processing_utils.py#L544"}}),st=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.33.0/en/model_doc/donut#transformers.DonutImageProcessor">DonutImageProcessor</a>) &#x2014;
An instance of <a href="/docs/transformers/v4.33.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.33.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.33.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.33.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.33.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.33.0/src/transformers/processing_utils.py#L167"}}),Je=new jr({props:{$$slots:{default:[oi]},$$scope:{ctx:N}}}),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.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/processing_utils.py#L93"}}),ke=new jr({props:{$$slots:{default:[si]},$$scope:{ctx:N}}}),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.33.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.33.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.33.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.33.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.33.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.33.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutFeatureExtractor.__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.33.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.33.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.33.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>
`}}),ze=new jr({props:{$$slots:{default:[ai]},$$scope:{ctx:N}}}),xe=new ql({props:{anchor:"transformers.DonutSwinModel.forward.example",$$slots:{default:[ni]},$$scope:{ctx:N}}}),{c(){u=s("meta"),J=d(),f=s("h1"),g=s("a"),j=s("span"),b(h.$$.fragment),_=d(),z=s("span"),V=r("Donut"),U=d(),x=s("h2"),D=s("a"),Z=s("span"),b(F.$$.fragment),yt=d(),ie=s("span"),Ns=r("Overview"),Bo=d(),ce=s("p"),Xs=r("The Donut model was proposed in "),$e=s("a"),Gs=r("OCR-free Document Understanding Transformer"),Ss=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.`),No=d(),Mt=s("p"),Ps=r("The abstract from the paper is the following:"),Xo=d(),Tt=s("p"),Kt=s("em"),Fs=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."),Go=d(),de=s("img"),So=d(),pe=s("small"),Ys=r("Donut high-level overview. Taken from the "),jt=s("a"),qs=r("original paper"),As=r("."),Po=d(),Y=s("p"),Ls=r("This model was contributed by "),Ve=s("a"),Hs=r("nielsr"),Qs=r(`. The original code can be found
`),We=s("a"),Os=r("here"),Ks=r("."),Fo=d(),Jt=s("p"),ea=r("Tips:"),Yo=d(),me=s("ul"),Ce=s("li"),ta=r("The quickest way to get started with Donut is by checking the "),Be=s("a"),oa=r(`tutorial
notebooks`),sa=r(`, which show how to use the model
at inference time as well as fine-tuning on custom data.`),aa=d(),Ne=s("li"),na=r("Donut is always used within the "),kt=s("a"),ra=r("VisionEncoderDecoder"),la=r(" framework."),qo=d(),H=s("h2"),he=s("a"),eo=s("span"),b(Xe.$$.fragment),ia=d(),to=s("span"),ca=r("Inference"),Ao=d(),q=s("p"),da=r("Donut\u2019s "),oo=s("code"),pa=r("VisionEncoderDecoder"),ma=r(` model accepts images as input and makes use of
`),It=s("a"),ha=r("generate()"),ua=r(" to autoregressively generate text given the input image."),Lo=d(),I=s("p"),fa=r("The "),Ut=s("a"),ga=r("DonutImageProcessor"),_a=r(` class is responsible for preprocessing the input image and
[`),so=s("code"),ba=r("XLMRobertaTokenizer"),va=r("/"),ao=s("code"),wa=r("XLMRobertaTokenizerFast"),ya=r(`] decodes the generated target tokens to the target string. The
`),Dt=s("a"),Ma=r("DonutProcessor"),Ta=r(" wraps "),zt=s("a"),ja=r("DonutImageProcessor"),Ja=r(" and ["),no=s("code"),ka=r("XLMRobertaTokenizer"),Ia=r("/"),ro=s("code"),Ua=r("XLMRobertaTokenizerFast"),Da=r(`]
into a single instance to both extract the input features and decode the predicted token ids.`),Ho=d(),xt=s("ul"),lo=s("li"),za=r("Step-by-step Document Image Classification"),Qo=d(),b(Ge.$$.fragment),Oo=d(),Zt=s("ul"),io=s("li"),xa=r("Step-by-step Document Parsing"),Ko=d(),b(Se.$$.fragment),es=d(),Rt=s("ul"),co=s("li"),Za=r("Step-by-step Document Visual Question Answering (DocVQA)"),ts=d(),b(Pe.$$.fragment),os=d(),ue=s("p"),Ra=r("See the "),Fe=s("a"),Ea=r("model hub"),$a=r(" to look for Donut checkpoints."),ss=d(),Q=s("h2"),fe=s("a"),po=s("span"),b(Ye.$$.fragment),Va=d(),mo=s("span"),Wa=r("Training"),as=d(),ge=s("p"),Ca=r("We refer to the "),qe=s("a"),Ba=r("tutorial notebooks"),Na=r("."),ns=d(),O=s("h2"),_e=s("a"),ho=s("span"),b(Ae.$$.fragment),Xa=d(),uo=s("span"),Ga=r("DonutSwinConfig"),rs=d(),W=s("div"),b(Le.$$.fragment),Sa=d(),K=s("p"),Pa=r("This is the configuration class to store the configuration of a "),Et=s("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=s("a"),qa=r("naver-clova-ix/donut-base"),Aa=r(" architecture."),La=d(),ee=s("p"),Ha=r("Configuration objects inherit from "),$t=s("a"),Qa=r("PretrainedConfig"),Oa=r(` and can be used to control the model outputs. Read the
documentation from `),Vt=s("a"),Ka=r("PretrainedConfig"),en=r(" for more information."),tn=d(),b(be.$$.fragment),ls=d(),te=s("h2"),ve=s("a"),fo=s("span"),b(Qe.$$.fragment),on=d(),go=s("span"),sn=r("DonutImageProcessor"),is=d(),G=s("div"),b(Oe.$$.fragment),an=d(),_o=s("p"),nn=r("Constructs a Donut image processor."),rn=d(),we=s("div"),b(Ke.$$.fragment),ln=d(),bo=s("p"),cn=r("Preprocess an image or batch of images."),cs=d(),oe=s("h2"),ye=s("a"),vo=s("span"),b(et.$$.fragment),dn=d(),wo=s("span"),pn=r("DonutFeatureExtractor"),ds=d(),se=s("div"),b(tt.$$.fragment),mn=d(),Me=s("div"),b(ot.$$.fragment),hn=d(),yo=s("p"),un=r("Preprocess an image or a batch of images."),ps=d(),ae=s("h2"),Te=s("a"),Mo=s("span"),b(st.$$.fragment),fn=d(),To=s("span"),gn=r("DonutProcessor"),ms=d(),k=s("div"),b(at.$$.fragment),_n=d(),jo=s("p"),bn=r(`Constructs a Donut processor which wraps a Donut image processor and an XLMRoBERTa tokenizer into a single
processor.`),vn=d(),R=s("p"),Wt=s("a"),wn=r("DonutProcessor"),yn=r(" offers all the functionalities of "),Ct=s("a"),Mn=r("DonutImageProcessor"),Tn=r(` and
[`),Jo=s("code"),jn=r("XLMRobertaTokenizer"),Jn=r("/"),ko=s("code"),kn=r("XLMRobertaTokenizerFast"),In=r("]. See the "),nt=s("a"),Io=s("strong"),Un=r("call"),Dn=r("()"),zn=r(` and
`),Bt=s("a"),xn=r("decode()"),Zn=r(" for more information."),Rn=d(),je=s("div"),b(rt.$$.fragment),En=d(),S=s("p"),$n=r(`When used in normal mode, this method forwards all its arguments to AutoImageProcessor\u2019s
`),Uo=s("code"),Vn=r("__call__()"),Wn=r(` and returns its output. If used in the context
`),Do=s("code"),Cn=r("as_target_processor()"),Bn=r(` this method forwards all its arguments to DonutTokenizer\u2019s
`),zo=s("code"),Nn=r("~DonutTokenizer.__call__"),Xn=r(". Please refer to the doctsring of the above two methods for more information."),Gn=d(),A=s("div"),b(lt.$$.fragment),Sn=d(),xo=s("p"),Pn=r("Instantiate a processor associated with a pretrained model."),Fn=d(),b(Je.$$.fragment),Yn=d(),L=s("div"),b(it.$$.fragment),qn=d(),ct=s("p"),An=r(`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Nt=s("a"),Ln=r("from_pretrained()"),Hn=r(" method."),Qn=d(),b(ke.$$.fragment),On=d(),Ie=s("div"),b(dt.$$.fragment),Kn=d(),pt=s("p"),er=r("This method forwards all its arguments to DonutTokenizer\u2019s "),Xt=s("a"),tr=r("batch_decode()"),or=r(`. Please refer
to the docstring of this method for more information.`),sr=d(),Ue=s("div"),b(mt.$$.fragment),ar=d(),ht=s("p"),nr=r("This method forwards all its arguments to DonutTokenizer\u2019s "),Gt=s("a"),rr=r("decode()"),lr=r(`. Please refer to the
docstring of this method for more information.`),hs=d(),ne=s("h2"),De=s("a"),Zo=s("span"),b(ut.$$.fragment),ir=d(),Ro=s("span"),cr=r("DonutSwinModel"),us=d(),P=s("div"),b(ft.$$.fragment),dr=d(),gt=s("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=s("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(),X=s("div"),b(bt.$$.fragment),fr=d(),re=s("p"),gr=r("The "),St=s("a"),_r=r("DonutSwinModel"),br=r(" forward method, overrides the "),Eo=s("code"),vr=r("__call__"),wr=r(" special method."),yr=d(),b(ze.$$.fragment),Mr=d(),b(xe.$$.fragment),this.h()},l(t){const c=Ol('[data-svelte="svelte-1phssyn"]',document.head);u=a(c,"META",{name:!0,content:!0}),c.forEach(o),J=p(t),f=a(t,"H1",{class:!0});var vt=n(f);g=a(vt,"A",{id:!0,class:!0,href:!0});var $o=n(g);j=a($o,"SPAN",{});var Vo=n(j);v(h.$$.fragment,Vo),Vo.forEach(o),$o.forEach(o),_=p(vt),z=a(vt,"SPAN",{});var Wo=n(z);V=l(Wo,"Donut"),Wo.forEach(o),vt.forEach(o),U=p(t),x=a(t,"H2",{class:!0});var wt=n(x);D=a(wt,"A",{id:!0,class:!0,href:!0});var kr=n(D);Z=a(kr,"SPAN",{});var Ir=n(Z);v(F.$$.fragment,Ir),Ir.forEach(o),kr.forEach(o),yt=p(wt),ie=a(wt,"SPAN",{});var Ur=n(ie);Ns=l(Ur,"Overview"),Ur.forEach(o),wt.forEach(o),Bo=p(t),ce=a(t,"P",{});var gs=n(ce);Xs=l(gs,"The Donut model was proposed in "),$e=a(gs,"A",{href:!0,rel:!0});var Dr=n($e);Gs=l(Dr,"OCR-free Document Understanding Transformer"),Dr.forEach(o),Ss=l(gs,` 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.`),gs.forEach(o),No=p(t),Mt=a(t,"P",{});var zr=n(Mt);Ps=l(zr,"The abstract from the paper is the following:"),zr.forEach(o),Xo=p(t),Tt=a(t,"P",{});var xr=n(Tt);Kt=a(xr,"EM",{});var Zr=n(Kt);Fs=l(Zr,"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."),Zr.forEach(o),xr.forEach(o),Go=p(t),de=a(t,"IMG",{src:!0,alt:!0,width:!0}),So=p(t),pe=a(t,"SMALL",{});var _s=n(pe);Ys=l(_s,"Donut high-level overview. Taken from the "),jt=a(_s,"A",{href:!0});var Rr=n(jt);qs=l(Rr,"original paper"),Rr.forEach(o),As=l(_s,"."),_s.forEach(o),Po=p(t),Y=a(t,"P",{});var Pt=n(Y);Ls=l(Pt,"This model was contributed by "),Ve=a(Pt,"A",{href:!0,rel:!0});var Er=n(Ve);Hs=l(Er,"nielsr"),Er.forEach(o),Qs=l(Pt,`. The original code can be found
`),We=a(Pt,"A",{href:!0,rel:!0});var $r=n(We);Os=l($r,"here"),$r.forEach(o),Ks=l(Pt,"."),Pt.forEach(o),Fo=p(t),Jt=a(t,"P",{});var Vr=n(Jt);ea=l(Vr,"Tips:"),Vr.forEach(o),Yo=p(t),me=a(t,"UL",{});var bs=n(me);Ce=a(bs,"LI",{});var vs=n(Ce);ta=l(vs,"The quickest way to get started with Donut is by checking the "),Be=a(vs,"A",{href:!0,rel:!0});var Wr=n(Be);oa=l(Wr,`tutorial
notebooks`),Wr.forEach(o),sa=l(vs,`, which show how to use the model
at inference time as well as fine-tuning on custom data.`),vs.forEach(o),aa=p(bs),Ne=a(bs,"LI",{});var ws=n(Ne);na=l(ws,"Donut is always used within the "),kt=a(ws,"A",{href:!0});var Cr=n(kt);ra=l(Cr,"VisionEncoderDecoder"),Cr.forEach(o),la=l(ws," framework."),ws.forEach(o),bs.forEach(o),qo=p(t),H=a(t,"H2",{class:!0});var ys=n(H);he=a(ys,"A",{id:!0,class:!0,href:!0});var Br=n(he);eo=a(Br,"SPAN",{});var Nr=n(eo);v(Xe.$$.fragment,Nr),Nr.forEach(o),Br.forEach(o),ia=p(ys),to=a(ys,"SPAN",{});var Xr=n(to);ca=l(Xr,"Inference"),Xr.forEach(o),ys.forEach(o),Ao=p(t),q=a(t,"P",{});var Ft=n(q);da=l(Ft,"Donut\u2019s "),oo=a(Ft,"CODE",{});var Gr=n(oo);pa=l(Gr,"VisionEncoderDecoder"),Gr.forEach(o),ma=l(Ft,` model accepts images as input and makes use of
`),It=a(Ft,"A",{href:!0});var Sr=n(It);ha=l(Sr,"generate()"),Sr.forEach(o),ua=l(Ft," to autoregressively generate text given the input image."),Ft.forEach(o),Lo=p(t),I=a(t,"P",{});var E=n(I);fa=l(E,"The "),Ut=a(E,"A",{href:!0});var Pr=n(Ut);ga=l(Pr,"DonutImageProcessor"),Pr.forEach(o),_a=l(E,` class is responsible for preprocessing the input image and
[`),so=a(E,"CODE",{});var Fr=n(so);ba=l(Fr,"XLMRobertaTokenizer"),Fr.forEach(o),va=l(E,"/"),ao=a(E,"CODE",{});var Yr=n(ao);wa=l(Yr,"XLMRobertaTokenizerFast"),Yr.forEach(o),ya=l(E,`] decodes the generated target tokens to the target string. The
`),Dt=a(E,"A",{href:!0});var qr=n(Dt);Ma=l(qr,"DonutProcessor"),qr.forEach(o),Ta=l(E," wraps "),zt=a(E,"A",{href:!0});var Ar=n(zt);ja=l(Ar,"DonutImageProcessor"),Ar.forEach(o),Ja=l(E," and ["),no=a(E,"CODE",{});var Lr=n(no);ka=l(Lr,"XLMRobertaTokenizer"),Lr.forEach(o),Ia=l(E,"/"),ro=a(E,"CODE",{});var Hr=n(ro);Ua=l(Hr,"XLMRobertaTokenizerFast"),Hr.forEach(o),Da=l(E,`]
into a single instance to both extract the input features and decode the predicted token ids.`),E.forEach(o),Ho=p(t),xt=a(t,"UL",{});var Qr=n(xt);lo=a(Qr,"LI",{});var Or=n(lo);za=l(Or,"Step-by-step Document Image Classification"),Or.forEach(o),Qr.forEach(o),Qo=p(t),v(Ge.$$.fragment,t),Oo=p(t),Zt=a(t,"UL",{});var Kr=n(Zt);io=a(Kr,"LI",{});var el=n(io);xa=l(el,"Step-by-step Document Parsing"),el.forEach(o),Kr.forEach(o),Ko=p(t),v(Se.$$.fragment,t),es=p(t),Rt=a(t,"UL",{});var tl=n(Rt);co=a(tl,"LI",{});var ol=n(co);Za=l(ol,"Step-by-step Document Visual Question Answering (DocVQA)"),ol.forEach(o),tl.forEach(o),ts=p(t),v(Pe.$$.fragment,t),os=p(t),ue=a(t,"P",{});var Ms=n(ue);Ra=l(Ms,"See the "),Fe=a(Ms,"A",{href:!0,rel:!0});var sl=n(Fe);Ea=l(sl,"model hub"),sl.forEach(o),$a=l(Ms," to look for Donut checkpoints."),Ms.forEach(o),ss=p(t),Q=a(t,"H2",{class:!0});var Ts=n(Q);fe=a(Ts,"A",{id:!0,class:!0,href:!0});var al=n(fe);po=a(al,"SPAN",{});var nl=n(po);v(Ye.$$.fragment,nl),nl.forEach(o),al.forEach(o),Va=p(Ts),mo=a(Ts,"SPAN",{});var rl=n(mo);Wa=l(rl,"Training"),rl.forEach(o),Ts.forEach(o),as=p(t),ge=a(t,"P",{});var js=n(ge);Ca=l(js,"We refer to the "),qe=a(js,"A",{href:!0,rel:!0});var ll=n(qe);Ba=l(ll,"tutorial notebooks"),ll.forEach(o),Na=l(js,"."),js.forEach(o),ns=p(t),O=a(t,"H2",{class:!0});var Js=n(O);_e=a(Js,"A",{id:!0,class:!0,href:!0});var il=n(_e);ho=a(il,"SPAN",{});var cl=n(ho);v(Ae.$$.fragment,cl),cl.forEach(o),il.forEach(o),Xa=p(Js),uo=a(Js,"SPAN",{});var dl=n(uo);Ga=l(dl,"DonutSwinConfig"),dl.forEach(o),Js.forEach(o),rs=p(t),W=a(t,"DIV",{class:!0});var Ze=n(W);v(Le.$$.fragment,Ze),Sa=p(Ze),K=a(Ze,"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(o),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(o),Aa=l(Yt," architecture."),Yt.forEach(o),La=p(Ze),ee=a(Ze,"P",{});var qt=n(ee);Ha=l(qt,"Configuration objects inherit from "),$t=a(qt,"A",{href:!0});var hl=n($t);Qa=l(hl,"PretrainedConfig"),hl.forEach(o),Oa=l(qt,` and can be used to control the model outputs. Read the
documentation from `),Vt=a(qt,"A",{href:!0});var ul=n(Vt);Ka=l(ul,"PretrainedConfig"),ul.forEach(o),en=l(qt," for more information."),qt.forEach(o),tn=p(Ze),v(be.$$.fragment,Ze),Ze.forEach(o),ls=p(t),te=a(t,"H2",{class:!0});var ks=n(te);ve=a(ks,"A",{id:!0,class:!0,href:!0});var fl=n(ve);fo=a(fl,"SPAN",{});var gl=n(fo);v(Qe.$$.fragment,gl),gl.forEach(o),fl.forEach(o),on=p(ks),go=a(ks,"SPAN",{});var _l=n(go);sn=l(_l,"DonutImageProcessor"),_l.forEach(o),ks.forEach(o),is=p(t),G=a(t,"DIV",{class:!0});var At=n(G);v(Oe.$$.fragment,At),an=p(At),_o=a(At,"P",{});var bl=n(_o);nn=l(bl,"Constructs a Donut image processor."),bl.forEach(o),rn=p(At),we=a(At,"DIV",{class:!0});var Is=n(we);v(Ke.$$.fragment,Is),ln=p(Is),bo=a(Is,"P",{});var vl=n(bo);cn=l(vl,"Preprocess an image or batch of images."),vl.forEach(o),Is.forEach(o),At.forEach(o),cs=p(t),oe=a(t,"H2",{class:!0});var Us=n(oe);ye=a(Us,"A",{id:!0,class:!0,href:!0});var wl=n(ye);vo=a(wl,"SPAN",{});var yl=n(vo);v(et.$$.fragment,yl),yl.forEach(o),wl.forEach(o),dn=p(Us),wo=a(Us,"SPAN",{});var Ml=n(wo);pn=l(Ml,"DonutFeatureExtractor"),Ml.forEach(o),Us.forEach(o),ds=p(t),se=a(t,"DIV",{class:!0});var Ds=n(se);v(tt.$$.fragment,Ds),mn=p(Ds),Me=a(Ds,"DIV",{class:!0});var zs=n(Me);v(ot.$$.fragment,zs),hn=p(zs),yo=a(zs,"P",{});var Tl=n(yo);un=l(Tl,"Preprocess an image or a batch of images."),Tl.forEach(o),zs.forEach(o),Ds.forEach(o),ps=p(t),ae=a(t,"H2",{class:!0});var xs=n(ae);Te=a(xs,"A",{id:!0,class:!0,href:!0});var jl=n(Te);Mo=a(jl,"SPAN",{});var Jl=n(Mo);v(st.$$.fragment,Jl),Jl.forEach(o),jl.forEach(o),fn=p(xs),To=a(xs,"SPAN",{});var kl=n(To);gn=l(kl,"DonutProcessor"),kl.forEach(o),xs.forEach(o),ms=p(t),k=a(t,"DIV",{class:!0});var $=n(k);v(at.$$.fragment,$),_n=p($),jo=a($,"P",{});var Il=n(jo);bn=l(Il,`Constructs a Donut processor which wraps a Donut image processor and an XLMRoBERTa tokenizer into a single
processor.`),Il.forEach(o),vn=p($),R=a($,"P",{});var C=n(R);Wt=a(C,"A",{href:!0});var Ul=n(Wt);wn=l(Ul,"DonutProcessor"),Ul.forEach(o),yn=l(C," offers all the functionalities of "),Ct=a(C,"A",{href:!0});var Dl=n(Ct);Mn=l(Dl,"DonutImageProcessor"),Dl.forEach(o),Tn=l(C,` and
[`),Jo=a(C,"CODE",{});var zl=n(Jo);jn=l(zl,"XLMRobertaTokenizer"),zl.forEach(o),Jn=l(C,"/"),ko=a(C,"CODE",{});var xl=n(ko);kn=l(xl,"XLMRobertaTokenizerFast"),xl.forEach(o),In=l(C,"]. See the "),nt=a(C,"A",{href:!0});var Tr=n(nt);Io=a(Tr,"STRONG",{});var Zl=n(Io);Un=l(Zl,"call"),Zl.forEach(o),Dn=l(Tr,"()"),Tr.forEach(o),zn=l(C,` and
`),Bt=a(C,"A",{href:!0});var Rl=n(Bt);xn=l(Rl,"decode()"),Rl.forEach(o),Zn=l(C," for more information."),C.forEach(o),Rn=p($),je=a($,"DIV",{class:!0});var Zs=n(je);v(rt.$$.fragment,Zs),En=p(Zs),S=a(Zs,"P",{});var Re=n(S);$n=l(Re,`When used in normal mode, this method forwards all its arguments to AutoImageProcessor\u2019s
`),Uo=a(Re,"CODE",{});var El=n(Uo);Vn=l(El,"__call__()"),El.forEach(o),Wn=l(Re,` and returns its output. If used in the context
`),Do=a(Re,"CODE",{});var $l=n(Do);Cn=l($l,"as_target_processor()"),$l.forEach(o),Bn=l(Re,` this method forwards all its arguments to DonutTokenizer\u2019s
`),zo=a(Re,"CODE",{});var Vl=n(zo);Nn=l(Vl,"~DonutTokenizer.__call__"),Vl.forEach(o),Xn=l(Re,". Please refer to the doctsring of the above two methods for more information."),Re.forEach(o),Zs.forEach(o),Gn=p($),A=a($,"DIV",{class:!0});var Lt=n(A);v(lt.$$.fragment,Lt),Sn=p(Lt),xo=a(Lt,"P",{});var Wl=n(xo);Pn=l(Wl,"Instantiate a processor associated with a pretrained model."),Wl.forEach(o),Fn=p(Lt),v(Je.$$.fragment,Lt),Lt.forEach(o),Yn=p($),L=a($,"DIV",{class:!0});var Ht=n(L);v(it.$$.fragment,Ht),qn=p(Ht),ct=a(Ht,"P",{});var Rs=n(ct);An=l(Rs,`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Nt=a(Rs,"A",{href:!0});var Cl=n(Nt);Ln=l(Cl,"from_pretrained()"),Cl.forEach(o),Hn=l(Rs," method."),Rs.forEach(o),Qn=p(Ht),v(ke.$$.fragment,Ht),Ht.forEach(o),On=p($),Ie=a($,"DIV",{class:!0});var Es=n(Ie);v(dt.$$.fragment,Es),Kn=p(Es),pt=a(Es,"P",{});var $s=n(pt);er=l($s,"This method forwards all its arguments to DonutTokenizer\u2019s "),Xt=a($s,"A",{href:!0});var Bl=n(Xt);tr=l(Bl,"batch_decode()"),Bl.forEach(o),or=l($s,`. Please refer
to the docstring of this method for more information.`),$s.forEach(o),Es.forEach(o),sr=p($),Ue=a($,"DIV",{class:!0});var Vs=n(Ue);v(mt.$$.fragment,Vs),ar=p(Vs),ht=a(Vs,"P",{});var Ws=n(ht);nr=l(Ws,"This method forwards all its arguments to DonutTokenizer\u2019s "),Gt=a(Ws,"A",{href:!0});var Nl=n(Gt);rr=l(Nl,"decode()"),Nl.forEach(o),lr=l(Ws,`. Please refer to the
docstring of this method for more information.`),Ws.forEach(o),Vs.forEach(o),$.forEach(o),hs=p(t),ne=a(t,"H2",{class:!0});var Cs=n(ne);De=a(Cs,"A",{id:!0,class:!0,href:!0});var Xl=n(De);Zo=a(Xl,"SPAN",{});var Gl=n(Zo);v(ut.$$.fragment,Gl),Gl.forEach(o),Xl.forEach(o),ir=p(Cs),Ro=a(Cs,"SPAN",{});var Sl=n(Ro);cr=l(Sl,"DonutSwinModel"),Sl.forEach(o),Cs.forEach(o),us=p(t),P=a(t,"DIV",{class:!0});var Qt=n(P);v(ft.$$.fragment,Qt),dr=p(Qt),gt=a(Qt,"P",{});var Bs=n(gt);pr=l(Bs,`The bare Donut Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),_t=a(Bs,"A",{href:!0,rel:!0});var Pl=n(_t);mr=l(Pl,"torch.nn.Module"),Pl.forEach(o),hr=l(Bs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bs.forEach(o),ur=p(Qt),X=a(Qt,"DIV",{class:!0});var Ee=n(X);v(bt.$$.fragment,Ee),fr=p(Ee),re=a(Ee,"P",{});var Ot=n(re);gr=l(Ot,"The "),St=a(Ot,"A",{href:!0});var Fl=n(St);_r=l(Fl,"DonutSwinModel"),Fl.forEach(o),br=l(Ot," forward method, overrides the "),Eo=a(Ot,"CODE",{});var Yl=n(Eo);vr=l(Yl,"__call__"),Yl.forEach(o),wr=l(Ot," special method."),Ot.forEach(o),yr=p(Ee),v(ze.$$.fragment,Ee),Mr=p(Ee),v(xe.$$.fragment,Ee),Ee.forEach(o),Qt.forEach(o),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(x,"class","relative group"),i($e,"href","https://arxiv.org/abs/2111.15664"),i($e,"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(jt,"href","https://arxiv.org/abs/2111.15664"),i(Ve,"href","https://huggingface.co/nielsr"),i(Ve,"rel","nofollow"),i(We,"href","https://github.com/clovaai/donut"),i(We,"rel","nofollow"),i(Be,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Donut"),i(Be,"rel","nofollow"),i(kt,"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(It,"href","/docs/transformers/v4.33.0/en/main_classes/text_generation#transformers.GenerationMixin.generate"),i(Ut,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutImageProcessor"),i(Dt,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutProcessor"),i(zt,"href","/docs/transformers/v4.33.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(Q,"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.33.0/en/model_doc/donut#transformers.DonutSwinModel"),i(He,"href","https://huggingface.co/naver-clova-ix/donut-base"),i(He,"rel","nofollow"),i($t,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(Vt,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(W,"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(G,"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(oe,"class","relative group"),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(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Te,"id","transformers.DonutProcessor"),i(Te,"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(Te,"href","#transformers.DonutProcessor"),i(ae,"class","relative group"),i(Wt,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutProcessor"),i(Ct,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutImageProcessor"),i(nt,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutProcessor.__call__"),i(Bt,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutProcessor.decode"),i(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Nt,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutProcessor.from_pretrained"),i(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Xt,"href","/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),i(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Gt,"href","/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.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(k,"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(St,"href","/docs/transformers/v4.33.0/en/model_doc/donut#transformers.DonutSwinModel"),i(X,"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,j),w(h,j,null),e(f,_),e(f,z),e(z,V),m(t,U,c),m(t,x,c),e(x,D),e(D,Z),w(F,Z,null),e(x,yt),e(x,ie),e(ie,Ns),m(t,Bo,c),m(t,ce,c),e(ce,Xs),e(ce,$e),e($e,Gs),e(ce,Ss),m(t,No,c),m(t,Mt,c),e(Mt,Ps),m(t,Xo,c),m(t,Tt,c),e(Tt,Kt),e(Kt,Fs),m(t,Go,c),m(t,de,c),m(t,So,c),m(t,pe,c),e(pe,Ys),e(pe,jt),e(jt,qs),e(pe,As),m(t,Po,c),m(t,Y,c),e(Y,Ls),e(Y,Ve),e(Ve,Hs),e(Y,Qs),e(Y,We),e(We,Os),e(Y,Ks),m(t,Fo,c),m(t,Jt,c),e(Jt,ea),m(t,Yo,c),m(t,me,c),e(me,Ce),e(Ce,ta),e(Ce,Be),e(Be,oa),e(Ce,sa),e(me,aa),e(me,Ne),e(Ne,na),e(Ne,kt),e(kt,ra),e(Ne,la),m(t,qo,c),m(t,H,c),e(H,he),e(he,eo),w(Xe,eo,null),e(H,ia),e(H,to),e(to,ca),m(t,Ao,c),m(t,q,c),e(q,da),e(q,oo),e(oo,pa),e(q,ma),e(q,It),e(It,ha),e(q,ua),m(t,Lo,c),m(t,I,c),e(I,fa),e(I,Ut),e(Ut,ga),e(I,_a),e(I,so),e(so,ba),e(I,va),e(I,ao),e(ao,wa),e(I,ya),e(I,Dt),e(Dt,Ma),e(I,Ta),e(I,zt),e(zt,ja),e(I,Ja),e(I,no),e(no,ka),e(I,Ia),e(I,ro),e(ro,Ua),e(I,Da),m(t,Ho,c),m(t,xt,c),e(xt,lo),e(lo,za),m(t,Qo,c),w(Ge,t,c),m(t,Oo,c),m(t,Zt,c),e(Zt,io),e(io,xa),m(t,Ko,c),w(Se,t,c),m(t,es,c),m(t,Rt,c),e(Rt,co),e(co,Za),m(t,ts,c),w(Pe,t,c),m(t,os,c),m(t,ue,c),e(ue,Ra),e(ue,Fe),e(Fe,Ea),e(ue,$a),m(t,ss,c),m(t,Q,c),e(Q,fe),e(fe,po),w(Ye,po,null),e(Q,Va),e(Q,mo),e(mo,Wa),m(t,as,c),m(t,ge,c),e(ge,Ca),e(ge,qe),e(qe,Ba),e(ge,Na),m(t,ns,c),m(t,O,c),e(O,_e),e(_e,ho),w(Ae,ho,null),e(O,Xa),e(O,uo),e(uo,Ga),m(t,rs,c),m(t,W,c),w(Le,W,null),e(W,Sa),e(W,K),e(K,Pa),e(K,Et),e(Et,Fa),e(K,Ya),e(K,He),e(He,qa),e(K,Aa),e(W,La),e(W,ee),e(ee,Ha),e(ee,$t),e($t,Qa),e(ee,Oa),e(ee,Vt),e(Vt,Ka),e(ee,en),e(W,tn),w(be,W,null),m(t,ls,c),m(t,te,c),e(te,ve),e(ve,fo),w(Qe,fo,null),e(te,on),e(te,go),e(go,sn),m(t,is,c),m(t,G,c),w(Oe,G,null),e(G,an),e(G,_o),e(_o,nn),e(G,rn),e(G,we),w(Ke,we,null),e(we,ln),e(we,bo),e(bo,cn),m(t,cs,c),m(t,oe,c),e(oe,ye),e(ye,vo),w(et,vo,null),e(oe,dn),e(oe,wo),e(wo,pn),m(t,ds,c),m(t,se,c),w(tt,se,null),e(se,mn),e(se,Me),w(ot,Me,null),e(Me,hn),e(Me,yo),e(yo,un),m(t,ps,c),m(t,ae,c),e(ae,Te),e(Te,Mo),w(st,Mo,null),e(ae,fn),e(ae,To),e(To,gn),m(t,ms,c),m(t,k,c),w(at,k,null),e(k,_n),e(k,jo),e(jo,bn),e(k,vn),e(k,R),e(R,Wt),e(Wt,wn),e(R,yn),e(R,Ct),e(Ct,Mn),e(R,Tn),e(R,Jo),e(Jo,jn),e(R,Jn),e(R,ko),e(ko,kn),e(R,In),e(R,nt),e(nt,Io),e(Io,Un),e(nt,Dn),e(R,zn),e(R,Bt),e(Bt,xn),e(R,Zn),e(k,Rn),e(k,je),w(rt,je,null),e(je,En),e(je,S),e(S,$n),e(S,Uo),e(Uo,Vn),e(S,Wn),e(S,Do),e(Do,Cn),e(S,Bn),e(S,zo),e(zo,Nn),e(S,Xn),e(k,Gn),e(k,A),w(lt,A,null),e(A,Sn),e(A,xo),e(xo,Pn),e(A,Fn),w(Je,A,null),e(k,Yn),e(k,L),w(it,L,null),e(L,qn),e(L,ct),e(ct,An),e(ct,Nt),e(Nt,Ln),e(ct,Hn),e(L,Qn),w(ke,L,null),e(k,On),e(k,Ie),w(dt,Ie,null),e(Ie,Kn),e(Ie,pt),e(pt,er),e(pt,Xt),e(Xt,tr),e(pt,or),e(k,sr),e(k,Ue),w(mt,Ue,null),e(Ue,ar),e(Ue,ht),e(ht,nr),e(ht,Gt),e(Gt,rr),e(ht,lr),m(t,hs,c),m(t,ne,c),e(ne,De),e(De,Zo),w(ut,Zo,null),e(ne,ir),e(ne,Ro),e(Ro,cr),m(t,us,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,X),w(bt,X,null),e(X,fr),e(X,re),e(re,gr),e(re,St),e(St,_r),e(re,br),e(re,Eo),e(Eo,vr),e(re,wr),e(X,yr),w(ze,X,null),e(X,Mr),w(xe,X,null),fs=!0},p(t,[c]){const vt={};c&2&&(vt.$$scope={dirty:c,ctx:t}),be.$set(vt);const $o={};c&2&&($o.$$scope={dirty:c,ctx:t}),Je.$set($o);const Vo={};c&2&&(Vo.$$scope={dirty:c,ctx:t}),ke.$set(Vo);const Wo={};c&2&&(Wo.$$scope={dirty:c,ctx:t}),ze.$set(Wo);const wt={};c&2&&(wt.$$scope={dirty:c,ctx:t}),xe.$set(wt)},i(t){fs||(y(h.$$.fragment,t),y(F.$$.fragment,t),y(Xe.$$.fragment,t),y(Ge.$$.fragment,t),y(Se.$$.fragment,t),y(Pe.$$.fragment,t),y(Ye.$$.fragment,t),y(Ae.$$.fragment,t),y(Le.$$.fragment,t),y(be.$$.fragment,t),y(Qe.$$.fragment,t),y(Oe.$$.fragment,t),y(Ke.$$.fragment,t),y(et.$$.fragment,t),y(tt.$$.fragment,t),y(ot.$$.fragment,t),y(st.$$.fragment,t),y(at.$$.fragment,t),y(rt.$$.fragment,t),y(lt.$$.fragment,t),y(Je.$$.fragment,t),y(it.$$.fragment,t),y(ke.$$.fragment,t),y(dt.$$.fragment,t),y(mt.$$.fragment,t),y(ut.$$.fragment,t),y(ft.$$.fragment,t),y(bt.$$.fragment,t),y(ze.$$.fragment,t),y(xe.$$.fragment,t),fs=!0)},o(t){M(h.$$.fragment,t),M(F.$$.fragment,t),M(Xe.$$.fragment,t),M(Ge.$$.fragment,t),M(Se.$$.fragment,t),M(Pe.$$.fragment,t),M(Ye.$$.fragment,t),M(Ae.$$.fragment,t),M(Le.$$.fragment,t),M(be.$$.fragment,t),M(Qe.$$.fragment,t),M(Oe.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(tt.$$.fragment,t),M(ot.$$.fragment,t),M(st.$$.fragment,t),M(at.$$.fragment,t),M(rt.$$.fragment,t),M(lt.$$.fragment,t),M(Je.$$.fragment,t),M(it.$$.fragment,t),M(ke.$$.fragment,t),M(dt.$$.fragment,t),M(mt.$$.fragment,t),M(ut.$$.fragment,t),M(ft.$$.fragment,t),M(bt.$$.fragment,t),M(ze.$$.fragment,t),M(xe.$$.fragment,t),fs=!1},d(t){o(u),t&&o(J),t&&o(f),T(h),t&&o(U),t&&o(x),T(F),t&&o(Bo),t&&o(ce),t&&o(No),t&&o(Mt),t&&o(Xo),t&&o(Tt),t&&o(Go),t&&o(de),t&&o(So),t&&o(pe),t&&o(Po),t&&o(Y),t&&o(Fo),t&&o(Jt),t&&o(Yo),t&&o(me),t&&o(qo),t&&o(H),T(Xe),t&&o(Ao),t&&o(q),t&&o(Lo),t&&o(I),t&&o(Ho),t&&o(xt),t&&o(Qo),T(Ge,t),t&&o(Oo),t&&o(Zt),t&&o(Ko),T(Se,t),t&&o(es),t&&o(Rt),t&&o(ts),T(Pe,t),t&&o(os),t&&o(ue),t&&o(ss),t&&o(Q),T(Ye),t&&o(as),t&&o(ge),t&&o(ns),t&&o(O),T(Ae),t&&o(rs),t&&o(W),T(Le),T(be),t&&o(ls),t&&o(te),T(Qe),t&&o(is),t&&o(G),T(Oe),T(Ke),t&&o(cs),t&&o(oe),T(et),t&&o(ds),t&&o(se),T(tt),T(ot),t&&o(ps),t&&o(ae),T(st),t&&o(ms),t&&o(k),T(at),T(rt),T(lt),T(Je),T(it),T(ke),T(dt),T(mt),t&&o(hs),t&&o(ne),T(ut),t&&o(us),t&&o(P),T(ft),T(bt),T(ze),T(xe)}}}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(N){return ei(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fi extends Ll{constructor(u){super();Hl(this,u,ii,ri,Ql,{})}}export{fi as default,li as metadata};
