import{S as li,i as ci,s as di,e as o,k as d,w as v,t as n,M as pi,c as s,d as r,m as p,a as i,x as b,h as a,b as l,N as mi,G as e,g as m,y as M,q as T,o as w,B as y,v as hi,L as ii}from"../../chunks/vendor-hf-doc-builder.js";import{T as ni}from"../../chunks/Tip-hf-doc-builder.js";import{D as L}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Wn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as $e}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ai}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fi(Z){let f,k,u,g,$;return g=new Wn({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(){f=o("p"),k=n("Example:"),u=d(),v(g.$$.fragment)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Example:"),_.forEach(r),u=p(h),b(g.$$.fragment,h)},m(h,_){m(h,f,_),e(f,k),m(h,u,_),M(g,h,_),$=!0},p:ii,i(h){$||(T(g.$$.fragment,h),$=!0)},o(h){w(g.$$.fragment,h),$=!1},d(h){h&&r(f),h&&r(u),y(g,h)}}}function gi(Z){let f,k,u,g,$;return{c(){f=o("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),g=n("Module"),$=n(`
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){f=s(h,"P",{});var _=i(f);k=a(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(_,"CODE",{});var J=i(u);g=a(J,"Module"),J.forEach(r),$=a(_,`
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(r)},m(h,_){m(h,f,_),e(f,k),e(f,u),e(u,g),e(f,$)},d(h){h&&r(f)}}}function ui(Z){let f,k,u,g,$;return{c(){f=o("p"),k=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),g=n("Module"),$=n(`
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){f=s(h,"P",{});var _=i(f);k=a(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(_,"CODE",{});var J=i(u);g=a(J,"Module"),J.forEach(r),$=a(_,`
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(r)},m(h,_){m(h,f,_),e(f,k),e(f,u),e(u,g),e(f,$)},d(h){h&&r(f)}}}function _i(Z){let f,k,u,g,$;return g=new Wn({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(){f=o("p"),k=n("Example:"),u=d(),v(g.$$.fragment)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Example:"),_.forEach(r),u=p(h),b(g.$$.fragment,h)},m(h,_){m(h,f,_),e(f,k),m(h,u,_),M(g,h,_),$=!0},p:ii,i(h){$||(T(g.$$.fragment,h),$=!0)},o(h){w(g.$$.fragment,h),$=!1},d(h){h&&r(f),h&&r(u),y(g,h)}}}function vi(Z){let f,k,u,g,$,h,_,J,oo,br,H,ne,Nt,ke,so,Vt,no,Mr,P,ao,xe,io,lo,Zt,co,po,Wt,mo,ho,nt,fo,go,Tr,at,uo,wr,it,At,_o,yr,ae,An,$r,ie,vo,lt,bo,Mo,kr,ct,To,xr,le,Q,wo,dt,yo,$o,Ee,ko,xo,Eo,X,So,Se,Po,Ro,Pe,jo,zo,Er,q,ce,Ft,Re,Uo,Bt,Co,Sr,je,pt,Io,Go,Pr,E,Jo,mt,No,Vo,ht,Zo,Wo,ft,Ao,Fo,gt,Bo,Lo,ut,Ho,Qo,Rr,_t,Lt,Xo,jr,ze,zr,Y,de,Ht,Ue,qo,Qt,Yo,Ur,z,Ce,Do,D,Oo,vt,Ko,es,Ie,ts,rs,os,O,ss,bt,ns,as,Mt,is,ls,cs,pe,Cr,K,me,Xt,Ge,ds,qt,ps,Ir,U,Je,ms,Yt,hs,fs,Ne,gs,Tt,us,_s,vs,wt,Ve,Gr,ee,he,Dt,Ze,bs,Ot,Ms,Jr,S,We,Ts,Kt,ws,ys,R,yt,$s,ks,er,xs,Es,$t,Ss,Ps,Ae,tr,Rs,js,zs,kt,Us,Cs,Is,fe,Fe,Gs,x,Js,Be,rr,Ns,Vs,Zs,or,Ws,As,sr,Fs,Bs,Le,nr,Ls,Hs,Qs,ar,Xs,qs,ir,Ys,Ds,Os,W,He,Ks,lr,en,tn,Qe,rn,xt,on,sn,Nr,te,ge,cr,Xe,nn,dr,an,Vr,N,qe,ln,Ye,cn,De,dn,pn,mn,A,Oe,hn,re,fn,Et,gn,un,pr,_n,vn,bn,ue,Zr,oe,_e,mr,Ke,Mn,hr,Tn,Wr,C,et,wn,fr,yn,$n,tt,kn,rt,xn,En,Sn,I,ot,Pn,se,Rn,St,jn,zn,gr,Un,Cn,In,ve,Gn,be,Ar;return h=new $e({}),ke=new $e({}),Re=new $e({}),ze=new Wn({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>]`}}),Ue=new $e({}),Ce=new L({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/main/src/transformers/models/mgp_str/configuration_mgp_str.py#L28"}}),pe=new ai({props:{anchor:"transformers.MgpstrConfig.example",$$slots:{default:[fi]},$$scope:{ctx:Z}}}),Ge=new $e({}),Je=new L({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/main/src/transformers/models/mgp_str/tokenization_mgp_str.py#L38"}}),Ve=new L({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/main/src/transformers/models/mgp_str/tokenization_mgp_str.py#L99"}}),Ze=new $e({}),We=new L({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/main/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/main/src/transformers/models/mgp_str/processing_mgp_str.py#L39"}}),Fe=new L({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/main/src/transformers/models/mgp_str/processing_mgp_str.py#L78"}}),He=new L({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/main/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>
`}}),Xe=new $e({}),qe=new L({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/main/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/main/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/main/src/transformers/models/mgp_str/modeling_mgp_str.py#L372"}}),Oe=new L({props:{name:"forward",anchor:"transformers.MgpstrModel.forward",parameters:[{name:"pixel_values",val:""},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = 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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mgp_str/modeling_mgp_str.py#L382"}}),ue=new ni({props:{$$slots:{default:[gi]},$$scope:{ctx:Z}}}),Ke=new $e({}),et=new L({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/main/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/main/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/main/src/transformers/models/mgp_str/modeling_mgp_str.py#L418"}}),ot=new L({props:{name:"forward",anchor:"transformers.MgpstrForSceneTextRecognition.forward",parameters:[{name:"pixel_values",val:""},{name:"output_attentions",val:" = None"},{name:"output_a3_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = 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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__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/main/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/main/src/transformers/models/mgp_str/modeling_mgp_str.py#L436",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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>
`}}),ve=new ni({props:{$$slots:{default:[ui]},$$scope:{ctx:Z}}}),be=new ai({props:{anchor:"transformers.MgpstrForSceneTextRecognition.forward.example",$$slots:{default:[_i]},$$scope:{ctx:Z}}}),{c(){f=o("meta"),k=d(),u=o("h1"),g=o("a"),$=o("span"),v(h.$$.fragment),_=d(),J=o("span"),oo=n("MGP-STR"),br=d(),H=o("h2"),ne=o("a"),Nt=o("span"),v(ke.$$.fragment),so=d(),Vt=o("span"),no=n("Overview"),Mr=d(),P=o("p"),ao=n("The MGP-STR model was proposed in "),xe=o("a"),io=n("Multi-Granularity Prediction for Scene Text Recognition"),lo=n(" by Peng Wang, Cheng Da, and Cong Yao. MGP-STR is a conceptually "),Zt=o("strong"),co=n("simple"),po=n(" yet "),Wt=o("strong"),mo=n("powerful"),ho=n(" vision Scene Text Recognition (STR) model, which is built upon the "),nt=o("a"),fo=n("Vision Transformer (ViT)"),go=n(". 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."),Tr=d(),at=o("p"),uo=n("The abstract from the paper is the following:"),wr=d(),it=o("p"),At=o("em"),_o=n("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."),yr=d(),ae=o("img"),$r=d(),ie=o("small"),vo=n("MGP-STR architecture. Taken from the "),lt=o("a"),bo=n("original paper"),Mo=n("."),kr=d(),ct=o("p"),To=n("Tips:"),xr=d(),le=o("ul"),Q=o("li"),wo=n("MGP-STR is trained on two synthetic datasets "),dt=o("a"),yo=n("MJSynth"),$o=n(" (MJ) and SynthText("),Ee=o("a"),ko=n("http://www.robots.ox.ac.uk/~vgg/data/scenetext/"),xo=n(") (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)."),Eo=d(),X=o("li"),So=n("This model was contributed by "),Se=o("a"),Po=n("yuekun"),Ro=n(". The original code can be found "),Pe=o("a"),jo=n("here"),zo=n("."),Er=d(),q=o("h2"),ce=o("a"),Ft=o("span"),v(Re.$$.fragment),Uo=d(),Bt=o("span"),Co=n("Inference"),Sr=d(),je=o("p"),pt=o("a"),Io=n("MgpstrModel"),Go=n(` 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.`),Pr=d(),E=o("p"),Jo=n("The "),mt=o("a"),No=n("ViTImageProcessor"),Vo=n(` class is responsible for preprocessing the input image and
`),ht=o("a"),Zo=n("MgpstrTokenizer"),Wo=n(` decodes the generated character tokens to the target string. The
`),ft=o("a"),Ao=n("MgpstrProcessor"),Fo=n(" wraps "),gt=o("a"),Bo=n("ViTImageProcessor"),Lo=n(" and "),ut=o("a"),Ho=n("MgpstrTokenizer"),Qo=n(`
into a single instance to both extract the input features and decode the predicted token ids.`),Rr=d(),_t=o("ul"),Lt=o("li"),Xo=n("Step-by-step Optical Character Recognition (OCR)"),jr=d(),v(ze.$$.fragment),zr=d(),Y=o("h2"),de=o("a"),Ht=o("span"),v(Ue.$$.fragment),qo=d(),Qt=o("span"),Yo=n("MgpstrConfig"),Ur=d(),z=o("div"),v(Ce.$$.fragment),Do=d(),D=o("p"),Oo=n("This is the configuration class to store the configuration of an "),vt=o("a"),Ko=n("MgpstrModel"),es=n(`. 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
`),Ie=o("a"),ts=n("alibaba-damo/mgp-str-base"),rs=n(" architecture."),os=d(),O=o("p"),ss=n("Configuration objects inherit from "),bt=o("a"),ns=n("PretrainedConfig"),as=n(` and can be used to control the model outputs. Read the
documentation from `),Mt=o("a"),is=n("PretrainedConfig"),ls=n(" for more information."),cs=d(),v(pe.$$.fragment),Cr=d(),K=o("h2"),me=o("a"),Xt=o("span"),v(Ge.$$.fragment),ds=d(),qt=o("span"),ps=n("MgpstrTokenizer"),Ir=d(),U=o("div"),v(Je.$$.fragment),ms=d(),Yt=o("p"),hs=n("Construct a MGP-STR char tokenizer."),fs=d(),Ne=o("p"),gs=n("This tokenizer inherits from "),Tt=o("a"),us=n("PreTrainedTokenizer"),_s=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),vs=d(),wt=o("div"),v(Ve.$$.fragment),Gr=d(),ee=o("h2"),he=o("a"),Dt=o("span"),v(Ze.$$.fragment),bs=d(),Ot=o("span"),Ms=n("MgpstrProcessor"),Jr=d(),S=o("div"),v(We.$$.fragment),Ts=d(),Kt=o("p"),ws=n("Constructs a MGP-STR processor which wraps an image processor and MGP-STR tokenizers into a single"),ys=d(),R=o("p"),yt=o("a"),$s=n("MgpstrProcessor"),ks=n(" offers all the functionalities of "),er=o("code"),xs=n("ViTImageProcessor"),Es=n("] and "),$t=o("a"),Ss=n("MgpstrTokenizer"),Ps=n(`. See the
`),Ae=o("a"),tr=o("strong"),Rs=n("call"),js=n("()"),zs=n(" and "),kt=o("a"),Us=n("batch_decode()"),Cs=n(" for more information."),Is=d(),fe=o("div"),v(Fe.$$.fragment),Gs=d(),x=o("p"),Js=n(`When used in normal mode, this method forwards all its arguments to ViTImageProcessor\u2019s
`),Be=o("a"),rr=o("strong"),Ns=n("call"),Vs=n("()"),Zs=n(" and returns its output. This method also forwards the "),or=o("code"),Ws=n("text"),As=n(" and "),sr=o("code"),Fs=n("kwargs"),Bs=n(`
arguments to MgpstrTokenizer\u2019s `),Le=o("a"),nr=o("strong"),Ls=n("call"),Hs=n("()"),Qs=n(" if "),ar=o("code"),Xs=n("text"),qs=n(" is not "),ir=o("code"),Ys=n("None"),Ds=n(` to encode the text. Please
refer to the doctsring of the above methods for more information.`),Os=d(),W=o("div"),v(He.$$.fragment),Ks=d(),lr=o("p"),en=n("Convert a list of lists of token ids into a list of strings by calling decode."),tn=d(),Qe=o("p"),rn=n("This method forwards all its arguments to PreTrainedTokenizer\u2019s "),xt=o("a"),on=n("batch_decode()"),sn=n(`. Please
refer to the docstring of this method for more information.`),Nr=d(),te=o("h2"),ge=o("a"),cr=o("span"),v(Xe.$$.fragment),nn=d(),dr=o("span"),an=n("MgpstrModel"),Vr=d(),N=o("div"),v(qe.$$.fragment),ln=d(),Ye=o("p"),cn=n(`The bare MGP-STR Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),De=o("a"),dn=n("torch.nn.Module"),pn=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),mn=d(),A=o("div"),v(Oe.$$.fragment),hn=d(),re=o("p"),fn=n("The "),Et=o("a"),gn=n("MgpstrModel"),un=n(" forward method, overrides the "),pr=o("code"),_n=n("__call__"),vn=n(" special method."),bn=d(),v(ue.$$.fragment),Zr=d(),oe=o("h2"),_e=o("a"),mr=o("span"),v(Ke.$$.fragment),Mn=d(),hr=o("span"),Tn=n("MgpstrForSceneTextRecognition"),Wr=d(),C=o("div"),v(et.$$.fragment),wn=d(),fr=o("p"),yn=n(`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) .`),$n=d(),tt=o("p"),kn=n("This model is a PyTorch "),rt=o("a"),xn=n("torch.nn.Module"),En=n(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Sn=d(),I=o("div"),v(ot.$$.fragment),Pn=d(),se=o("p"),Rn=n("The "),St=o("a"),jn=n("MgpstrForSceneTextRecognition"),zn=n(" forward method, overrides the "),gr=o("code"),Un=n("__call__"),Cn=n(" special method."),In=d(),v(ve.$$.fragment),Gn=d(),v(be.$$.fragment),this.h()},l(t){const c=pi('[data-svelte="svelte-1phssyn"]',document.head);f=s(c,"META",{name:!0,content:!0}),c.forEach(r),k=p(t),u=s(t,"H1",{class:!0});var st=i(u);g=s(st,"A",{id:!0,class:!0,href:!0});var ur=i(g);$=s(ur,"SPAN",{});var _r=i($);b(h.$$.fragment,_r),_r.forEach(r),ur.forEach(r),_=p(st),J=s(st,"SPAN",{});var vr=i(J);oo=a(vr,"MGP-STR"),vr.forEach(r),st.forEach(r),br=p(t),H=s(t,"H2",{class:!0});var Fr=i(H);ne=s(Fr,"A",{id:!0,class:!0,href:!0});var Fn=i(ne);Nt=s(Fn,"SPAN",{});var Bn=i(Nt);b(ke.$$.fragment,Bn),Bn.forEach(r),Fn.forEach(r),so=p(Fr),Vt=s(Fr,"SPAN",{});var Ln=i(Vt);no=a(Ln,"Overview"),Ln.forEach(r),Fr.forEach(r),Mr=p(t),P=s(t,"P",{});var F=i(P);ao=a(F,"The MGP-STR model was proposed in "),xe=s(F,"A",{href:!0,rel:!0});var Hn=i(xe);io=a(Hn,"Multi-Granularity Prediction for Scene Text Recognition"),Hn.forEach(r),lo=a(F," by Peng Wang, Cheng Da, and Cong Yao. MGP-STR is a conceptually "),Zt=s(F,"STRONG",{});var Qn=i(Zt);co=a(Qn,"simple"),Qn.forEach(r),po=a(F," yet "),Wt=s(F,"STRONG",{});var Xn=i(Wt);mo=a(Xn,"powerful"),Xn.forEach(r),ho=a(F," vision Scene Text Recognition (STR) model, which is built upon the "),nt=s(F,"A",{href:!0});var qn=i(nt);fo=a(qn,"Vision Transformer (ViT)"),qn.forEach(r),go=a(F,". 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."),F.forEach(r),Tr=p(t),at=s(t,"P",{});var Yn=i(at);uo=a(Yn,"The abstract from the paper is the following:"),Yn.forEach(r),wr=p(t),it=s(t,"P",{});var Dn=i(it);At=s(Dn,"EM",{});var On=i(At);_o=a(On,"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."),On.forEach(r),Dn.forEach(r),yr=p(t),ae=s(t,"IMG",{src:!0,alt:!0,width:!0}),$r=p(t),ie=s(t,"SMALL",{});var Br=i(ie);vo=a(Br,"MGP-STR architecture. Taken from the "),lt=s(Br,"A",{href:!0});var Kn=i(lt);bo=a(Kn,"original paper"),Kn.forEach(r),Mo=a(Br,"."),Br.forEach(r),kr=p(t),ct=s(t,"P",{});var ea=i(ct);To=a(ea,"Tips:"),ea.forEach(r),xr=p(t),le=s(t,"UL",{});var Lr=i(le);Q=s(Lr,"LI",{});var Pt=i(Q);wo=a(Pt,"MGP-STR is trained on two synthetic datasets "),dt=s(Pt,"A",{href:!0});var ta=i(dt);yo=a(ta,"MJSynth"),ta.forEach(r),$o=a(Pt," (MJ) and SynthText("),Ee=s(Pt,"A",{href:!0,rel:!0});var ra=i(Ee);ko=a(ra,"http://www.robots.ox.ac.uk/~vgg/data/scenetext/"),ra.forEach(r),xo=a(Pt,") (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)."),Pt.forEach(r),Eo=p(Lr),X=s(Lr,"LI",{});var Rt=i(X);So=a(Rt,"This model was contributed by "),Se=s(Rt,"A",{href:!0,rel:!0});var oa=i(Se);Po=a(oa,"yuekun"),oa.forEach(r),Ro=a(Rt,". The original code can be found "),Pe=s(Rt,"A",{href:!0,rel:!0});var sa=i(Pe);jo=a(sa,"here"),sa.forEach(r),zo=a(Rt,"."),Rt.forEach(r),Lr.forEach(r),Er=p(t),q=s(t,"H2",{class:!0});var Hr=i(q);ce=s(Hr,"A",{id:!0,class:!0,href:!0});var na=i(ce);Ft=s(na,"SPAN",{});var aa=i(Ft);b(Re.$$.fragment,aa),aa.forEach(r),na.forEach(r),Uo=p(Hr),Bt=s(Hr,"SPAN",{});var ia=i(Bt);Co=a(ia,"Inference"),ia.forEach(r),Hr.forEach(r),Sr=p(t),je=s(t,"P",{});var Jn=i(je);pt=s(Jn,"A",{href:!0});var la=i(pt);Io=a(la,"MgpstrModel"),la.forEach(r),Go=a(Jn,` 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.`),Jn.forEach(r),Pr=p(t),E=s(t,"P",{});var G=i(E);Jo=a(G,"The "),mt=s(G,"A",{href:!0});var ca=i(mt);No=a(ca,"ViTImageProcessor"),ca.forEach(r),Vo=a(G,` class is responsible for preprocessing the input image and
`),ht=s(G,"A",{href:!0});var da=i(ht);Zo=a(da,"MgpstrTokenizer"),da.forEach(r),Wo=a(G,` decodes the generated character tokens to the target string. The
`),ft=s(G,"A",{href:!0});var pa=i(ft);Ao=a(pa,"MgpstrProcessor"),pa.forEach(r),Fo=a(G," wraps "),gt=s(G,"A",{href:!0});var ma=i(gt);Bo=a(ma,"ViTImageProcessor"),ma.forEach(r),Lo=a(G," and "),ut=s(G,"A",{href:!0});var ha=i(ut);Ho=a(ha,"MgpstrTokenizer"),ha.forEach(r),Qo=a(G,`
into a single instance to both extract the input features and decode the predicted token ids.`),G.forEach(r),Rr=p(t),_t=s(t,"UL",{});var fa=i(_t);Lt=s(fa,"LI",{});var ga=i(Lt);Xo=a(ga,"Step-by-step Optical Character Recognition (OCR)"),ga.forEach(r),fa.forEach(r),jr=p(t),b(ze.$$.fragment,t),zr=p(t),Y=s(t,"H2",{class:!0});var Qr=i(Y);de=s(Qr,"A",{id:!0,class:!0,href:!0});var ua=i(de);Ht=s(ua,"SPAN",{});var _a=i(Ht);b(Ue.$$.fragment,_a),_a.forEach(r),ua.forEach(r),qo=p(Qr),Qt=s(Qr,"SPAN",{});var va=i(Qt);Yo=a(va,"MgpstrConfig"),va.forEach(r),Qr.forEach(r),Ur=p(t),z=s(t,"DIV",{class:!0});var Me=i(z);b(Ce.$$.fragment,Me),Do=p(Me),D=s(Me,"P",{});var jt=i(D);Oo=a(jt,"This is the configuration class to store the configuration of an "),vt=s(jt,"A",{href:!0});var ba=i(vt);Ko=a(ba,"MgpstrModel"),ba.forEach(r),es=a(jt,`. 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
`),Ie=s(jt,"A",{href:!0,rel:!0});var Ma=i(Ie);ts=a(Ma,"alibaba-damo/mgp-str-base"),Ma.forEach(r),rs=a(jt," architecture."),jt.forEach(r),os=p(Me),O=s(Me,"P",{});var zt=i(O);ss=a(zt,"Configuration objects inherit from "),bt=s(zt,"A",{href:!0});var Ta=i(bt);ns=a(Ta,"PretrainedConfig"),Ta.forEach(r),as=a(zt,` and can be used to control the model outputs. Read the
documentation from `),Mt=s(zt,"A",{href:!0});var wa=i(Mt);is=a(wa,"PretrainedConfig"),wa.forEach(r),ls=a(zt," for more information."),zt.forEach(r),cs=p(Me),b(pe.$$.fragment,Me),Me.forEach(r),Cr=p(t),K=s(t,"H2",{class:!0});var Xr=i(K);me=s(Xr,"A",{id:!0,class:!0,href:!0});var ya=i(me);Xt=s(ya,"SPAN",{});var $a=i(Xt);b(Ge.$$.fragment,$a),$a.forEach(r),ya.forEach(r),ds=p(Xr),qt=s(Xr,"SPAN",{});var ka=i(qt);ps=a(ka,"MgpstrTokenizer"),ka.forEach(r),Xr.forEach(r),Ir=p(t),U=s(t,"DIV",{class:!0});var Te=i(U);b(Je.$$.fragment,Te),ms=p(Te),Yt=s(Te,"P",{});var xa=i(Yt);hs=a(xa,"Construct a MGP-STR char tokenizer."),xa.forEach(r),fs=p(Te),Ne=s(Te,"P",{});var qr=i(Ne);gs=a(qr,"This tokenizer inherits from "),Tt=s(qr,"A",{href:!0});var Ea=i(Tt);us=a(Ea,"PreTrainedTokenizer"),Ea.forEach(r),_s=a(qr,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),qr.forEach(r),vs=p(Te),wt=s(Te,"DIV",{class:!0});var Sa=i(wt);b(Ve.$$.fragment,Sa),Sa.forEach(r),Te.forEach(r),Gr=p(t),ee=s(t,"H2",{class:!0});var Yr=i(ee);he=s(Yr,"A",{id:!0,class:!0,href:!0});var Pa=i(he);Dt=s(Pa,"SPAN",{});var Ra=i(Dt);b(Ze.$$.fragment,Ra),Ra.forEach(r),Pa.forEach(r),bs=p(Yr),Ot=s(Yr,"SPAN",{});var ja=i(Ot);Ms=a(ja,"MgpstrProcessor"),ja.forEach(r),Yr.forEach(r),Jr=p(t),S=s(t,"DIV",{class:!0});var B=i(S);b(We.$$.fragment,B),Ts=p(B),Kt=s(B,"P",{});var za=i(Kt);ws=a(za,"Constructs a MGP-STR processor which wraps an image processor and MGP-STR tokenizers into a single"),za.forEach(r),ys=p(B),R=s(B,"P",{});var V=i(R);yt=s(V,"A",{href:!0});var Ua=i(yt);$s=a(Ua,"MgpstrProcessor"),Ua.forEach(r),ks=a(V," offers all the functionalities of "),er=s(V,"CODE",{});var Ca=i(er);xs=a(Ca,"ViTImageProcessor"),Ca.forEach(r),Es=a(V,"] and "),$t=s(V,"A",{href:!0});var Ia=i($t);Ss=a(Ia,"MgpstrTokenizer"),Ia.forEach(r),Ps=a(V,`. See the
`),Ae=s(V,"A",{href:!0});var Nn=i(Ae);tr=s(Nn,"STRONG",{});var Ga=i(tr);Rs=a(Ga,"call"),Ga.forEach(r),js=a(Nn,"()"),Nn.forEach(r),zs=a(V," and "),kt=s(V,"A",{href:!0});var Ja=i(kt);Us=a(Ja,"batch_decode()"),Ja.forEach(r),Cs=a(V," for more information."),V.forEach(r),Is=p(B),fe=s(B,"DIV",{class:!0});var Dr=i(fe);b(Fe.$$.fragment,Dr),Gs=p(Dr),x=s(Dr,"P",{});var j=i(x);Js=a(j,`When used in normal mode, this method forwards all its arguments to ViTImageProcessor\u2019s
`),Be=s(j,"A",{href:!0});var Vn=i(Be);rr=s(Vn,"STRONG",{});var Na=i(rr);Ns=a(Na,"call"),Na.forEach(r),Vs=a(Vn,"()"),Vn.forEach(r),Zs=a(j," and returns its output. This method also forwards the "),or=s(j,"CODE",{});var Va=i(or);Ws=a(Va,"text"),Va.forEach(r),As=a(j," and "),sr=s(j,"CODE",{});var Za=i(sr);Fs=a(Za,"kwargs"),Za.forEach(r),Bs=a(j,`
arguments to MgpstrTokenizer\u2019s `),Le=s(j,"A",{href:!0});var Zn=i(Le);nr=s(Zn,"STRONG",{});var Wa=i(nr);Ls=a(Wa,"call"),Wa.forEach(r),Hs=a(Zn,"()"),Zn.forEach(r),Qs=a(j," if "),ar=s(j,"CODE",{});var Aa=i(ar);Xs=a(Aa,"text"),Aa.forEach(r),qs=a(j," is not "),ir=s(j,"CODE",{});var Fa=i(ir);Ys=a(Fa,"None"),Fa.forEach(r),Ds=a(j,` to encode the text. Please
refer to the doctsring of the above methods for more information.`),j.forEach(r),Dr.forEach(r),Os=p(B),W=s(B,"DIV",{class:!0});var Ut=i(W);b(He.$$.fragment,Ut),Ks=p(Ut),lr=s(Ut,"P",{});var Ba=i(lr);en=a(Ba,"Convert a list of lists of token ids into a list of strings by calling decode."),Ba.forEach(r),tn=p(Ut),Qe=s(Ut,"P",{});var Or=i(Qe);rn=a(Or,"This method forwards all its arguments to PreTrainedTokenizer\u2019s "),xt=s(Or,"A",{href:!0});var La=i(xt);on=a(La,"batch_decode()"),La.forEach(r),sn=a(Or,`. Please
refer to the docstring of this method for more information.`),Or.forEach(r),Ut.forEach(r),B.forEach(r),Nr=p(t),te=s(t,"H2",{class:!0});var Kr=i(te);ge=s(Kr,"A",{id:!0,class:!0,href:!0});var Ha=i(ge);cr=s(Ha,"SPAN",{});var Qa=i(cr);b(Xe.$$.fragment,Qa),Qa.forEach(r),Ha.forEach(r),nn=p(Kr),dr=s(Kr,"SPAN",{});var Xa=i(dr);an=a(Xa,"MgpstrModel"),Xa.forEach(r),Kr.forEach(r),Vr=p(t),N=s(t,"DIV",{class:!0});var Ct=i(N);b(qe.$$.fragment,Ct),ln=p(Ct),Ye=s(Ct,"P",{});var eo=i(Ye);cn=a(eo,`The bare MGP-STR Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),De=s(eo,"A",{href:!0,rel:!0});var qa=i(De);dn=a(qa,"torch.nn.Module"),qa.forEach(r),pn=a(eo,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),eo.forEach(r),mn=p(Ct),A=s(Ct,"DIV",{class:!0});var It=i(A);b(Oe.$$.fragment,It),hn=p(It),re=s(It,"P",{});var Gt=i(re);fn=a(Gt,"The "),Et=s(Gt,"A",{href:!0});var Ya=i(Et);gn=a(Ya,"MgpstrModel"),Ya.forEach(r),un=a(Gt," forward method, overrides the "),pr=s(Gt,"CODE",{});var Da=i(pr);_n=a(Da,"__call__"),Da.forEach(r),vn=a(Gt," special method."),Gt.forEach(r),bn=p(It),b(ue.$$.fragment,It),It.forEach(r),Ct.forEach(r),Zr=p(t),oe=s(t,"H2",{class:!0});var to=i(oe);_e=s(to,"A",{id:!0,class:!0,href:!0});var Oa=i(_e);mr=s(Oa,"SPAN",{});var Ka=i(mr);b(Ke.$$.fragment,Ka),Ka.forEach(r),Oa.forEach(r),Mn=p(to),hr=s(to,"SPAN",{});var ei=i(hr);Tn=a(ei,"MgpstrForSceneTextRecognition"),ei.forEach(r),to.forEach(r),Wr=p(t),C=s(t,"DIV",{class:!0});var we=i(C);b(et.$$.fragment,we),wn=p(we),fr=s(we,"P",{});var ti=i(fr);yn=a(ti,`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) .`),ti.forEach(r),$n=p(we),tt=s(we,"P",{});var ro=i(tt);kn=a(ro,"This model is a PyTorch "),rt=s(ro,"A",{href:!0,rel:!0});var ri=i(rt);xn=a(ri,"torch.nn.Module"),ri.forEach(r),En=a(ro,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ro.forEach(r),Sn=p(we),I=s(we,"DIV",{class:!0});var ye=i(I);b(ot.$$.fragment,ye),Pn=p(ye),se=s(ye,"P",{});var Jt=i(se);Rn=a(Jt,"The "),St=s(Jt,"A",{href:!0});var oi=i(St);jn=a(oi,"MgpstrForSceneTextRecognition"),oi.forEach(r),zn=a(Jt," forward method, overrides the "),gr=s(Jt,"CODE",{});var si=i(gr);Un=a(si,"__call__"),si.forEach(r),Cn=a(Jt," special method."),Jt.forEach(r),In=p(ye),b(ve.$$.fragment,ye),Gn=p(ye),b(be.$$.fragment,ye),ye.forEach(r),we.forEach(r),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(bi)),l(g,"id","mgpstr"),l(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"),l(g,"href","#mgpstr"),l(u,"class","relative group"),l(ne,"id","overview"),l(ne,"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"),l(ne,"href","#overview"),l(H,"class","relative group"),l(xe,"href","https://arxiv.org/abs/2209.03592"),l(xe,"rel","nofollow"),l(nt,"href","vit"),mi(ae.src,An="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mgp_str_architecture.png")||l(ae,"src",An),l(ae,"alt","drawing"),l(ae,"width","600"),l(lt,"href","https://arxiv.org/abs/2209.03592"),l(dt,"href","(http://www.robots.ox.ac.uk/~vgg/data/text/)"),l(Ee,"href","http://www.robots.ox.ac.uk/~vgg/data/scenetext/"),l(Ee,"rel","nofollow"),l(Se,"href","https://huggingface.co/yuekun"),l(Se,"rel","nofollow"),l(Pe,"href","https://github.com/AlibabaResearch/AdvancedLiterateMachinery/tree/main/OCR/MGP-STR"),l(Pe,"rel","nofollow"),l(ce,"id","inference"),l(ce,"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"),l(ce,"href","#inference"),l(q,"class","relative group"),l(pt,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrModel"),l(mt,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor"),l(ht,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),l(ft,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrProcessor"),l(gt,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor"),l(ut,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),l(de,"id","transformers.MgpstrConfig"),l(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"),l(de,"href","#transformers.MgpstrConfig"),l(Y,"class","relative group"),l(vt,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrModel"),l(Ie,"href","https://huggingface.co/alibaba-damo/mgp-str-base"),l(Ie,"rel","nofollow"),l(bt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(Mt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(me,"id","transformers.MgpstrTokenizer"),l(me,"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"),l(me,"href","#transformers.MgpstrTokenizer"),l(K,"class","relative group"),l(Tt,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),l(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(he,"id","transformers.MgpstrProcessor"),l(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"),l(he,"href","#transformers.MgpstrProcessor"),l(ee,"class","relative group"),l(yt,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrProcessor"),l($t,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),l(Ae,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrProcessor.__call__"),l(kt,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrProcessor.batch_decode"),l(Be,"href","/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__"),l(Le,"href","/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__call__"),l(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xt,"href","/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ge,"id","transformers.MgpstrModel"),l(ge,"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"),l(ge,"href","#transformers.MgpstrModel"),l(te,"class","relative group"),l(De,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(De,"rel","nofollow"),l(Et,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrModel"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_e,"id","transformers.MgpstrForSceneTextRecognition"),l(_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"),l(_e,"href","#transformers.MgpstrForSceneTextRecognition"),l(oe,"class","relative group"),l(rt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(rt,"rel","nofollow"),l(St,"href","/docs/transformers/main/en/model_doc/mgp-str#transformers.MgpstrForSceneTextRecognition"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"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,f),m(t,k,c),m(t,u,c),e(u,g),e(g,$),M(h,$,null),e(u,_),e(u,J),e(J,oo),m(t,br,c),m(t,H,c),e(H,ne),e(ne,Nt),M(ke,Nt,null),e(H,so),e(H,Vt),e(Vt,no),m(t,Mr,c),m(t,P,c),e(P,ao),e(P,xe),e(xe,io),e(P,lo),e(P,Zt),e(Zt,co),e(P,po),e(P,Wt),e(Wt,mo),e(P,ho),e(P,nt),e(nt,fo),e(P,go),m(t,Tr,c),m(t,at,c),e(at,uo),m(t,wr,c),m(t,it,c),e(it,At),e(At,_o),m(t,yr,c),m(t,ae,c),m(t,$r,c),m(t,ie,c),e(ie,vo),e(ie,lt),e(lt,bo),e(ie,Mo),m(t,kr,c),m(t,ct,c),e(ct,To),m(t,xr,c),m(t,le,c),e(le,Q),e(Q,wo),e(Q,dt),e(dt,yo),e(Q,$o),e(Q,Ee),e(Ee,ko),e(Q,xo),e(le,Eo),e(le,X),e(X,So),e(X,Se),e(Se,Po),e(X,Ro),e(X,Pe),e(Pe,jo),e(X,zo),m(t,Er,c),m(t,q,c),e(q,ce),e(ce,Ft),M(Re,Ft,null),e(q,Uo),e(q,Bt),e(Bt,Co),m(t,Sr,c),m(t,je,c),e(je,pt),e(pt,Io),e(je,Go),m(t,Pr,c),m(t,E,c),e(E,Jo),e(E,mt),e(mt,No),e(E,Vo),e(E,ht),e(ht,Zo),e(E,Wo),e(E,ft),e(ft,Ao),e(E,Fo),e(E,gt),e(gt,Bo),e(E,Lo),e(E,ut),e(ut,Ho),e(E,Qo),m(t,Rr,c),m(t,_t,c),e(_t,Lt),e(Lt,Xo),m(t,jr,c),M(ze,t,c),m(t,zr,c),m(t,Y,c),e(Y,de),e(de,Ht),M(Ue,Ht,null),e(Y,qo),e(Y,Qt),e(Qt,Yo),m(t,Ur,c),m(t,z,c),M(Ce,z,null),e(z,Do),e(z,D),e(D,Oo),e(D,vt),e(vt,Ko),e(D,es),e(D,Ie),e(Ie,ts),e(D,rs),e(z,os),e(z,O),e(O,ss),e(O,bt),e(bt,ns),e(O,as),e(O,Mt),e(Mt,is),e(O,ls),e(z,cs),M(pe,z,null),m(t,Cr,c),m(t,K,c),e(K,me),e(me,Xt),M(Ge,Xt,null),e(K,ds),e(K,qt),e(qt,ps),m(t,Ir,c),m(t,U,c),M(Je,U,null),e(U,ms),e(U,Yt),e(Yt,hs),e(U,fs),e(U,Ne),e(Ne,gs),e(Ne,Tt),e(Tt,us),e(Ne,_s),e(U,vs),e(U,wt),M(Ve,wt,null),m(t,Gr,c),m(t,ee,c),e(ee,he),e(he,Dt),M(Ze,Dt,null),e(ee,bs),e(ee,Ot),e(Ot,Ms),m(t,Jr,c),m(t,S,c),M(We,S,null),e(S,Ts),e(S,Kt),e(Kt,ws),e(S,ys),e(S,R),e(R,yt),e(yt,$s),e(R,ks),e(R,er),e(er,xs),e(R,Es),e(R,$t),e($t,Ss),e(R,Ps),e(R,Ae),e(Ae,tr),e(tr,Rs),e(Ae,js),e(R,zs),e(R,kt),e(kt,Us),e(R,Cs),e(S,Is),e(S,fe),M(Fe,fe,null),e(fe,Gs),e(fe,x),e(x,Js),e(x,Be),e(Be,rr),e(rr,Ns),e(Be,Vs),e(x,Zs),e(x,or),e(or,Ws),e(x,As),e(x,sr),e(sr,Fs),e(x,Bs),e(x,Le),e(Le,nr),e(nr,Ls),e(Le,Hs),e(x,Qs),e(x,ar),e(ar,Xs),e(x,qs),e(x,ir),e(ir,Ys),e(x,Ds),e(S,Os),e(S,W),M(He,W,null),e(W,Ks),e(W,lr),e(lr,en),e(W,tn),e(W,Qe),e(Qe,rn),e(Qe,xt),e(xt,on),e(Qe,sn),m(t,Nr,c),m(t,te,c),e(te,ge),e(ge,cr),M(Xe,cr,null),e(te,nn),e(te,dr),e(dr,an),m(t,Vr,c),m(t,N,c),M(qe,N,null),e(N,ln),e(N,Ye),e(Ye,cn),e(Ye,De),e(De,dn),e(Ye,pn),e(N,mn),e(N,A),M(Oe,A,null),e(A,hn),e(A,re),e(re,fn),e(re,Et),e(Et,gn),e(re,un),e(re,pr),e(pr,_n),e(re,vn),e(A,bn),M(ue,A,null),m(t,Zr,c),m(t,oe,c),e(oe,_e),e(_e,mr),M(Ke,mr,null),e(oe,Mn),e(oe,hr),e(hr,Tn),m(t,Wr,c),m(t,C,c),M(et,C,null),e(C,wn),e(C,fr),e(fr,yn),e(C,$n),e(C,tt),e(tt,kn),e(tt,rt),e(rt,xn),e(tt,En),e(C,Sn),e(C,I),M(ot,I,null),e(I,Pn),e(I,se),e(se,Rn),e(se,St),e(St,jn),e(se,zn),e(se,gr),e(gr,Un),e(se,Cn),e(I,In),M(ve,I,null),e(I,Gn),M(be,I,null),Ar=!0},p(t,[c]){const st={};c&2&&(st.$$scope={dirty:c,ctx:t}),pe.$set(st);const ur={};c&2&&(ur.$$scope={dirty:c,ctx:t}),ue.$set(ur);const _r={};c&2&&(_r.$$scope={dirty:c,ctx:t}),ve.$set(_r);const vr={};c&2&&(vr.$$scope={dirty:c,ctx:t}),be.$set(vr)},i(t){Ar||(T(h.$$.fragment,t),T(ke.$$.fragment,t),T(Re.$$.fragment,t),T(ze.$$.fragment,t),T(Ue.$$.fragment,t),T(Ce.$$.fragment,t),T(pe.$$.fragment,t),T(Ge.$$.fragment,t),T(Je.$$.fragment,t),T(Ve.$$.fragment,t),T(Ze.$$.fragment,t),T(We.$$.fragment,t),T(Fe.$$.fragment,t),T(He.$$.fragment,t),T(Xe.$$.fragment,t),T(qe.$$.fragment,t),T(Oe.$$.fragment,t),T(ue.$$.fragment,t),T(Ke.$$.fragment,t),T(et.$$.fragment,t),T(ot.$$.fragment,t),T(ve.$$.fragment,t),T(be.$$.fragment,t),Ar=!0)},o(t){w(h.$$.fragment,t),w(ke.$$.fragment,t),w(Re.$$.fragment,t),w(ze.$$.fragment,t),w(Ue.$$.fragment,t),w(Ce.$$.fragment,t),w(pe.$$.fragment,t),w(Ge.$$.fragment,t),w(Je.$$.fragment,t),w(Ve.$$.fragment,t),w(Ze.$$.fragment,t),w(We.$$.fragment,t),w(Fe.$$.fragment,t),w(He.$$.fragment,t),w(Xe.$$.fragment,t),w(qe.$$.fragment,t),w(Oe.$$.fragment,t),w(ue.$$.fragment,t),w(Ke.$$.fragment,t),w(et.$$.fragment,t),w(ot.$$.fragment,t),w(ve.$$.fragment,t),w(be.$$.fragment,t),Ar=!1},d(t){r(f),t&&r(k),t&&r(u),y(h),t&&r(br),t&&r(H),y(ke),t&&r(Mr),t&&r(P),t&&r(Tr),t&&r(at),t&&r(wr),t&&r(it),t&&r(yr),t&&r(ae),t&&r($r),t&&r(ie),t&&r(kr),t&&r(ct),t&&r(xr),t&&r(le),t&&r(Er),t&&r(q),y(Re),t&&r(Sr),t&&r(je),t&&r(Pr),t&&r(E),t&&r(Rr),t&&r(_t),t&&r(jr),y(ze,t),t&&r(zr),t&&r(Y),y(Ue),t&&r(Ur),t&&r(z),y(Ce),y(pe),t&&r(Cr),t&&r(K),y(Ge),t&&r(Ir),t&&r(U),y(Je),y(Ve),t&&r(Gr),t&&r(ee),y(Ze),t&&r(Jr),t&&r(S),y(We),y(Fe),y(He),t&&r(Nr),t&&r(te),y(Xe),t&&r(Vr),t&&r(N),y(qe),y(Oe),y(ue),t&&r(Zr),t&&r(oe),y(Ke),t&&r(Wr),t&&r(C),y(et),y(ot),y(ve),y(be)}}}const bi={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 Mi(Z){return hi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ei extends li{constructor(f){super();ci(this,f,Mi,vi,di,{})}}export{Ei as default,bi as metadata};
