import{s as kr,f as Cr,o as jr,n as Dt}from"../chunks/scheduler.9bc65507.js";import{S as Pr,i as Sr,g as r,s as a,u as f,A as zr,h as n,f as t,c as l,j as m,v as u,y as h,k as c,o,a as i,w as _,d as v,t as b,x as M}from"../chunks/index.78c82d43.js";import{T as xr}from"../chunks/Tip.87d55b76.js";import{D as I}from"../chunks/Docstring.f3d04bd2.js";import{C as So}from"../chunks/CodeBlock.48618ec2.js";import{I as ae}from"../chunks/IconCopyLink.bedaa44d.js";import{E as $r}from"../chunks/ExampleCodeBlock.872b014d.js";function Ur(z){let d,y="Example:",g,T,w;return T=new So({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1ncHN0ckNvbmZpZyUyQyUyME1ncHN0ckZvclNjZW5lVGV4dFJlY29nbml0aW9uJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME1ncHN0ciUyMG1ncC1zdHItYmFzZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBNZ3BzdHJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwbWdwLXN0ci1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBNZ3BzdHJGb3JTY2VuZVRleHRSZWNvZ25pdGlvbihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MgpstrConfig, MgpstrForSceneTextRecognition

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Mgpstr mgp-str-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = MgpstrConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the mgp-str-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MgpstrForSceneTextRecognition(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(){d=r("p"),d.textContent=y,g=a(),f(T.$$.fragment)},l(p){d=n(p,"P",{"data-svelte-h":!0}),h(d)!=="svelte-11lpom8"&&(d.textContent=y),g=l(p),u(T.$$.fragment,p)},m(p,$){i(p,d,$),i(p,g,$),_(T,p,$),w=!0},p:Dt,i(p){w||(v(T.$$.fragment,p),w=!0)},o(p){b(T.$$.fragment,p),w=!1},d(p){p&&(t(d),t(g)),M(T,p)}}}function Jr(z){let d,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=r("p"),d.innerHTML=y},l(g){d=n(g,"P",{"data-svelte-h":!0}),h(d)!=="svelte-fincs2"&&(d.innerHTML=y)},m(g,T){i(g,d,T)},p:Dt,d(g){g&&t(d)}}}function Rr(z){let d,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=r("p"),d.innerHTML=y},l(g){d=n(g,"P",{"data-svelte-h":!0}),h(d)!=="svelte-fincs2"&&(d.innerHTML=y)},m(g,T){i(g,d,T)},p:Dt,d(g){g&&t(d)}}}function Ir(z){let d,y="Example:",g,T,w;return T=new So({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBNZ3BzdHJQcm9jZXNzb3IlMkMlMEElMjAlMjAlMjAlMjBNZ3BzdHJGb3JTY2VuZVRleHRSZWNvZ25pdGlvbiUyQyUwQSklMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQSUyMyUyMGxvYWQlMjBpbWFnZSUyMGZyb20lMjB0aGUlMjBJSUlULTVrJTIwZGF0YXNldCUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaS5wb3N0aW1nLmNjJTJGWkt3TGcyR3clMkYzNjctMTQucG5nJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyME1ncHN0clByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyYWxpYmFiYS1kYW1vJTJGbWdwLXN0ci1iYXNlJTIyKSUwQXBpeGVsX3ZhbHVlcyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnBpeGVsX3ZhbHVlcyUwQSUwQW1vZGVsJTIwJTNEJTIwTWdwc3RyRm9yU2NlbmVUZXh0UmVjb2duaXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmFsaWJhYmEtZGFtbyUyRm1ncC1zdHItYmFzZSUyMiklMEElMEElMjMlMjBpbmZlcmVuY2UlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwocGl4ZWxfdmFsdWVzKSUwQW91dF9zdHJzJTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShvdXRwdXRzLmxvZ2l0cyklMEFvdXRfc3RycyU1QiUyMmdlbmVyYXRlZF90ZXh0JTIyJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    MgpstrProcessor,
<span class="hljs-meta">... </span>    MgpstrForSceneTextRecognition,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load image from the IIIT-5k dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://i.postimg.cc/ZKwLg2Gw/367-14.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = MgpstrProcessor.from_pretrained(<span class="hljs-string">&quot;alibaba-damo/mgp-str-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>model = MgpstrForSceneTextRecognition.from_pretrained(<span class="hljs-string">&quot;alibaba-damo/mgp-str-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>out_strs = processor.batch_decode(outputs.logits)
<span class="hljs-meta">&gt;&gt;&gt; </span>out_strs[<span class="hljs-string">&quot;generated_text&quot;</span>]
<span class="hljs-string">&#x27;[&quot;ticket&quot;]&#x27;</span>`}}),{c(){d=r("p"),d.textContent=y,g=a(),f(T.$$.fragment)},l(p){d=n(p,"P",{"data-svelte-h":!0}),h(d)!=="svelte-11lpom8"&&(d.textContent=y),g=l(p),u(T.$$.fragment,p)},m(p,$){i(p,d,$),i(p,g,$),_(T,p,$),w=!0},p:Dt,i(p){w||(v(T.$$.fragment,p),w=!0)},o(p){b(T.$$.fragment,p),w=!1},d(p){p&&(t(d),t(g)),M(T,p)}}}function Zr(z){let d,y,g,T,w,p,$,le,Ot,Ne,zo="MGP-STR",bt,Z,F,ct,ie,Kt,He,Uo="Overview",Mt,ce,Jo='The MGP-STR model was proposed in <a href="https://arxiv.org/abs/2209.03592" rel="nofollow">Multi-Granularity Prediction for Scene Text Recognition</a> by Peng Wang, Cheng Da, and Cong Yao. MGP-STR is a conceptually <strong>simple</strong> yet <strong>powerful</strong> vision Scene Text Recognition (STR) model, which is built upon the <a href="vit">Vision Transformer (ViT)</a>. To integrate linguistic knowledge, Multi-Granularity Prediction (MGP) strategy is proposed to inject information from the language modality into the model in an implicit way.',Tt,de,Ro="The abstract from the paper is the following:",wt,pe,Io="<em>Scene text recognition (STR) has been an active research topic in computer vision for years. To tackle this challenging problem, numerous innovative methods have been successively proposed and incorporating linguistic knowledge into STR models has recently become a prominent trend. In this work, we first draw inspiration from the recent progress in Vision Transformer (ViT) to construct a conceptually simple yet powerful vision STR model, which is built upon ViT and outperforms previous state-of-the-art models for scene text recognition, including both pure vision models and language-augmented methods. To integrate linguistic knowledge, we further propose a Multi-Granularity Prediction strategy to inject information from the language modality into the model in an implicit way, i.e. , subword representations (BPE and WordPiece) widely-used in NLP are introduced into the output space, in addition to the conventional character level representation, while no independent language model (LM) is adopted. The resultant algorithm (termed MGP-STR) is able to push the performance envelop of STR to an even higher level. Specifically, it achieves an average recognition accuracy of 93.35% on standard benchmarks.</em>",yt,E,Zo,xt,me,No='MGP-STR architecture. Taken from the <a href="https://arxiv.org/abs/2209.03592">original paper</a>.',$t,he,Ho="Tips:",kt,ge,Wo='<li>MGP-STR is trained on two synthetic datasets <a href="(http://www.robots.ox.ac.uk/~vgg/data/text/)">MJSynth</a> (MJ) and SynthText(<a href="http://www.robots.ox.ac.uk/~vgg/data/scenetext/" rel="nofollow">http://www.robots.ox.ac.uk/~vgg/data/scenetext/</a>) (ST) without fine-tuning on other datasets. It achieves state-of-the-art results on six standard Latin scene text benchmarks, including 3 regular text datasets (IC13, SVT, IIIT) and 3 irregular ones (IC15, SVTP, CUTE).</li> <li>This model was contributed by <a href="https://huggingface.co/yuekun" rel="nofollow">yuekun</a>. The original code can be found <a href="https://github.com/AlibabaResearch/AdvancedLiterateMachinery/tree/main/OCR/MGP-STR" rel="nofollow">here</a>.</li>',Ct,N,B,dt,fe,eo,We,Vo="Inference",jt,ue,Go=`<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrModel">MgpstrModel</a> accepts images as input and generates three types of predictions, which represent textual information at different granularities.
The three types of predictions are fused to give the final prediction result.`,Pt,_e,Lo=`The <a href="/docs/transformers/v4.33.3/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> class is responsible for preprocessing the input image and
<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrTokenizer">MgpstrTokenizer</a> decodes the generated character tokens to the target string. The
<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrProcessor">MgpstrProcessor</a> wraps <a href="/docs/transformers/v4.33.3/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> and <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrTokenizer">MgpstrTokenizer</a>
into a single instance to both extract the input features and decode the predicted token ids.`,St,ve,Fo="<li>Step-by-step Optical Character Recognition (OCR)</li>",zt,be,Ut,H,A,pt,Me,to,Ve,Eo="MgpstrConfig",Jt,k,Te,oo,Ge,Bo=`This is the configuration class to store the configuration of an <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrModel">MgpstrModel</a>. It is used to instantiate an
MGP-STR 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 MGP-STR
<a href="https://huggingface.co/alibaba-damo/mgp-str-base" rel="nofollow">alibaba-damo/mgp-str-base</a> architecture.`,ro,Le,Ao=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,no,Q,Rt,W,X,mt,we,so,Fe,Qo="MgpstrTokenizer",It,C,ye,ao,Ee,Xo="Construct a MGP-STR char tokenizer.",lo,Be,qo=`This tokenizer inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,io,Ae,xe,Zt,V,q,ht,$e,co,Qe,Yo="MgpstrProcessor",Nt,x,ke,po,Xe,Do="Constructs a MGP-STR processor which wraps an image processor and MGP-STR tokenizers into a single",mo,qe,Oo=`<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrProcessor">MgpstrProcessor</a> offers all the functionalities of <code>ViTImageProcessor</code>] and <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrTokenizer">MgpstrTokenizer</a>. See the
<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrProcessor.__call__"><strong>call</strong>()</a> and <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrProcessor.batch_decode">batch_decode()</a> for more information.`,ho,Y,Ce,go,Ye,Ko=`When used in normal mode, this method forwards all its arguments to ViTImageProcessor’s
<a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__"><strong>call</strong>()</a> and returns its output. This method also forwards the <code>text</code> and <code>kwargs</code>
arguments to MgpstrTokenizer’s <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__"><strong>call</strong>()</a> if <code>text</code> is not <code>None</code> to encode the text. Please
refer to the doctsring of the above methods for more information.`,fo,U,je,uo,De,er="Convert a list of lists of token ids into a list of strings by calling decode.",_o,Oe,tr=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,Ht,G,D,gt,Pe,vo,Ke,or="MgpstrModel",Wt,S,Se,bo,et,rr=`The bare MGP-STR Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Mo,J,ze,To,tt,nr='The <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrModel">MgpstrModel</a> forward method, overrides the <code>__call__</code> special method.',wo,O,Vt,L,K,ft,Ue,yo,ot,sr="MgpstrForSceneTextRecognition",Gt,j,Je,xo,rt,ar=`MGP-STR Model transformer with three classification heads on top (three A^3 modules and three linear layer on top
of the transformer encoder output) for scene text recognition (STR) .`,$o,nt,lr=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,ko,P,Re,Co,st,ir='The <a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrForSceneTextRecognition">MgpstrForSceneTextRecognition</a> forward method, overrides the <code>__call__</code> special method.',jo,ee,Po,te,Lt,ut,Ft;return le=new ae({}),ie=new ae({}),fe=new ae({}),be=new So({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1ncHN0clByb2Nlc3NvciUyQyUyME1ncHN0ckZvclNjZW5lVGV4dFJlY29nbml0aW9uJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBNZ3BzdHJQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCdhbGliYWJhLWRhbW8lMkZtZ3Atc3RyLWJhc2UnKSUwQW1vZGVsJTIwJTNEJTIwTWdwc3RyRm9yU2NlbmVUZXh0UmVjb2duaXRpb24uZnJvbV9wcmV0cmFpbmVkKCdhbGliYWJhLWRhbW8lMkZtZ3Atc3RyLWJhc2UnKSUwQSUwQSUyMyUyMGxvYWQlMjBpbWFnZSUyMGZyb20lMjB0aGUlMjBJSUlULTVrJTIwZGF0YXNldCUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaS5wb3N0aW1nLmNjJTJGWkt3TGcyR3clMkYzNjctMTQucG5nJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQXBpeGVsX3ZhbHVlcyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnBpeGVsX3ZhbHVlcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChwaXhlbF92YWx1ZXMpJTBBJTBBZ2VuZXJhdGVkX3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKG91dHB1dHMubG9naXRzKSU1QidnZW5lcmF0ZWRfdGV4dCclNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MgpstrProcessor, MgpstrForSceneTextRecognition
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = MgpstrProcessor.from_pretrained(<span class="hljs-string">&#x27;alibaba-damo/mgp-str-base&#x27;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MgpstrForSceneTextRecognition.from_pretrained(<span class="hljs-string">&#x27;alibaba-damo/mgp-str-base&#x27;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load image from the IIIT-5k dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://i.postimg.cc/ZKwLg2Gw/367-14.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(outputs.logits)[<span class="hljs-string">&#x27;generated_text&#x27;</span>]`}}),Me=new ae({}),Te=new I({props:{name:"class transformers.MgpstrConfig",anchor:"transformers.MgpstrConfig",parameters:[{name:"image_size",val:" = [32, 128]"},{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"max_token_length",val:" = 27"},{name:"num_character_labels",val:" = 38"},{name:"num_bpe_labels",val:" = 50257"},{name:"num_wordpiece_labels",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"mlp_ratio",val:" = 4.0"},{name:"qkv_bias",val:" = True"},{name:"distilled",val:" = False"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"drop_rate",val:" = 0.0"},{name:"attn_drop_rate",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.0"},{name:"output_a3_attentions",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MgpstrConfig.image_size",description:`<strong>image_size</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[32, 128]</code>) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.MgpstrConfig.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.MgpstrConfig.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.MgpstrConfig.max_token_length",description:`<strong>max_token_length</strong> (<code>int</code>, <em>optional</em>, defaults to 27) &#x2014;
The max number of output tokens.`,name:"max_token_length"},{anchor:"transformers.MgpstrConfig.num_character_labels",description:`<strong>num_character_labels</strong> (<code>int</code>, <em>optional</em>, defaults to 38) &#x2014;
The number of classes for character head .`,name:"num_character_labels"},{anchor:"transformers.MgpstrConfig.num_bpe_labels",description:`<strong>num_bpe_labels</strong> (<code>int</code>, <em>optional</em>, defaults to 50257) &#x2014;
The number of classes for bpe head .`,name:"num_bpe_labels"},{anchor:"transformers.MgpstrConfig.num_wordpiece_labels",description:`<strong>num_wordpiece_labels</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
The number of classes for wordpiece head .`,name:"num_wordpiece_labels"},{anchor:"transformers.MgpstrConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
The embedding dimension.`,name:"hidden_size"},{anchor:"transformers.MgpstrConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.MgpstrConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.MgpstrConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
The ratio of mlp hidden dim to embedding dim.`,name:"mlp_ratio"},{anchor:"transformers.MgpstrConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.MgpstrConfig.distilled",description:`<strong>distilled</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Model includes a distillation token and head as in DeiT models.`,name:"distilled"},{anchor:"transformers.MgpstrConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.MgpstrConfig.drop_rate",description:`<strong>drop_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder.`,name:"drop_rate"},{anchor:"transformers.MgpstrConfig.attn_drop_rate",description:`<strong>attn_drop_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attn_drop_rate"},{anchor:"transformers.MgpstrConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The stochastic depth rate.`,name:"drop_path_rate"},{anchor:"transformers.MgpstrConfig.output_a3_attentions",description:`<strong>output_a3_attentions</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should returns A^3 module attentions.`,name:"output_a3_attentions"},{anchor:"transformers.MgpstrConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/configuration_mgp_str.py#L28"}}),Q=new $r({props:{anchor:"transformers.MgpstrConfig.example",$$slots:{default:[Ur]},$$scope:{ctx:z}}}),we=new ae({}),ye=new I({props:{name:"class transformers.MgpstrTokenizer",anchor:"transformers.MgpstrTokenizer",parameters:[{name:"vocab_file",val:""},{name:"unk_token",val:" = '[GO]'"},{name:"bos_token",val:" = '[GO]'"},{name:"eos_token",val:" = '[s]'"},{name:"pad_token",val:" = '[GO]'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MgpstrTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.MgpstrTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[GO]&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.MgpstrTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[GO]&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.MgpstrTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[s]&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.MgpstrTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code> or <code>tokenizers.AddedToken</code>, <em>optional</em>, , defaults to <code>&quot;[GO]&quot;</code>) &#x2014;
A special token used to make arrays of tokens the same size for batching purpose. Will then be ignored by
attention mechanisms or loss computation.`,name:"pad_token"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/tokenization_mgp_str.py#L38"}}),xe=new I({props:{name:"save_vocabulary",anchor:"transformers.MgpstrTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/tokenization_mgp_str.py#L99"}}),$e=new ae({}),ke=new I({props:{name:"class transformers.MgpstrProcessor",anchor:"transformers.MgpstrProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MgpstrProcessor.image_processor",description:`<strong>image_processor</strong> (<code>ViTImageProcessor</code>) &#x2014;
An instance of <code>ViTImageProcessor</code>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.MgpstrProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrTokenizer">MgpstrTokenizer</a>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/processing_mgp_str.py#L39"}}),Ce=new I({props:{name:"__call__",anchor:"transformers.MgpstrProcessor.__call__",parameters:[{name:"text",val:" = None"},{name:"images",val:" = None"},{name:"return_tensors",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/processing_mgp_str.py#L78"}}),je=new I({props:{name:"batch_decode",anchor:"transformers.MgpstrProcessor.batch_decode",parameters:[{name:"sequences",val:""}],parametersDescription:[{anchor:"transformers.MgpstrProcessor.batch_decode.sequences",description:`<strong>sequences</strong> (<code>torch.Tensor</code>) &#x2014;
List of tokenized input ids.`,name:"sequences"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/processing_mgp_str.py#L101",returnDescription:`
<p>Dictionary of all the outputs of the decoded results.
generated_text (<code>List[str]</code>): The final results after fusion of char, bpe, and wp. scores
(<code>List[float]</code>): The final scores after fusion of char, bpe, and wp. char_preds (<code>List[str]</code>): The list
of character decoded sentences. bpe_preds (<code>List[str]</code>): The list of bpe decoded sentences. wp_preds
(<code>List[str]</code>): The list of wp decoded sentences.</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),Pe=new ae({}),Se=new I({props:{name:"class transformers.MgpstrModel",anchor:"transformers.MgpstrModel",parameters:[{name:"config",val:": MgpstrConfig"}],parametersDescription:[{anchor:"transformers.MgpstrModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrConfig">MgpstrConfig</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.3/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.3/src/transformers/models/mgp_str/modeling_mgp_str.py#L372"}}),ze=new I({props:{name:"forward",anchor:"transformers.MgpstrModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{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.MgpstrModel.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.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.MgpstrModel.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.MgpstrModel.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.MgpstrModel.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.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/modeling_mgp_str.py#L382"}}),O=new xr({props:{$$slots:{default:[Jr]},$$scope:{ctx:z}}}),Ue=new ae({}),Je=new I({props:{name:"class transformers.MgpstrForSceneTextRecognition",anchor:"transformers.MgpstrForSceneTextRecognition",parameters:[{name:"config",val:": MgpstrConfig"}],parametersDescription:[{anchor:"transformers.MgpstrForSceneTextRecognition.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/mgp-str#transformers.MgpstrConfig">MgpstrConfig</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.3/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.3/src/transformers/models/mgp_str/modeling_mgp_str.py#L424"}}),Re=new I({props:{name:"forward",anchor:"transformers.MgpstrForSceneTextRecognition.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_a3_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.MgpstrForSceneTextRecognition.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.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.MgpstrForSceneTextRecognition.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.MgpstrForSceneTextRecognition.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.MgpstrForSceneTextRecognition.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.3/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MgpstrForSceneTextRecognition.forward.output_a3_attentions",description:`<strong>output_a3_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of a3 modules. See <code>a3_attentions</code> under returned tensors
for more detail.`,name:"output_a3_attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/mgp_str/modeling_mgp_str.py#L442",returnDescription:`
<p>A <code>transformers.models.mgp_str.modeling_mgp_str.MgpstrModelOutput</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 (<code>&lt;class 'transformers.models.mgp_str.configuration_mgp_str.MgpstrConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>tuple(torch.FloatTensor)</code> of shape <code>(batch_size, config.num_character_labels)</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of character of shape <code>(batch_size, config.max_token_length, config.num_character_labels)</code>, + one for the output of bpe of shape <code>(batch_size, config.max_token_length, config.num_bpe_labels)</code>, + one for the output of wordpiece of shape <code>(batch_size, config.max_token_length, config.num_wordpiece_labels)</code>) .</p>
<p>Classification scores (before SoftMax) of character, bpe and wordpiece.</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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) 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 optional 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>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, config.max_token_length, 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>a3_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_a3_attentions=True</code> is passed or when <code>config.output_a3_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the attention of character, + one for the attention of bpe<code>, + one for the attention of wordpiece) of shape </code>(batch_size, config.max_token_length, sequence_length)\`.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.mgp_str.modeling_mgp_str.MgpstrModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new xr({props:{$$slots:{default:[Rr]},$$scope:{ctx:z}}}),te=new $r({props:{anchor:"transformers.MgpstrForSceneTextRecognition.forward.example",$$slots:{default:[Ir]},$$scope:{ctx:z}}}),{c(){d=r("meta"),y=a(),g=r("p"),T=a(),w=r("h1"),p=r("a"),$=r("span"),f(le.$$.fragment),Ot=a(),Ne=r("span"),Ne.textContent=zo,bt=a(),Z=r("h2"),F=r("a"),ct=r("span"),f(ie.$$.fragment),Kt=a(),He=r("span"),He.textContent=Uo,Mt=a(),ce=r("p"),ce.innerHTML=Jo,Tt=a(),de=r("p"),de.textContent=Ro,wt=a(),pe=r("p"),pe.innerHTML=Io,yt=a(),E=r("img"),xt=a(),me=r("small"),me.innerHTML=No,$t=a(),he=r("p"),he.textContent=Ho,kt=a(),ge=r("ul"),ge.innerHTML=Wo,Ct=a(),N=r("h2"),B=r("a"),dt=r("span"),f(fe.$$.fragment),eo=a(),We=r("span"),We.textContent=Vo,jt=a(),ue=r("p"),ue.innerHTML=Go,Pt=a(),_e=r("p"),_e.innerHTML=Lo,St=a(),ve=r("ul"),ve.innerHTML=Fo,zt=a(),f(be.$$.fragment),Ut=a(),H=r("h2"),A=r("a"),pt=r("span"),f(Me.$$.fragment),to=a(),Ve=r("span"),Ve.textContent=Eo,Jt=a(),k=r("div"),f(Te.$$.fragment),oo=a(),Ge=r("p"),Ge.innerHTML=Bo,ro=a(),Le=r("p"),Le.innerHTML=Ao,no=a(),f(Q.$$.fragment),Rt=a(),W=r("h2"),X=r("a"),mt=r("span"),f(we.$$.fragment),so=a(),Fe=r("span"),Fe.textContent=Qo,It=a(),C=r("div"),f(ye.$$.fragment),ao=a(),Ee=r("p"),Ee.textContent=Xo,lo=a(),Be=r("p"),Be.innerHTML=qo,io=a(),Ae=r("div"),f(xe.$$.fragment),Zt=a(),V=r("h2"),q=r("a"),ht=r("span"),f($e.$$.fragment),co=a(),Qe=r("span"),Qe.textContent=Yo,Nt=a(),x=r("div"),f(ke.$$.fragment),po=a(),Xe=r("p"),Xe.textContent=Do,mo=a(),qe=r("p"),qe.innerHTML=Oo,ho=a(),Y=r("div"),f(Ce.$$.fragment),go=a(),Ye=r("p"),Ye.innerHTML=Ko,fo=a(),U=r("div"),f(je.$$.fragment),uo=a(),De=r("p"),De.textContent=er,_o=a(),Oe=r("p"),Oe.innerHTML=tr,Ht=a(),G=r("h2"),D=r("a"),gt=r("span"),f(Pe.$$.fragment),vo=a(),Ke=r("span"),Ke.textContent=or,Wt=a(),S=r("div"),f(Se.$$.fragment),bo=a(),et=r("p"),et.innerHTML=rr,Mo=a(),J=r("div"),f(ze.$$.fragment),To=a(),tt=r("p"),tt.innerHTML=nr,wo=a(),f(O.$$.fragment),Vt=a(),L=r("h2"),K=r("a"),ft=r("span"),f(Ue.$$.fragment),yo=a(),ot=r("span"),ot.textContent=sr,Gt=a(),j=r("div"),f(Je.$$.fragment),xo=a(),rt=r("p"),rt.textContent=ar,$o=a(),nt=r("p"),nt.innerHTML=lr,ko=a(),P=r("div"),f(Re.$$.fragment),Co=a(),st=r("p"),st.innerHTML=ir,jo=a(),f(ee.$$.fragment),Po=a(),f(te.$$.fragment),Lt=a(),ut=r("p"),this.h()},l(e){const s=zr("svelte-1phssyn",document.head);d=n(s,"META",{name:!0,content:!0}),s.forEach(t),y=l(e),g=n(e,"P",{}),m(g).forEach(t),T=l(e),w=n(e,"H1",{class:!0});var Ie=m(w);p=n(Ie,"A",{id:!0,class:!0,href:!0});var _t=m(p);$=n(_t,"SPAN",{});var vt=m($);u(le.$$.fragment,vt),vt.forEach(t),_t.forEach(t),Ot=l(Ie),Ne=n(Ie,"SPAN",{"data-svelte-h":!0}),h(Ne)!=="svelte-ip9zkh"&&(Ne.textContent=zo),Ie.forEach(t),bt=l(e),Z=n(e,"H2",{class:!0});var Ze=m(Z);F=n(Ze,"A",{id:!0,class:!0,href:!0});var cr=m(F);ct=n(cr,"SPAN",{});var dr=m(ct);u(ie.$$.fragment,dr),dr.forEach(t),cr.forEach(t),Kt=l(Ze),He=n(Ze,"SPAN",{"data-svelte-h":!0}),h(He)!=="svelte-1jsw1pg"&&(He.textContent=Uo),Ze.forEach(t),Mt=l(e),ce=n(e,"P",{"data-svelte-h":!0}),h(ce)!=="svelte-1ojswm7"&&(ce.innerHTML=Jo),Tt=l(e),de=n(e,"P",{"data-svelte-h":!0}),h(de)!=="svelte-vfdo9a"&&(de.textContent=Ro),wt=l(e),pe=n(e,"P",{"data-svelte-h":!0}),h(pe)!=="svelte-1h9gawp"&&(pe.innerHTML=Io),yt=l(e),E=n(e,"IMG",{src:!0,alt:!0,width:!0}),xt=l(e),me=n(e,"SMALL",{"data-svelte-h":!0}),h(me)!=="svelte-13av33i"&&(me.innerHTML=No),$t=l(e),he=n(e,"P",{"data-svelte-h":!0}),h(he)!=="svelte-axv494"&&(he.textContent=Ho),kt=l(e),ge=n(e,"UL",{"data-svelte-h":!0}),h(ge)!=="svelte-6tfeht"&&(ge.innerHTML=Wo),Ct=l(e),N=n(e,"H2",{class:!0});var Et=m(N);B=n(Et,"A",{id:!0,class:!0,href:!0});var pr=m(B);dt=n(pr,"SPAN",{});var mr=m(dt);u(fe.$$.fragment,mr),mr.forEach(t),pr.forEach(t),eo=l(Et),We=n(Et,"SPAN",{"data-svelte-h":!0}),h(We)!=="svelte-199uz7g"&&(We.textContent=Vo),Et.forEach(t),jt=l(e),ue=n(e,"P",{"data-svelte-h":!0}),h(ue)!=="svelte-y15e1e"&&(ue.innerHTML=Go),Pt=l(e),_e=n(e,"P",{"data-svelte-h":!0}),h(_e)!=="svelte-6rwmwp"&&(_e.innerHTML=Lo),St=l(e),ve=n(e,"UL",{"data-svelte-h":!0}),h(ve)!=="svelte-1noonjl"&&(ve.innerHTML=Fo),zt=l(e),u(be.$$.fragment,e),Ut=l(e),H=n(e,"H2",{class:!0});var Bt=m(H);A=n(Bt,"A",{id:!0,class:!0,href:!0});var hr=m(A);pt=n(hr,"SPAN",{});var gr=m(pt);u(Me.$$.fragment,gr),gr.forEach(t),hr.forEach(t),to=l(Bt),Ve=n(Bt,"SPAN",{"data-svelte-h":!0}),h(Ve)!=="svelte-1is095e"&&(Ve.textContent=Eo),Bt.forEach(t),Jt=l(e),k=n(e,"DIV",{class:!0});var oe=m(k);u(Te.$$.fragment,oe),oo=l(oe),Ge=n(oe,"P",{"data-svelte-h":!0}),h(Ge)!=="svelte-1xbrw49"&&(Ge.innerHTML=Bo),ro=l(oe),Le=n(oe,"P",{"data-svelte-h":!0}),h(Le)!=="svelte-cfh5wl"&&(Le.innerHTML=Ao),no=l(oe),u(Q.$$.fragment,oe),oe.forEach(t),Rt=l(e),W=n(e,"H2",{class:!0});var At=m(W);X=n(At,"A",{id:!0,class:!0,href:!0});var fr=m(X);mt=n(fr,"SPAN",{});var ur=m(mt);u(we.$$.fragment,ur),ur.forEach(t),fr.forEach(t),so=l(At),Fe=n(At,"SPAN",{"data-svelte-h":!0}),h(Fe)!=="svelte-p5hogn"&&(Fe.textContent=Qo),At.forEach(t),It=l(e),C=n(e,"DIV",{class:!0});var re=m(C);u(ye.$$.fragment,re),ao=l(re),Ee=n(re,"P",{"data-svelte-h":!0}),h(Ee)!=="svelte-17nyefl"&&(Ee.textContent=Xo),lo=l(re),Be=n(re,"P",{"data-svelte-h":!0}),h(Be)!=="svelte-14xlfoy"&&(Be.innerHTML=qo),io=l(re),Ae=n(re,"DIV",{class:!0});var _r=m(Ae);u(xe.$$.fragment,_r),_r.forEach(t),re.forEach(t),Zt=l(e),V=n(e,"H2",{class:!0});var Qt=m(V);q=n(Qt,"A",{id:!0,class:!0,href:!0});var vr=m(q);ht=n(vr,"SPAN",{});var br=m(ht);u($e.$$.fragment,br),br.forEach(t),vr.forEach(t),co=l(Qt),Qe=n(Qt,"SPAN",{"data-svelte-h":!0}),h(Qe)!=="svelte-w96xtq"&&(Qe.textContent=Yo),Qt.forEach(t),Nt=l(e),x=n(e,"DIV",{class:!0});var R=m(x);u(ke.$$.fragment,R),po=l(R),Xe=n(R,"P",{"data-svelte-h":!0}),h(Xe)!=="svelte-yv8e6v"&&(Xe.textContent=Do),mo=l(R),qe=n(R,"P",{"data-svelte-h":!0}),h(qe)!=="svelte-uv39ac"&&(qe.innerHTML=Oo),ho=l(R),Y=n(R,"DIV",{class:!0});var Xt=m(Y);u(Ce.$$.fragment,Xt),go=l(Xt),Ye=n(Xt,"P",{"data-svelte-h":!0}),h(Ye)!=="svelte-17j649n"&&(Ye.innerHTML=Ko),Xt.forEach(t),fo=l(R),U=n(R,"DIV",{class:!0});var at=m(U);u(je.$$.fragment,at),uo=l(at),De=n(at,"P",{"data-svelte-h":!0}),h(De)!=="svelte-1deng2j"&&(De.textContent=er),_o=l(at),Oe=n(at,"P",{"data-svelte-h":!0}),h(Oe)!=="svelte-8bl32v"&&(Oe.innerHTML=tr),at.forEach(t),R.forEach(t),Ht=l(e),G=n(e,"H2",{class:!0});var qt=m(G);D=n(qt,"A",{id:!0,class:!0,href:!0});var Mr=m(D);gt=n(Mr,"SPAN",{});var Tr=m(gt);u(Pe.$$.fragment,Tr),Tr.forEach(t),Mr.forEach(t),vo=l(qt),Ke=n(qt,"SPAN",{"data-svelte-h":!0}),h(Ke)!=="svelte-1y9gjp3"&&(Ke.textContent=or),qt.forEach(t),Wt=l(e),S=n(e,"DIV",{class:!0});var lt=m(S);u(Se.$$.fragment,lt),bo=l(lt),et=n(lt,"P",{"data-svelte-h":!0}),h(et)!=="svelte-1j8rfbn"&&(et.innerHTML=rr),Mo=l(lt),J=n(lt,"DIV",{class:!0});var it=m(J);u(ze.$$.fragment,it),To=l(it),tt=n(it,"P",{"data-svelte-h":!0}),h(tt)!=="svelte-g7ac3f"&&(tt.innerHTML=nr),wo=l(it),u(O.$$.fragment,it),it.forEach(t),lt.forEach(t),Vt=l(e),L=n(e,"H2",{class:!0});var Yt=m(L);K=n(Yt,"A",{id:!0,class:!0,href:!0});var wr=m(K);ft=n(wr,"SPAN",{});var yr=m(ft);u(Ue.$$.fragment,yr),yr.forEach(t),wr.forEach(t),yo=l(Yt),ot=n(Yt,"SPAN",{"data-svelte-h":!0}),h(ot)!=="svelte-1hi9mh3"&&(ot.textContent=sr),Yt.forEach(t),Gt=l(e),j=n(e,"DIV",{class:!0});var ne=m(j);u(Je.$$.fragment,ne),xo=l(ne),rt=n(ne,"P",{"data-svelte-h":!0}),h(rt)!=="svelte-10o23m7"&&(rt.textContent=ar),$o=l(ne),nt=n(ne,"P",{"data-svelte-h":!0}),h(nt)!=="svelte-1gjh92c"&&(nt.innerHTML=lr),ko=l(ne),P=n(ne,"DIV",{class:!0});var se=m(P);u(Re.$$.fragment,se),Co=l(se),st=n(se,"P",{"data-svelte-h":!0}),h(st)!=="svelte-1mepmw3"&&(st.innerHTML=ir),jo=l(se),u(ee.$$.fragment,se),Po=l(se),u(te.$$.fragment,se),se.forEach(t),ne.forEach(t),Lt=l(e),ut=n(e,"P",{}),m(ut).forEach(t),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Nr)),c(p,"id","mgpstr"),c(p,"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"),c(p,"href","#mgpstr"),c(w,"class","relative group"),c(F,"id","overview"),c(F,"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"),c(F,"href","#overview"),c(Z,"class","relative group"),Cr(E.src,Zo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mgp_str_architecture.png")||c(E,"src",Zo),c(E,"alt","drawing"),c(E,"width","600"),c(B,"id","inference"),c(B,"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"),c(B,"href","#inference"),c(N,"class","relative group"),c(A,"id","transformers.MgpstrConfig"),c(A,"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"),c(A,"href","#transformers.MgpstrConfig"),c(H,"class","relative group"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(X,"id","transformers.MgpstrTokenizer"),c(X,"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"),c(X,"href","#transformers.MgpstrTokenizer"),c(W,"class","relative group"),c(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(q,"id","transformers.MgpstrProcessor"),c(q,"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"),c(q,"href","#transformers.MgpstrProcessor"),c(V,"class","relative group"),c(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(D,"id","transformers.MgpstrModel"),c(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"),c(D,"href","#transformers.MgpstrModel"),c(G,"class","relative group"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(K,"id","transformers.MgpstrForSceneTextRecognition"),c(K,"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"),c(K,"href","#transformers.MgpstrForSceneTextRecognition"),c(L,"class","relative group"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,s){o(document.head,d),i(e,y,s),i(e,g,s),i(e,T,s),i(e,w,s),o(w,p),o(p,$),_(le,$,null),o(w,Ot),o(w,Ne),i(e,bt,s),i(e,Z,s),o(Z,F),o(F,ct),_(ie,ct,null),o(Z,Kt),o(Z,He),i(e,Mt,s),i(e,ce,s),i(e,Tt,s),i(e,de,s),i(e,wt,s),i(e,pe,s),i(e,yt,s),i(e,E,s),i(e,xt,s),i(e,me,s),i(e,$t,s),i(e,he,s),i(e,kt,s),i(e,ge,s),i(e,Ct,s),i(e,N,s),o(N,B),o(B,dt),_(fe,dt,null),o(N,eo),o(N,We),i(e,jt,s),i(e,ue,s),i(e,Pt,s),i(e,_e,s),i(e,St,s),i(e,ve,s),i(e,zt,s),_(be,e,s),i(e,Ut,s),i(e,H,s),o(H,A),o(A,pt),_(Me,pt,null),o(H,to),o(H,Ve),i(e,Jt,s),i(e,k,s),_(Te,k,null),o(k,oo),o(k,Ge),o(k,ro),o(k,Le),o(k,no),_(Q,k,null),i(e,Rt,s),i(e,W,s),o(W,X),o(X,mt),_(we,mt,null),o(W,so),o(W,Fe),i(e,It,s),i(e,C,s),_(ye,C,null),o(C,ao),o(C,Ee),o(C,lo),o(C,Be),o(C,io),o(C,Ae),_(xe,Ae,null),i(e,Zt,s),i(e,V,s),o(V,q),o(q,ht),_($e,ht,null),o(V,co),o(V,Qe),i(e,Nt,s),i(e,x,s),_(ke,x,null),o(x,po),o(x,Xe),o(x,mo),o(x,qe),o(x,ho),o(x,Y),_(Ce,Y,null),o(Y,go),o(Y,Ye),o(x,fo),o(x,U),_(je,U,null),o(U,uo),o(U,De),o(U,_o),o(U,Oe),i(e,Ht,s),i(e,G,s),o(G,D),o(D,gt),_(Pe,gt,null),o(G,vo),o(G,Ke),i(e,Wt,s),i(e,S,s),_(Se,S,null),o(S,bo),o(S,et),o(S,Mo),o(S,J),_(ze,J,null),o(J,To),o(J,tt),o(J,wo),_(O,J,null),i(e,Vt,s),i(e,L,s),o(L,K),o(K,ft),_(Ue,ft,null),o(L,yo),o(L,ot),i(e,Gt,s),i(e,j,s),_(Je,j,null),o(j,xo),o(j,rt),o(j,$o),o(j,nt),o(j,ko),o(j,P),_(Re,P,null),o(P,Co),o(P,st),o(P,jo),_(ee,P,null),o(P,Po),_(te,P,null),i(e,Lt,s),i(e,ut,s),Ft=!0},p(e,[s]){const Ie={};s&2&&(Ie.$$scope={dirty:s,ctx:e}),Q.$set(Ie);const _t={};s&2&&(_t.$$scope={dirty:s,ctx:e}),O.$set(_t);const vt={};s&2&&(vt.$$scope={dirty:s,ctx:e}),ee.$set(vt);const Ze={};s&2&&(Ze.$$scope={dirty:s,ctx:e}),te.$set(Ze)},i(e){Ft||(v(le.$$.fragment,e),v(ie.$$.fragment,e),v(fe.$$.fragment,e),v(be.$$.fragment,e),v(Me.$$.fragment,e),v(Te.$$.fragment,e),v(Q.$$.fragment,e),v(we.$$.fragment,e),v(ye.$$.fragment,e),v(xe.$$.fragment,e),v($e.$$.fragment,e),v(ke.$$.fragment,e),v(Ce.$$.fragment,e),v(je.$$.fragment,e),v(Pe.$$.fragment,e),v(Se.$$.fragment,e),v(ze.$$.fragment,e),v(O.$$.fragment,e),v(Ue.$$.fragment,e),v(Je.$$.fragment,e),v(Re.$$.fragment,e),v(ee.$$.fragment,e),v(te.$$.fragment,e),Ft=!0)},o(e){b(le.$$.fragment,e),b(ie.$$.fragment,e),b(fe.$$.fragment,e),b(be.$$.fragment,e),b(Me.$$.fragment,e),b(Te.$$.fragment,e),b(Q.$$.fragment,e),b(we.$$.fragment,e),b(ye.$$.fragment,e),b(xe.$$.fragment,e),b($e.$$.fragment,e),b(ke.$$.fragment,e),b(Ce.$$.fragment,e),b(je.$$.fragment,e),b(Pe.$$.fragment,e),b(Se.$$.fragment,e),b(ze.$$.fragment,e),b(O.$$.fragment,e),b(Ue.$$.fragment,e),b(Je.$$.fragment,e),b(Re.$$.fragment,e),b(ee.$$.fragment,e),b(te.$$.fragment,e),Ft=!1},d(e){e&&(t(y),t(g),t(T),t(w),t(bt),t(Z),t(Mt),t(ce),t(Tt),t(de),t(wt),t(pe),t(yt),t(E),t(xt),t(me),t($t),t(he),t(kt),t(ge),t(Ct),t(N),t(jt),t(ue),t(Pt),t(_e),t(St),t(ve),t(zt),t(Ut),t(H),t(Jt),t(k),t(Rt),t(W),t(It),t(C),t(Zt),t(V),t(Nt),t(x),t(Ht),t(G),t(Wt),t(S),t(Vt),t(L),t(Gt),t(j),t(Lt),t(ut)),t(d),M(le),M(ie),M(fe),M(be,e),M(Me),M(Te),M(Q),M(we),M(ye),M(xe),M($e),M(ke),M(Ce),M(je),M(Pe),M(Se),M(ze),M(O),M(Ue),M(Je),M(Re),M(ee),M(te)}}}const Nr={local:"mgpstr",sections:[{local:"overview",title:"Overview"},{local:"inference",title:"Inference"},{local:"transformers.MgpstrConfig",title:"MgpstrConfig"},{local:"transformers.MgpstrTokenizer",title:"MgpstrTokenizer"},{local:"transformers.MgpstrProcessor",title:"MgpstrProcessor"},{local:"transformers.MgpstrModel",title:"MgpstrModel"},{local:"transformers.MgpstrForSceneTextRecognition",title:"MgpstrForSceneTextRecognition"}],title:"MGP-STR"};function Hr(z){return jr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ar extends Pr{constructor(d){super(),Sr(this,d,Hr,Zr,kr,{})}}export{Ar as component};
