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