import{S as il,i as cl,s as dl,e as o,k as d,w as v,t as n,M as pl,c as s,d as r,m as p,a as l,x as b,h as a,b as i,N as ml,G as e,g as m,y as M,q as T,o as w,B as y,v as hl,L as ll}from"../../chunks/vendor-hf-doc-builder.js";import{T as nl}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 al}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fl(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 _=l(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:ll,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 gl(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 _=l(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=l(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 ul(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 _=l(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=l(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 _l(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 _=l(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:ll,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 vl(Z){let f,k,u,g,$,h,_,J,oo,br,H,ne,Nt,ke,so,Vt,no,Mr,P,ao,xe,lo,io,Zt,co,po,Wt,mo,ho,nt,fo,go,Tr,at,uo,wr,lt,At,_o,yr,ae,An,$r,le,vo,it,bo,Mo,kr,ct,To,xr,ie,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,ls,is,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,lr,Ys,Ds,Os,W,He,Ks,ir,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/v4.30.0/src/transformers/models/mgp_str/configuration_mgp_str.py#L28"}}),pe=new al({props:{anchor:"transformers.MgpstrConfig.example",$$slots:{default:[fl]},$$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/v4.30.0/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/v4.30.0/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/v4.30.0/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.30.0/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/v4.30.0/src/transformers/models/mgp_str/processing_mgp_str.py#L77"}}),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/v4.30.0/src/transformers/models/mgp_str/processing_mgp_str.py#L100",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/v4.30.0/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.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/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/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.0/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.30.0/src/transformers/models/mgp_str/modeling_mgp_str.py#L382"}}),ue=new nl({props:{$$slots:{default:[gl]},$$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/v4.30.0/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.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/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/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__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.30.0/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.30.0/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 nl({props:{$$slots:{default:[ul]},$$scope:{ctx:Z}}}),be=new al({props:{anchor:"transformers.MgpstrForSceneTextRecognition.forward.example",$$slots:{default:[_l]},$$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"),lo=n("Multi-Granularity Prediction for Scene Text Recognition"),io=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(),lt=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(),le=o("small"),vo=n("MGP-STR architecture. Taken from the "),it=o("a"),bo=n("original paper"),Mo=n("."),kr=d(),ct=o("p"),To=n("Tips:"),xr=d(),ie=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"),ls=n("PretrainedConfig"),is=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 "),lr=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(),ir=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=pl('[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=l(u);g=s(st,"A",{id:!0,class:!0,href:!0});var ur=l(g);$=s(ur,"SPAN",{});var _r=l($);b(h.$$.fragment,_r),_r.forEach(r),ur.forEach(r),_=p(st),J=s(st,"SPAN",{});var vr=l(J);oo=a(vr,"MGP-STR"),vr.forEach(r),st.forEach(r),br=p(t),H=s(t,"H2",{class:!0});var Fr=l(H);ne=s(Fr,"A",{id:!0,class:!0,href:!0});var Fn=l(ne);Nt=s(Fn,"SPAN",{});var Bn=l(Nt);b(ke.$$.fragment,Bn),Bn.forEach(r),Fn.forEach(r),so=p(Fr),Vt=s(Fr,"SPAN",{});var Ln=l(Vt);no=a(Ln,"Overview"),Ln.forEach(r),Fr.forEach(r),Mr=p(t),P=s(t,"P",{});var F=l(P);ao=a(F,"The MGP-STR model was proposed in "),xe=s(F,"A",{href:!0,rel:!0});var Hn=l(xe);lo=a(Hn,"Multi-Granularity Prediction for Scene Text Recognition"),Hn.forEach(r),io=a(F," by Peng Wang, Cheng Da, and Cong Yao. MGP-STR is a conceptually "),Zt=s(F,"STRONG",{});var Qn=l(Zt);co=a(Qn,"simple"),Qn.forEach(r),po=a(F," yet "),Wt=s(F,"STRONG",{});var Xn=l(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=l(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=l(at);uo=a(Yn,"The abstract from the paper is the following:"),Yn.forEach(r),wr=p(t),lt=s(t,"P",{});var Dn=l(lt);At=s(Dn,"EM",{});var On=l(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),le=s(t,"SMALL",{});var Br=l(le);vo=a(Br,"MGP-STR architecture. Taken from the "),it=s(Br,"A",{href:!0});var Kn=l(it);bo=a(Kn,"original paper"),Kn.forEach(r),Mo=a(Br,"."),Br.forEach(r),kr=p(t),ct=s(t,"P",{});var ea=l(ct);To=a(ea,"Tips:"),ea.forEach(r),xr=p(t),ie=s(t,"UL",{});var Lr=l(ie);Q=s(Lr,"LI",{});var Pt=l(Q);wo=a(Pt,"MGP-STR is trained on two synthetic datasets "),dt=s(Pt,"A",{href:!0});var ta=l(dt);yo=a(ta,"MJSynth"),ta.forEach(r),$o=a(Pt," (MJ) and SynthText("),Ee=s(Pt,"A",{href:!0,rel:!0});var ra=l(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=l(X);So=a(Rt,"This model was contributed by "),Se=s(Rt,"A",{href:!0,rel:!0});var oa=l(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=l(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=l(q);ce=s(Hr,"A",{id:!0,class:!0,href:!0});var na=l(ce);Ft=s(na,"SPAN",{});var aa=l(Ft);b(Re.$$.fragment,aa),aa.forEach(r),na.forEach(r),Uo=p(Hr),Bt=s(Hr,"SPAN",{});var la=l(Bt);Co=a(la,"Inference"),la.forEach(r),Hr.forEach(r),Sr=p(t),je=s(t,"P",{});var Jn=l(je);pt=s(Jn,"A",{href:!0});var ia=l(pt);Io=a(ia,"MgpstrModel"),ia.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=l(E);Jo=a(G,"The "),mt=s(G,"A",{href:!0});var ca=l(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=l(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=l(ft);Ao=a(pa,"MgpstrProcessor"),pa.forEach(r),Fo=a(G," wraps "),gt=s(G,"A",{href:!0});var ma=l(gt);Bo=a(ma,"ViTImageProcessor"),ma.forEach(r),Lo=a(G," and "),ut=s(G,"A",{href:!0});var ha=l(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=l(_t);Lt=s(fa,"LI",{});var ga=l(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=l(Y);de=s(Qr,"A",{id:!0,class:!0,href:!0});var ua=l(de);Ht=s(ua,"SPAN",{});var _a=l(Ht);b(Ue.$$.fragment,_a),_a.forEach(r),ua.forEach(r),qo=p(Qr),Qt=s(Qr,"SPAN",{});var va=l(Qt);Yo=a(va,"MgpstrConfig"),va.forEach(r),Qr.forEach(r),Ur=p(t),z=s(t,"DIV",{class:!0});var Me=l(z);b(Ce.$$.fragment,Me),Do=p(Me),D=s(Me,"P",{});var jt=l(D);Oo=a(jt,"This is the configuration class to store the configuration of an "),vt=s(jt,"A",{href:!0});var ba=l(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=l(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=l(O);ss=a(zt,"Configuration objects inherit from "),bt=s(zt,"A",{href:!0});var Ta=l(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=l(Mt);ls=a(wa,"PretrainedConfig"),wa.forEach(r),is=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=l(K);me=s(Xr,"A",{id:!0,class:!0,href:!0});var ya=l(me);Xt=s(ya,"SPAN",{});var $a=l(Xt);b(Ge.$$.fragment,$a),$a.forEach(r),ya.forEach(r),ds=p(Xr),qt=s(Xr,"SPAN",{});var ka=l(qt);ps=a(ka,"MgpstrTokenizer"),ka.forEach(r),Xr.forEach(r),Ir=p(t),U=s(t,"DIV",{class:!0});var Te=l(U);b(Je.$$.fragment,Te),ms=p(Te),Yt=s(Te,"P",{});var xa=l(Yt);hs=a(xa,"Construct a MGP-STR char tokenizer."),xa.forEach(r),fs=p(Te),Ne=s(Te,"P",{});var qr=l(Ne);gs=a(qr,"This tokenizer inherits from "),Tt=s(qr,"A",{href:!0});var Ea=l(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=l(wt);b(Ve.$$.fragment,Sa),Sa.forEach(r),Te.forEach(r),Gr=p(t),ee=s(t,"H2",{class:!0});var Yr=l(ee);he=s(Yr,"A",{id:!0,class:!0,href:!0});var Pa=l(he);Dt=s(Pa,"SPAN",{});var Ra=l(Dt);b(Ze.$$.fragment,Ra),Ra.forEach(r),Pa.forEach(r),bs=p(Yr),Ot=s(Yr,"SPAN",{});var ja=l(Ot);Ms=a(ja,"MgpstrProcessor"),ja.forEach(r),Yr.forEach(r),Jr=p(t),S=s(t,"DIV",{class:!0});var B=l(S);b(We.$$.fragment,B),Ts=p(B),Kt=s(B,"P",{});var za=l(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=l(R);yt=s(V,"A",{href:!0});var Ua=l(yt);$s=a(Ua,"MgpstrProcessor"),Ua.forEach(r),ks=a(V," offers all the functionalities of "),er=s(V,"CODE",{});var Ca=l(er);xs=a(Ca,"ViTImageProcessor"),Ca.forEach(r),Es=a(V,"] and "),$t=s(V,"A",{href:!0});var Ia=l($t);Ss=a(Ia,"MgpstrTokenizer"),Ia.forEach(r),Ps=a(V,`. See the
`),Ae=s(V,"A",{href:!0});var Nn=l(Ae);tr=s(Nn,"STRONG",{});var Ga=l(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=l(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=l(fe);b(Fe.$$.fragment,Dr),Gs=p(Dr),x=s(Dr,"P",{});var j=l(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=l(Be);rr=s(Vn,"STRONG",{});var Na=l(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=l(or);Ws=a(Va,"text"),Va.forEach(r),As=a(j," and "),sr=s(j,"CODE",{});var Za=l(sr);Fs=a(Za,"kwargs"),Za.forEach(r),Bs=a(j,`
arguments to MgpstrTokenizer\u2019s `),Le=s(j,"A",{href:!0});var Zn=l(Le);nr=s(Zn,"STRONG",{});var Wa=l(nr);Ls=a(Wa,"call"),Wa.forEach(r),Hs=a(Zn,"()"),Zn.forEach(r),Qs=a(j," if "),ar=s(j,"CODE",{});var Aa=l(ar);Xs=a(Aa,"text"),Aa.forEach(r),qs=a(j," is not "),lr=s(j,"CODE",{});var Fa=l(lr);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=l(W);b(He.$$.fragment,Ut),Ks=p(Ut),ir=s(Ut,"P",{});var Ba=l(ir);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=l(Qe);rn=a(Or,"This method forwards all its arguments to PreTrainedTokenizer\u2019s "),xt=s(Or,"A",{href:!0});var La=l(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=l(te);ge=s(Kr,"A",{id:!0,class:!0,href:!0});var Ha=l(ge);cr=s(Ha,"SPAN",{});var Qa=l(cr);b(Xe.$$.fragment,Qa),Qa.forEach(r),Ha.forEach(r),nn=p(Kr),dr=s(Kr,"SPAN",{});var Xa=l(dr);an=a(Xa,"MgpstrModel"),Xa.forEach(r),Kr.forEach(r),Vr=p(t),N=s(t,"DIV",{class:!0});var Ct=l(N);b(qe.$$.fragment,Ct),ln=p(Ct),Ye=s(Ct,"P",{});var eo=l(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=l(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=l(A);b(Oe.$$.fragment,It),hn=p(It),re=s(It,"P",{});var Gt=l(re);fn=a(Gt,"The "),Et=s(Gt,"A",{href:!0});var Ya=l(Et);gn=a(Ya,"MgpstrModel"),Ya.forEach(r),un=a(Gt," forward method, overrides the "),pr=s(Gt,"CODE",{});var Da=l(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=l(oe);_e=s(to,"A",{id:!0,class:!0,href:!0});var Oa=l(_e);mr=s(Oa,"SPAN",{});var Ka=l(mr);b(Ke.$$.fragment,Ka),Ka.forEach(r),Oa.forEach(r),Mn=p(to),hr=s(to,"SPAN",{});var el=l(hr);Tn=a(el,"MgpstrForSceneTextRecognition"),el.forEach(r),to.forEach(r),Wr=p(t),C=s(t,"DIV",{class:!0});var we=l(C);b(et.$$.fragment,we),wn=p(we),fr=s(we,"P",{});var tl=l(fr);yn=a(tl,`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) .`),tl.forEach(r),$n=p(we),tt=s(we,"P",{});var ro=l(tt);kn=a(ro,"This model is a PyTorch "),rt=s(ro,"A",{href:!0,rel:!0});var rl=l(rt);xn=a(rl,"torch.nn.Module"),rl.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=l(I);b(ot.$$.fragment,ye),Pn=p(ye),se=s(ye,"P",{});var Jt=l(se);Rn=a(Jt,"The "),St=s(Jt,"A",{href:!0});var ol=l(St);jn=a(ol,"MgpstrForSceneTextRecognition"),ol.forEach(r),zn=a(Jt," forward method, overrides the "),gr=s(Jt,"CODE",{});var sl=l(gr);Un=a(sl,"__call__"),sl.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(){i(f,"name","hf:doc:metadata"),i(f,"content",JSON.stringify(bl)),i(g,"id","mgpstr"),i(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(g,"href","#mgpstr"),i(u,"class","relative group"),i(ne,"id","overview"),i(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"),i(ne,"href","#overview"),i(H,"class","relative group"),i(xe,"href","https://arxiv.org/abs/2209.03592"),i(xe,"rel","nofollow"),i(nt,"href","vit"),ml(ae.src,An="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mgp_str_architecture.png")||i(ae,"src",An),i(ae,"alt","drawing"),i(ae,"width","600"),i(it,"href","https://arxiv.org/abs/2209.03592"),i(dt,"href","(http://www.robots.ox.ac.uk/~vgg/data/text/)"),i(Ee,"href","http://www.robots.ox.ac.uk/~vgg/data/scenetext/"),i(Ee,"rel","nofollow"),i(Se,"href","https://huggingface.co/yuekun"),i(Se,"rel","nofollow"),i(Pe,"href","https://github.com/AlibabaResearch/AdvancedLiterateMachinery/tree/main/OCR/MGP-STR"),i(Pe,"rel","nofollow"),i(ce,"id","inference"),i(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"),i(ce,"href","#inference"),i(q,"class","relative group"),i(pt,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrModel"),i(mt,"href","/docs/transformers/v4.30.0/en/model_doc/vit#transformers.ViTImageProcessor"),i(ht,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),i(ft,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrProcessor"),i(gt,"href","/docs/transformers/v4.30.0/en/model_doc/vit#transformers.ViTImageProcessor"),i(ut,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),i(de,"id","transformers.MgpstrConfig"),i(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(de,"href","#transformers.MgpstrConfig"),i(Y,"class","relative group"),i(vt,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrModel"),i(Ie,"href","https://huggingface.co/alibaba-damo/mgp-str-base"),i(Ie,"rel","nofollow"),i(bt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(Mt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(me,"id","transformers.MgpstrTokenizer"),i(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"),i(me,"href","#transformers.MgpstrTokenizer"),i(K,"class","relative group"),i(Tt,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),i(wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(he,"id","transformers.MgpstrProcessor"),i(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(he,"href","#transformers.MgpstrProcessor"),i(ee,"class","relative group"),i(yt,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrProcessor"),i($t,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrTokenizer"),i(Ae,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrProcessor.__call__"),i(kt,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrProcessor.batch_decode"),i(Be,"href","/docs/transformers/v4.30.0/en/model_doc/layoutlmv2#transformers.LayoutLMv2FeatureExtractor.__call__"),i(Le,"href","/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__"),i(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(xt,"href","/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.batch_decode"),i(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ge,"id","transformers.MgpstrModel"),i(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"),i(ge,"href","#transformers.MgpstrModel"),i(te,"class","relative group"),i(De,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(De,"rel","nofollow"),i(Et,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrModel"),i(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(_e,"id","transformers.MgpstrForSceneTextRecognition"),i(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(_e,"href","#transformers.MgpstrForSceneTextRecognition"),i(oe,"class","relative group"),i(rt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(rt,"rel","nofollow"),i(St,"href","/docs/transformers/v4.30.0/en/model_doc/mgp-str#transformers.MgpstrForSceneTextRecognition"),i(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(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,lo),e(P,io),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,lt,c),e(lt,At),e(At,_o),m(t,yr,c),m(t,ae,c),m(t,$r,c),m(t,le,c),e(le,vo),e(le,it),e(it,bo),e(le,Mo),m(t,kr,c),m(t,ct,c),e(ct,To),m(t,xr,c),m(t,ie,c),e(ie,Q),e(Q,wo),e(Q,dt),e(dt,yo),e(Q,$o),e(Q,Ee),e(Ee,ko),e(Q,xo),e(ie,Eo),e(ie,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,ls),e(O,is),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,lr),e(lr,Ys),e(x,Ds),e(S,Os),e(S,W),M(He,W,null),e(W,Ks),e(W,ir),e(ir,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(lt),t&&r(yr),t&&r(ae),t&&r($r),t&&r(le),t&&r(kr),t&&r(ct),t&&r(xr),t&&r(ie),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 bl={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 Ml(Z){return hl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class El extends il{constructor(f){super();cl(this,f,Ml,vl,dl,{})}}export{El as default,bl as metadata};
