import{S as li,i as ci,s as di,e as o,k as d,w as v,t as n,M as pi,c as s,d as r,m as p,a as i,x as b,h as a,b as l,N as mi,G as e,g as m,y as T,q as w,o as M,B as $,v as hi,L as ii}from"../../chunks/vendor-hf-doc-builder.js";import{T as ni}from"../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Vn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as xe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ai}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function fi(N){let f,k,u,g,x;return g=new Vn({props:{code:`from transformers import MgpstrConfig, MgpstrForSceneTextRecognition

# Initializing a Mgpstr mgp-str-base style configuration
configuration = MgpstrConfig()

# Initializing a model (with random weights) from the mgp-str-base style configuration
model = MgpstrForSceneTextRecognition(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MgpstrConfig, MgpstrForSceneTextRecognition

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the mgp-str-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MgpstrForSceneTextRecognition(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){f=o("p"),k=n("Example:"),u=d(),v(g.$$.fragment)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Example:"),_.forEach(r),u=p(h),b(g.$$.fragment,h)},m(h,_){m(h,f,_),e(f,k),m(h,u,_),T(g,h,_),x=!0},p:ii,i(h){x||(w(g.$$.fragment,h),x=!0)},o(h){M(g.$$.fragment,h),x=!1},d(h){h&&r(f),h&&r(u),$(g,h)}}}function gi(N){let f,k,u,g,x;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"),x=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(_,"CODE",{});var G=i(u);g=a(G,"Module"),G.forEach(r),x=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,x)},d(h){h&&r(f)}}}function ui(N){let f,k,u,g,x;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"),x=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=s(_,"CODE",{});var G=i(u);g=a(G,"Module"),G.forEach(r),x=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,x)},d(h){h&&r(f)}}}function _i(N){let f,k,u,g,x;return g=new Vn({props:{code:`from transformers import (
    MgpstrProcessor,
    MgpstrForSceneTextRecognition,
)
import requests
from PIL import Image

# load image from the IIIT-5k dataset
url = "https://i.postimg.cc/ZKwLg2Gw/367-14.png"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")

processor = MgpstrProcessor.from_pretrained("alibaba-damo/mgp-str-base")
pixel_values = processor(images=image, return_tensors="pt").pixel_values

model = MgpstrForSceneTextRecognition.from_pretrained("alibaba-damo/mgp-str-base")

# inference
outputs = model(pixel_values)
out_strs = processor.batch_decode(outputs.logits)
out_strs["generated_text"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    MgpstrProcessor,
<span class="hljs-meta">... </span>    MgpstrForSceneTextRecognition,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>out_strs = processor.batch_decode(outputs.logits)
<span class="hljs-meta">&gt;&gt;&gt; </span>out_strs[<span class="hljs-string">&quot;generated_text&quot;</span>]
<span class="hljs-string">&#x27;[&quot;ticket&quot;]&#x27;</span>`}}),{c(){f=o("p"),k=n("Example:"),u=d(),v(g.$$.fragment)},l(h){f=s(h,"P",{});var _=i(f);k=a(_,"Example:"),_.forEach(r),u=p(h),b(g.$$.fragment,h)},m(h,_){m(h,f,_),e(f,k),m(h,u,_),T(g,h,_),x=!0},p:ii,i(h){x||(w(g.$$.fragment,h),x=!0)},o(h){M(g.$$.fragment,h),x=!1},d(h){h&&r(f),h&&r(u),$(g,h)}}}function vi(N){let f,k,u,g,x,h,_,G,oo,br,U,ne,Ft,ke,so,Lt,no,Tr,S,ao,ye,io,lo,Nt,co,po,Vt,mo,ho,nt,fo,go,wr,at,uo,Mr,it,Dt,_o,$r,ae,Dn,xr,ie,vo,lt,bo,To,kr,ct,wo,yr,le,H,Mo,dt,$o,xo,Pe,ko,yo,Po,J,Eo,Ee,So,Ro,Se,zo,Io,Pr,K,ce,Ot,Re,Co,Wt,Ao,Er,ze,pt,jo,qo,Sr,P,Go,mt,Fo,Lo,ht,No,Vo,ft,Do,Oo,gt,Wo,Bo,ut,Uo,Ho,Rr,_t,Bt,Jo,zr,Ie,Ir,Z,de,Ut,Ce,Ko,Ht,Zo,Cr,I,Ae,Yo,Y,Qo,vt,Xo,es,je,ts,rs,os,Q,ss,bt,ns,as,Tt,is,ls,cs,pe,Ar,X,me,Jt,qe,ds,Kt,ps,jr,C,Ge,ms,Zt,hs,fs,Fe,gs,wt,us,_s,vs,Mt,Le,qr,ee,he,Yt,Ne,bs,Qt,Ts,Gr,E,Ve,ws,Xt,Ms,$s,R,$t,xs,ks,er,ys,Ps,xt,Es,Ss,De,tr,Rs,zs,Is,kt,Cs,As,js,fe,Oe,qs,y,Gs,We,rr,Fs,Ls,Ns,or,Vs,Ds,sr,Os,Ws,Be,nr,Bs,Us,Hs,ar,Js,Ks,ir,Zs,Ys,Qs,V,Ue,Xs,lr,en,tn,He,rn,yt,on,sn,Fr,te,ge,cr,Je,nn,dr,an,Lr,F,Ke,ln,Ze,cn,Ye,dn,pn,mn,D,Qe,hn,re,fn,Pt,gn,un,pr,_n,vn,bn,ue,Nr,oe,_e,mr,Xe,Tn,hr,wn,Vr,A,et,Mn,fr,$n,xn,tt,kn,rt,yn,Pn,En,j,ot,Sn,se,Rn,Et,zn,In,gr,Cn,An,jn,ve,qn,be,Dr;return h=new xe({}),ke=new xe({}),Re=new xe({}),Ie=new Vn({props:{code:`from transformers import MgpstrProcessor, MgpstrForSceneTextRecognition
import requests
from PIL import Image

processor = MgpstrProcessor.from_pretrained('alibaba-damo/mgp-str-base')
model = MgpstrForSceneTextRecognition.from_pretrained('alibaba-damo/mgp-str-base')

# load image from the IIIT-5k dataset
url = "https://i.postimg.cc/ZKwLg2Gw/367-14.png"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")

pixel_values = processor(image, return_tensors="pt").pixel_values
outputs = model(pixel_values)

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