import{s as xa,o as Ea,n as D}from"../chunks/scheduler.9bc65507.js";import{S as Ua,i as $a,g as s,s as r,u as _,A as Fa,h as a,f as t,c as l,j as g,v as M,y as m,k as u,o,a as c,w as y,d as b,t as v,x as T}from"../chunks/index.78c82d43.js";import{T as us}from"../chunks/Tip.87d55b76.js";import{D as B}from"../chunks/Docstring.f3d04bd2.js";import{C as R}from"../chunks/CodeBlock.48618ec2.js";import{I as G}from"../chunks/IconCopyLink.bedaa44d.js";import{E as uo}from"../chunks/ExampleCodeBlock.872b014d.js";function Ca(J){let i,w="Examples:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBWaVRDb25maWclMkMlMjBWaXNpb25FbmNvZGVyRGVjb2RlckNvbmZpZyUyQyUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwVmlUJTIwJTI2JTIwQkVSVCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ19lbmNvZGVyJTIwJTNEJTIwVmlUQ29uZmlnKCklMEFjb25maWdfZGVjb2RlciUyMCUzRCUyMEJlcnRDb25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyQ29uZmlnLmZyb21fZW5jb2Rlcl9kZWNvZGVyX2NvbmZpZ3MoY29uZmlnX2VuY29kZXIlMkMlMjBjb25maWdfZGVjb2RlciklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwVmlUQmVydCUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjBhJTIwVmlUJTIwJTI2JTIwYmVydC1iYXNlLXVuY2FzZWQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb25zJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsKGNvbmZpZyUzRGNvbmZpZyklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWdfZW5jb2RlciUyMCUzRCUyMG1vZGVsLmNvbmZpZy5lbmNvZGVyJTBBY29uZmlnX2RlY29kZXIlMjAlM0QlMjBtb2RlbC5jb25maWcuZGVjb2RlciUwQSUyMyUyMHNldCUyMGRlY29kZXIlMjBjb25maWclMjB0byUyMGNhdXNhbCUyMGxtJTBBY29uZmlnX2RlY29kZXIuaXNfZGVjb2RlciUyMCUzRCUyMFRydWUlMEFjb25maWdfZGVjb2Rlci5hZGRfY3Jvc3NfYXR0ZW50aW9uJTIwJTNEJTIwVHJ1ZSUwQSUwQSUyMyUyMFNhdmluZyUyMHRoZSUyMG1vZGVsJTJDJTIwaW5jbHVkaW5nJTIwaXRzJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsLnNhdmVfcHJldHJhaW5lZCglMjJteS1tb2RlbCUyMiklMEElMEElMjMlMjBsb2FkaW5nJTIwbW9kZWwlMjBhbmQlMjBjb25maWclMjBmcm9tJTIwcHJldHJhaW5lZCUyMGZvbGRlciUwQWVuY29kZXJfZGVjb2Rlcl9jb25maWclMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2RlckNvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIybXktbW9kZWwlMjIpJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJteS1tb2RlbCUyMiUyQyUyMGNvbmZpZyUzRGVuY29kZXJfZGVjb2Rlcl9jb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, ViTConfig, VisionEncoderDecoderConfig, VisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViT &amp; BERT style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_encoder = ViTConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_decoder = BertConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = VisionEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a ViTBert model (with random weights) from a ViT &amp; bert-base-uncased style configurations</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel(config=config)

<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>config_encoder = model.config.encoder
<span class="hljs-meta">&gt;&gt;&gt; </span>config_decoder = model.config.decoder
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># set decoder config to causal lm</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_decoder.is_decoder = <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config_decoder.add_cross_attention = <span class="hljs-literal">True</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Saving the model, including its configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;my-model&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># loading model and config from pretrained folder</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoder_decoder_config = VisionEncoderDecoderConfig.from_pretrained(<span class="hljs-string">&quot;my-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;my-model&quot;</span>, config=encoder_decoder_config)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-kvfsh7"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function Ia(J){let i,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){i=s("p"),i.innerHTML=w},l(h){i=a(h,"P",{"data-svelte-h":!0}),m(i)!=="svelte-fincs2"&&(i.innerHTML=w)},m(h,p){c(h,i,p)},p:D,d(h){h&&t(i)}}}function Ra(J){let i,w="Examples:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnRyb2NyLWJhc2UtaGFuZHdyaXR0ZW4lMjIpJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ0cm9jci1iYXNlLWhhbmR3cml0dGVuJTIyKSUwQSUwQSUyMyUyMGxvYWQlMjBpbWFnZSUyMGZyb20lMjB0aGUlMjBJQU0lMjBkYXRhc2V0JTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZma2kudGljLmhlaWEtZnIuY2glMkZzdGF0aWMlMkZpbWclMkZhMDEtMTIyLTAyLmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEElMjMlMjB0cmFpbmluZyUwQW1vZGVsLmNvbmZpZy5kZWNvZGVyX3N0YXJ0X3Rva2VuX2lkJTIwJTNEJTIwcHJvY2Vzc29yLnRva2VuaXplci5jbHNfdG9rZW5faWQlMEFtb2RlbC5jb25maWcucGFkX3Rva2VuX2lkJTIwJTNEJTIwcHJvY2Vzc29yLnRva2VuaXplci5wYWRfdG9rZW5faWQlMEFtb2RlbC5jb25maWcudm9jYWJfc2l6ZSUyMCUzRCUyMG1vZGVsLmNvbmZpZy5kZWNvZGVyLnZvY2FiX3NpemUlMEElMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5waXhlbF92YWx1ZXMlMEF0ZXh0JTIwJTNEJTIwJTIyaGVsbG8lMjB3b3JsZCUyMiUwQWxhYmVscyUyMCUzRCUyMHByb2Nlc3Nvci50b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChwaXhlbF92YWx1ZXMlM0RwaXhlbF92YWx1ZXMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQSUwQSUyMyUyMGluZmVyZW5jZSUyMChnZW5lcmF0aW9uKSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShwaXhlbF92YWx1ZXMpJTBBZ2VuZXJhdGVkX3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, VisionEncoderDecoderModel
<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-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/trocr-base-handwritten&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;microsoft/trocr-base-handwritten&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load image from the IAM dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg&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><span class="hljs-comment"># training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.decoder_start_token_id = processor.tokenizer.cls_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = processor.tokenizer.pad_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.vocab_size = model.config.decoder.vocab_size

<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>text = <span class="hljs-string">&quot;hello world&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor.tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values=pixel_values, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># inference (generation)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-kvfsh7"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function Ba(J){let i,w="Example:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEElMjMlMjBpbml0aWFsaXplJTIwYSUyMHZpdC1iZXJ0JTIwZnJvbSUyMGElMjBwcmV0cmFpbmVkJTIwVmlUJTIwYW5kJTIwYSUyMHByZXRyYWluZWQlMjBCRVJUJTIwbW9kZWwuJTIwTm90ZSUyMHRoYXQlMjB0aGUlMjBjcm9zcy1hdHRlbnRpb24lMjBsYXllcnMlMjB3aWxsJTIwYmUlMjByYW5kb21seSUyMGluaXRpYWxpemVkJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIlMkMlMjAlMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUwQSklMEElMjMlMjBzYXZpbmclMjBtb2RlbCUyMGFmdGVyJTIwZmluZS10dW5pbmclMEFtb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIyLiUyRnZpdC1iZXJ0JTIyKSUwQSUyMyUyMGxvYWQlMjBmaW5lLXR1bmVkJTIwbW9kZWwlMEFtb2RlbCUyMCUzRCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ2aXQtYmVydCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a vit-bert from a pretrained ViT and a pretrained BERT model. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># saving model after fine-tuning</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;./vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load fine-tuned model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;./vit-bert&quot;</span>)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-11lpom8"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function Ga(J){let i,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){i=s("p"),i.innerHTML=w},l(h){i=a(h,"P",{"data-svelte-h":!0}),m(i)!=="svelte-fincs2"&&(i.innerHTML=w)},m(h,p){c(h,i,p)},p:D,d(h){h&&t(i)}}}function Xa(J){let i,w="Examples:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURlZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIpJTBBZGVjb2Rlcl90b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQSUwQSUyMyUyMGluaXRpYWxpemUlMjBhJTIwYmVydDJncHQyJTIwZnJvbSUyMGElMjBwcmV0cmFpbmVkJTIwQkVSVCUyMGFuZCUyMEdQVDIlMjBtb2RlbHMuJTIwTm90ZSUyMHRoYXQlMjB0aGUlMjBjcm9zcy1hdHRlbnRpb24lMjBsYXllcnMlMjB3aWxsJTIwYmUlMjByYW5kb21seSUyMGluaXRpYWxpemVkJTBBbW9kZWwlMjAlM0QlMjBURlZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9lbmNvZGVyX2RlY29kZXJfcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiUyQyUyMCUyMmdwdDIlMjIlMEEpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltZyUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEElMjMlMjBmb3J3YXJkJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltZyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLnBpeGVsX3ZhbHVlcyUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEFkZWNvZGVyX2lucHV0X2lkcyUyMCUzRCUyMGRlY29kZXJfdG9rZW5pemVyKCUyMkxpbmRhJTIwRGF2aXMlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHMlMjAlMjAlMjMlMjBCYXRjaCUyMHNpemUlMjAxJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKHBpeGVsX3ZhbHVlcyUzRHBpeGVsX3ZhbHVlcyUyQyUyMGRlY29kZXJfaW5wdXRfaWRzJTNEZGVjb2Rlcl9pbnB1dF9pZHMpJTBBJTBBJTIzJTIwdHJhaW5pbmclMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwocGl4ZWxfdmFsdWVzJTNEcGl4ZWxfdmFsdWVzJTJDJTIwZGVjb2Rlcl9pbnB1dF9pZHMlM0RkZWNvZGVyX2lucHV0X2lkcyUyQyUyMGxhYmVscyUzRGRlY29kZXJfaW5wdXRfaWRzKSUwQWxvc3MlMkMlMjBsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMkMlMjBvdXRwdXRzLmxvZ2l0cyUwQSUwQSUyMyUyMHNhdmUlMjBhbmQlMjBsb2FkJTIwZnJvbSUyMHByZXRyYWluZWQlMEFtb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIydml0LWdwdDIlMjIpJTBBbW9kZWwlMjAlM0QlMjBURlZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnZpdC1ncHQyJTIyKSUwQSUwQSUyMyUyMGdlbmVyYXRpb24lMEFnZW5lcmF0ZWQlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShwaXhlbF92YWx1ZXMlMkMlMjBkZWNvZGVyX3N0YXJ0X3Rva2VuX2lkJTNEbW9kZWwuY29uZmlnLmRlY29kZXIuYm9zX3Rva2VuX2lkKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, AutoTokenizer, TFVisionEncoderDecoderModel
<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-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a bert2gpt2 from a pretrained BERT and GPT2 models. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;gpt2&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>img = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(images=img, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).pixel_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = decoder_tokenizer(<span class="hljs-string">&quot;Linda Davis&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values=pixel_values, decoder_input_ids=decoder_input_ids)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values=pixel_values, decoder_input_ids=decoder_input_ids, labels=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, logits = outputs.loss, outputs.logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save and load from pretrained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;vit-gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;vit-gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generated = model.generate(pixel_values, decoder_start_token_id=model.config.decoder.bos_token_id)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-kvfsh7"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function za(J){let i,w="Example:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGVmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbCUwQSUwQSUyMyUyMGluaXRpYWxpemUlMjBhJTIwdml0LWJlcnQlMjBmcm9tJTIwYSUyMHByZXRyYWluZWQlMjBWaVQlMjBhbmQlMjBhJTIwcHJldHJhaW5lZCUyMEJFUlQlMjBtb2RlbC4lMjBOb3RlJTIwdGhhdCUyMHRoZSUyMGNyb3NzLWF0dGVudGlvbiUyMGxheWVycyUyMHdpbGwlMjBiZSUyMHJhbmRvbWx5JTIwaW5pdGlhbGl6ZWQlMEFtb2RlbCUyMCUzRCUyMFRGVmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX2VuY29kZXJfZGVjb2Rlcl9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0LWluMjFrJTIyJTJDJTIwJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIlMEEpJTBBJTIzJTIwc2F2aW5nJTIwbW9kZWwlMjBhZnRlciUyMGZpbmUtdHVuaW5nJTBBbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMi4lMkZ2aXQtYmVydCUyMiklMEElMjMlMjBsb2FkJTIwZmluZS10dW5lZCUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBURlZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ2aXQtYmVydCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFVisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a vit-bert from a pretrained ViT and a pretrained BERT model. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># saving model after fine-tuning</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;./vit-bert&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load fine-tuned model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;./vit-bert&quot;</span>)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-11lpom8"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function Na(J){let i,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){i=s("p"),i.innerHTML=w},l(h){i=a(h,"P",{"data-svelte-h":!0}),m(i)!=="svelte-fincs2"&&(i.innerHTML=w)},m(h,p){c(h,i,p)},p:D,d(h){h&&t(i)}}}function Da(J){let i,w="Examples:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTJDJTIwQXV0b0ltYWdlUHJvY2Vzc29yJTJDJTIwQXV0b1Rva2VuaXplciUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIpJTBBJTBBJTIzJTIwbG9hZCUyMG91dHB1dCUyMHRva2VuaXplciUwQXRva2VuaXplcl9vdXRwdXQlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQSUwQSUyMyUyMGluaXRpYWxpemUlMjBhJTIwdml0LWdwdDIlMjBmcm9tJTIwcHJldHJhaW5lZCUyMFZpVCUyMGFuZCUyMEdQVDIlMjBtb2RlbHMuJTIwTm90ZSUyMHRoYXQlMjB0aGUlMjBjcm9zcy1hdHRlbnRpb24lMjBsYXllcnMlMjB3aWxsJTIwYmUlMjByYW5kb21seSUyMGluaXRpYWxpemVkJTBBbW9kZWwlMjAlM0QlMjBGbGF4VmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX2VuY29kZXJfZGVjb2Rlcl9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0LWluMjFrJTIyJTJDJTIwJTIyZ3B0MiUyMiUwQSklMEElMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyKS5waXhlbF92YWx1ZXMlMEElMEElMjMlMjB1c2UlMjBHUFQyJ3MlMjBlb3NfdG9rZW4lMjBhcyUyMHRoZSUyMHBhZCUyMGFzJTIwd2VsbCUyMGFzJTIwZW9zJTIwdG9rZW4lMEFtb2RlbC5jb25maWcuZW9zX3Rva2VuX2lkJTIwJTNEJTIwbW9kZWwuY29uZmlnLmRlY29kZXIuZW9zX3Rva2VuX2lkJTBBbW9kZWwuY29uZmlnLnBhZF90b2tlbl9pZCUyMCUzRCUyMG1vZGVsLmNvbmZpZy5lb3NfdG9rZW5faWQlMEElMEElMjMlMjBnZW5lcmF0aW9uJTBBc2VxdWVuY2VzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUocGl4ZWxfdmFsdWVzJTJDJTIwbnVtX2JlYW1zJTNENCUyQyUyMG1heF9sZW5ndGglM0QxMikuc2VxdWVuY2VzJTBBJTBBY2FwdGlvbnMlMjAlM0QlMjB0b2tlbml6ZXJfb3V0cHV0LmJhdGNoX2RlY29kZShzZXF1ZW5jZXMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxVisionEncoderDecoderModel, AutoImageProcessor, AutoTokenizer
<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-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load output tokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer_output = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a vit-gpt2 from pretrained ViT and GPT2 models. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;gpt2&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;np&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># use GPT2&#x27;s eos_token as the pad as well as eos token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.eos_token_id = model.config.decoder.eos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = model.config.eos_token_id

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>sequences = model.generate(pixel_values, num_beams=<span class="hljs-number">4</span>, max_length=<span class="hljs-number">12</span>).sequences

<span class="hljs-meta">&gt;&gt;&gt; </span>captions = tokenizer_output.batch_decode(sequences, skip_special_tokens=<span class="hljs-literal">True</span>)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-kvfsh7"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function qa(J){let i,w="Example:",h,p,f;return p=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsJTBBJTBBJTIzJTIwaW5pdGlhbGl6ZSUyMGElMjB2aXQtZ3B0MiUyMGZyb20lMjBhJTIwcHJldHJhaW5lZCUyMFZpVCUyMGFuZCUyMGElMjBwcmV0cmFpbmVkJTIwR1BUMiUyMG1vZGVsLiUyME5vdGUlMjB0aGF0JTIwdGhlJTIwY3Jvc3MtYXR0ZW50aW9uJTIwbGF5ZXJzJTIwd2lsbCUyMGJlJTIwcmFuZG9tbHklMjBpbml0aWFsaXplZCUwQW1vZGVsJTIwJTNEJTIwRmxheFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9lbmNvZGVyX2RlY29kZXJfcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiUyQyUyMCUyMmdwdDIlMjIlMEEpJTBBJTIzJTIwc2F2aW5nJTIwbW9kZWwlMjBhZnRlciUyMGZpbmUtdHVuaW5nJTBBbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMi4lMkZ2aXQtZ3B0MiUyMiklMEElMjMlMjBsb2FkJTIwZmluZS10dW5lZCUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBGbGF4VmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnZpdC1ncHQyJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxVisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a vit-gpt2 from a pretrained ViT and a pretrained GPT2 model. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;gpt2&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># saving model after fine-tuning</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.save_pretrained(<span class="hljs-string">&quot;./vit-gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load fine-tuned model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxVisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;./vit-gpt2&quot;</span>)`}}),{c(){i=s("p"),i.textContent=w,h=r(),_(p.$$.fragment)},l(n){i=a(n,"P",{"data-svelte-h":!0}),m(i)!=="svelte-11lpom8"&&(i.textContent=w),h=l(n),M(p.$$.fragment,n)},m(n,j){c(n,i,j),c(n,h,j),y(p,n,j),f=!0},p:D,i(n){f||(b(p.$$.fragment,n),f=!0)},o(n){v(p.$$.fragment,n),f=!1},d(n){n&&(t(i),t(h)),T(p,n)}}}function Ha(J){let i,w,h,p,f,n,j,Ze,dn,go,gs="Vision Encoder Decoder Models",Tt,q,ee,at,ke,cn,fo,fs="Overview",wt,Ve,_s=`The <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> can be used to initialize an image-to-text model with any
pretrained Transformer-based vision model as the encoder (<em>e.g.</em> <a href="vit">ViT</a>, <a href="beit">BEiT</a>, <a href="deit">DeiT</a>, <a href="swin">Swin</a>)
and any pretrained language model as the decoder (<em>e.g.</em> <a href="roberta">RoBERTa</a>, <a href="gpt2">GPT2</a>, <a href="bert">BERT</a>, <a href="distilbert">DistilBERT</a>).`,jt,Je,Ms=`The effectiveness of initializing image-to-text-sequence models with pretrained checkpoints has been shown in (for
example) <a href="https://arxiv.org/abs/2109.10282" rel="nofollow">TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models</a> by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang,
Zhoujun Li, Furu Wei.`,Zt,We,ys=`After such a <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> has been trained/fine-tuned, it can be saved/loaded just like any other models (see the examples below
for more information).`,kt,xe,bs=`An example application is image captioning, in which the encoder is used to encode the image, after which an autoregressive language model generates
the caption. Another example is optical character recognition. Refer to <a href="trocr">TrOCR</a>, which is an instance of <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a>.`,Vt,H,oe,rt,Ee,pn,_o,vs="Randomly initializing <code>VisionEncoderDecoderModel</code> from model configurations.",Jt,Ue,Ts=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> can be randomly initialized from an encoder and a decoder config. In the following example, we show how to do this using the default <a href="/docs/transformers/v4.33.3/en/model_doc/vit#transformers.ViTModel">ViTModel</a> configuration for the encoder
and the default <code>BertForCausalLM</code> configuration for the decoder.`,Wt,$e,xt,Y,te,lt,Fe,mn,Mo,ws="Initialising <code>VisionEncoderDecoderModel</code> from a pretrained encoder and a pretrained decoder.",Et,Ce,js=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based vision model, <em>e.g.</em> <a href="swin">Swin</a>, can serve as the encoder and both pretrained auto-encoding models, <em>e.g.</em> BERT, pretrained causal language models, <em>e.g.</em> GPT2, as well as the pretrained decoder part of sequence-to-sequence models, <em>e.g.</em> decoder of BART, can be used as the decoder.
Depending on which architecture you choose as the decoder, the cross-attention layers might be randomly initialized.
Initializing <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> from a pretrained encoder and decoder checkpoint requires the model to be fine-tuned on a downstream task, as has been shown in <a href="https://huggingface.co/blog/warm-starting-encoder-decoder" rel="nofollow">the <em>Warm-starting-encoder-decoder blog post</em></a>.
To do so, the <code>VisionEncoderDecoderModel</code> class provides a <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained">VisionEncoderDecoderModel.from_encoder_decoder_pretrained()</a> method.`,Ut,Ie,$t,L,ne,dt,Re,hn,yo,Zs="Loading an existing <code>VisionEncoderDecoderModel</code> checkpoint and perform inference.",Ft,Be,ks='To load fine-tuned checkpoints of the <code>VisionEncoderDecoderModel</code> class, <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> provides the <code>from_pretrained(...)</code> method just like any other model architecture in Transformers.',Ct,Ge,Vs="To perform inference, one uses the <code>generate</code> method, which allows to autoregressively generate text. This method supports various forms of decoding, such as greedy, beam search and multinomial sampling.",It,Xe,Rt,S,se,it,ze,un,bo,Js="Loading a PyTorch checkpoint into <code>TFVisionEncoderDecoderModel</code>.",Bt,Ne,Ws=`<code>TFVisionEncoderDecoderModel.from_pretrained()</code> currently doesn’t support initializing the model from a
PyTorch checkpoint. Passing <code>from_pt=True</code> to this method will throw an exception. If there are only PyTorch
checkpoints for a particular vision encoder-decoder model, a workaround is:`,Gt,De,Xt,Q,ae,ct,qe,gn,vo,xs="Training",zt,He,Es=`Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (image, text) pairs.
As you can see, only 2 inputs are required for the model in order to compute a loss: <code>pixel_values</code> (which are the
images) and <code>labels</code> (which are the <code>input_ids</code> of the encoded target sequence).`,Nt,Ye,Dt,Le,Us=`This model was contributed by <a href="https://github.com/nielsrogge" rel="nofollow">nielsr</a>. This model’s TensorFlow and Flax versions
were contributed by <a href="https://github.com/ydshieh" rel="nofollow">ydshieh</a>.`,qt,P,re,pt,Se,fn,To,$s="VisionEncoderDecoderConfig",Ht,U,Qe,_n,wo,Fs=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a>. It is used to instantiate a Vision-Encoder-Text-Decoder model according to the
specified arguments, defining the encoder and decoder configs.`,Mn,jo,Cs=`Configuration objects inherit from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,yn,le,bn,de,Pe,vn,Zo,Is=`Instantiate a <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</a> (or a derived class) from a pre-trained encoder model
configuration and decoder model configuration.`,Yt,A,ie,mt,Ae,Tn,ko,Rs="VisionEncoderDecoderModel",Lt,Z,Oe,wn,Vo,Bs=`This class can be used to initialize an image-to-text-sequence model with any pretrained vision autoencoding model
as the encoder and any pretrained text autoregressive model as the decoder. The encoder is loaded via
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a> function and the decoder is loaded via <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a>
function. Cross-attention layers are automatically added to the decoder and should be fine-tuned on a downstream
generative task, like image captioning.`,jn,Jo,Gs=`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in <a href="https://arxiv.org/abs/1907.12461" rel="nofollow">Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks</a> by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`,Zn,Wo,Xs=`Additionally, in <a href="https://arxiv.org/abs/2109.10282" rel="nofollow">TrOCR: Transformer-based Optical Character Recognition with Pre-trained
Models</a> it is shown how leveraging large pretrained vision models for optical
character recognition (OCR) yields a significant performance improvement.`,kn,xo,zs=`After such a Vision-Encoder-Text-Decoder model has been trained/fine-tuned, it can be saved/loaded just like any
other models (see the examples for more information).`,Vn,Eo,Ns=`This model inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Jn,Uo,Ds=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Wn,$o,qs=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> is a generic model class that will be instantiated as a transformer architecture with
one of the base vision model classes of the library as encoder and another one as decoder when created with the
:meth<em>~transformers.AutoModel.from_pretrained</em> class method for the encoder and
:meth<em>~transformers.AutoModelForCausalLM.from_pretrained</em> class method for the decoder.`,xn,$,Ke,En,Fo,Hs='The <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel">VisionEncoderDecoderModel</a> forward method, overrides the <code>__call__</code> special method.',Un,ce,$n,pe,Fn,F,eo,Cn,Co,Ys=`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`,In,Io,Ls=`The model is set in evaluation mode by default using <code>model.eval()</code> (Dropout modules are deactivated). To train
the model, you need to first set it back in training mode with <code>model.train()</code>.`,Rn,me,St,O,he,ht,oo,Bn,Ro,Ss="TFVisionEncoderDecoderModel",Qt,k,to,Gn,Bo,Qs=`This class can be used to initialize an image-to-text-sequence model with any pretrained vision autoencoding model
as the encoder and any pretrained text autoregressive model as the decoder. The encoder is loaded via
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a> function and the decoder is loaded via <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a>
function. Cross-attention layers are automatically added to the decoder and should be fine-tuned on a downstream
generative task, like image captioning.`,Xn,Go,Ps=`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in <a href="https://arxiv.org/abs/1907.12461" rel="nofollow">Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks</a> by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`,zn,Xo,As=`Additionally, in <a href="https://arxiv.org/abs/2109.10282" rel="nofollow">TrOCR: Transformer-based Optical Character Recognition with Pre-trained
Models</a> it is shown how leveraging large pretrained vision models for optical
character recognition (OCR) yields a significant performance improvement.`,Nn,zo,Os=`After such a Vision-Encoder-Text-Decoder model has been trained/fine-tuned, it can be saved/loaded just like any
other models (see the examples for more information).`,Dn,No,Ks=`This model inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,qn,Do,ea=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">tf.keras.Model</a> subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`,Hn,qo,oa=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.TFVisionEncoderDecoderModel">TFVisionEncoderDecoderModel</a> is a generic model class that will be instantiated as a transformer architecture
with one of the base vision model classes of the library as encoder and another one of the base model classes as
decoder when created with the <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a> class method for the encoder and
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a> class method for the decoder.`,Yn,C,no,Ln,Ho,ta='The <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.TFVisionEncoderDecoderModel">TFVisionEncoderDecoderModel</a> forward method, overrides the <code>__call__</code> special method.',Sn,ue,Qn,ge,Pn,X,so,An,Yo,na=`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`,On,fe,Pt,K,_e,ut,ao,Kn,Lo,sa="FlaxVisionEncoderDecoderModel",At,V,ro,es,So,aa=`This class can be used to initialize an image-to-text-sequence model with any pretrained vision autoencoding model
as the encoder and any pretrained text autoregressive model as the decoder. The encoder is loaded via
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a> function and the decoder is loaded via <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained">from_pretrained()</a>
function. Cross-attention layers are automatically added to the decoder and should be fine-tuned on a downstream
generative task, like image captioning.`,os,Qo,ra=`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in <a href="https://arxiv.org/abs/1907.12461" rel="nofollow">Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks</a> by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`,ts,Po,la=`Additionally, in <a href="https://arxiv.org/abs/2109.10282" rel="nofollow">TrOCR: Transformer-based Optical Character Recognition with Pre-trained
Models</a> it is shown how leveraging large pretrained vision models for optical
character recognition (OCR) yields a significant performance improvement.`,ns,Ao,da=`After such a Vision-Encoder-Text-Decoder model has been trained/fine-tuned, it can be saved/loaded just like any
other models (see the examples for more information).`,ss,Oo,ia=`This model inherits from <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,as,Ko,ca=`This model is also a Flax Linen
<a href="https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html" rel="nofollow">flax.nn.Module</a> subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`,rs,et,pa=`<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.FlaxVisionEncoderDecoderModel">FlaxVisionEncoderDecoderModel</a> is a generic model class that will be instantiated as a transformer architecture
with the module (flax.nn.Module) of one of the base vision model classes of the library as encoder module and
another one as decoder module when created with the :meth<em>~transformers.FlaxAutoModel.from_pretrained</em> class method
for the encoder and :meth<em>~transformers.FlaxAutoModelForCausalLM.from_pretrained</em> class method for the decoder.`,ls,I,lo,ds,ot,ma='The <a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.FlaxVisionEncoderDecoderModel">FlaxVisionEncoderDecoderModel</a> forward method, overrides the <code>__call__</code> special method.',is,Me,cs,ye,ps,z,io,ms,tt,ha=`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`,hs,be,Ot,gt,Kt;return Ze=new G({}),ke=new G({}),Ee=new G({}),$e=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBWaVRDb25maWclMkMlMjBWaXNpb25FbmNvZGVyRGVjb2RlckNvbmZpZyUyQyUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEFjb25maWdfZW5jb2RlciUyMCUzRCUyMFZpVENvbmZpZygpJTBBY29uZmlnX2RlY29kZXIlMjAlM0QlMjBCZXJ0Q29uZmlnKCklMEElMEFjb25maWclMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2RlckNvbmZpZy5mcm9tX2VuY29kZXJfZGVjb2Rlcl9jb25maWdzKGNvbmZpZ19lbmNvZGVyJTJDJTIwY29uZmlnX2RlY29kZXIpJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsKGNvbmZpZyUzRGNvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, ViTConfig, VisionEncoderDecoderConfig, VisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span>config_encoder = ViTConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>config_decoder = BertConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span>config = VisionEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel(config=config)`}}),Fe=new G({}),Ie=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9lbmNvZGVyX2RlY29kZXJfcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJtaWNyb3NvZnQlMkZzd2luLWJhc2UtcGF0Y2g0LXdpbmRvdzctMjI0LWluMjJrJTIyJTJDJTIwJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;microsoft/swin-base-patch4-window7-224-in22k&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)`}}),Re=new G({}),Xe=new R({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwR1BUMlRva2VuaXplckZhc3QlMkMlMjBWaVRJbWFnZVByb2Nlc3NvciUyQyUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEElMjMlMjBsb2FkJTIwYSUyMGZpbmUtdHVuZWQlMjBpbWFnZSUyMGNhcHRpb25pbmclMjBtb2RlbCUyMGFuZCUyMGNvcnJlc3BvbmRpbmclMjB0b2tlbml6ZXIlMjBhbmQlMjBpbWFnZSUyMHByb2Nlc3NvciUwQW1vZGVsJTIwJTNEJTIwVmlzaW9uRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybmxwY29ubmVjdCUyRnZpdC1ncHQyLWltYWdlLWNhcHRpb25pbmclMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUMlRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMm5scGNvbm5lY3QlMkZ2aXQtZ3B0Mi1pbWFnZS1jYXB0aW9uaW5nJTIyKSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMFZpVEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJubHBjb25uZWN0JTJGdml0LWdwdDItaW1hZ2UtY2FwdGlvbmluZyUyMiklMEElMEElMjMlMjBsZXQncyUyMHBlcmZvcm0lMjBpbmZlcmVuY2UlMjBvbiUyMGFuJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikucGl4ZWxfdmFsdWVzJTBBJTBBJTIzJTIwYXV0b3JlZ3Jlc3NpdmVseSUyMGdlbmVyYXRlJTIwY2FwdGlvbiUyMCh1c2VzJTIwZ3JlZWR5JTIwZGVjb2RpbmclMjBieSUyMGRlZmF1bHQpJTBBZ2VuZXJhdGVkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKHBpeGVsX3ZhbHVlcyklMEFnZW5lcmF0ZWRfdGV4dCUyMCUzRCUyMHRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQlMEFwcmludChnZW5lcmF0ZWRfdGV4dCk=",highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2TokenizerFast, ViTImageProcessor, VisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load a fine-tuned image captioning model and corresponding tokenizer and image processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;nlpconnect/vit-gpt2-image-captioning&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2TokenizerFast.from_pretrained(<span class="hljs-string">&quot;nlpconnect/vit-gpt2-image-captioning&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = ViTImageProcessor.from_pretrained(<span class="hljs-string">&quot;nlpconnect/vit-gpt2-image-captioning&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s perform inference on an image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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)
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># autoregressively generate caption (uses greedy decoding by default)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(pixel_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
a cat laying on a blanket <span class="hljs-built_in">next</span> to a cat laying on a bed`}}),ze=new G({}),De=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMkMlMjBURlZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEFfbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJubHBjb25uZWN0JTJGdml0LWdwdDItaW1hZ2UtY2FwdGlvbmluZyUyMiklMEElMEFfbW9kZWwuZW5jb2Rlci5zYXZlX3ByZXRyYWluZWQoJTIyLiUyRmVuY29kZXIlMjIpJTBBX21vZGVsLmRlY29kZXIuc2F2ZV9wcmV0cmFpbmVkKCUyMi4lMkZkZWNvZGVyJTIyKSUwQSUwQW1vZGVsJTIwJTNEJTIwVEZWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyLiUyRmVuY29kZXIlMjIlMkMlMjAlMjIuJTJGZGVjb2RlciUyMiUyQyUyMGVuY29kZXJfZnJvbV9wdCUzRFRydWUlMkMlMjBkZWNvZGVyX2Zyb21fcHQlM0RUcnVlJTBBKSUwQSUyMyUyMFRoaXMlMjBpcyUyMG9ubHklMjBmb3IlMjBjb3B5aW5nJTIwc29tZSUyMHNwZWNpZmljJTIwYXR0cmlidXRlcyUyMG9mJTIwdGhpcyUyMHBhcnRpY3VsYXIlMjBtb2RlbC4lMEFtb2RlbC5jb25maWclMjAlM0QlMjBfbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VisionEncoderDecoderModel, TFVisionEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span>_model = VisionEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;nlpconnect/vit-gpt2-image-captioning&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>_model.encoder.save_pretrained(<span class="hljs-string">&quot;./encoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>_model.decoder.save_pretrained(<span class="hljs-string">&quot;./decoder&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;./encoder&quot;</span>, <span class="hljs-string">&quot;./decoder&quot;</span>, encoder_from_pt=<span class="hljs-literal">True</span>, decoder_from_pt=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># This is only for copying some specific attributes of this particular model.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config = _model.config`}}),qe=new G({}),Ye=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEltYWdlUHJvY2Vzc29yJTJDJTIwQmVydFRva2VuaXplciUyQyUyMFZpc2lvbkVuY29kZXJEZWNvZGVyTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBWaVRJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQmVydFRva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBWaXNpb25FbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGdml0LWJhc2UtcGF0Y2gxNi0yMjQtaW4yMWslMjIlMkMlMjAlMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUwQSklMEElMEFtb2RlbC5jb25maWcuZGVjb2Rlcl9zdGFydF90b2tlbl9pZCUyMCUzRCUyMHRva2VuaXplci5jbHNfdG9rZW5faWQlMEFtb2RlbC5jb25maWcucGFkX3Rva2VuX2lkJTIwJTNEJTIwdG9rZW5pemVyLnBhZF90b2tlbl9pZCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5waXhlbF92YWx1ZXMlMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIyYW4lMjBpbWFnZSUyMG9mJTIwdHdvJTIwY2F0cyUyMGNoaWxsaW5nJTIwb24lMjBhJTIwY291Y2glMjIlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBKS5pbnB1dF9pZHMlMEElMEElMjMlMjB0aGUlMjBmb3J3YXJkJTIwZnVuY3Rpb24lMjBhdXRvbWF0aWNhbGx5JTIwY3JlYXRlcyUyMHRoZSUyMGNvcnJlY3QlMjBkZWNvZGVyX2lucHV0X2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbChwaXhlbF92YWx1ZXMlM0RwaXhlbF92YWx1ZXMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTImageProcessor, BertTokenizer, VisionEncoderDecoderModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = ViTImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = BertTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.decoder_start_token_id = tokenizer.cls_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = tokenizer.pad_token_id

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;an image of two cats chilling on a couch&quot;</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the forward function automatically creates the correct decoder_input_ids</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(pixel_values=pixel_values, labels=labels).loss`}}),Se=new G({}),Qe=new B({props:{name:"class transformers.VisionEncoderDecoderConfig",anchor:"transformers.VisionEncoderDecoderConfig",parameters:[{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VisionEncoderDecoderConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments. Notably:</p>
<ul>
<li><strong>encoder</strong> (<a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>, <em>optional</em>) &#x2014; An instance of a configuration object that defines
the encoder config.</li>
<li><strong>decoder</strong> (<a href="/docs/transformers/v4.33.3/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>, <em>optional</em>) &#x2014; An instance of a configuration object that defines
the decoder config.</li>
</ul>`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py#L33"}}),le=new uo({props:{anchor:"transformers.VisionEncoderDecoderConfig.example",$$slots:{default:[Ca]},$$scope:{ctx:J}}}),Pe=new B({props:{name:"from_encoder_decoder_configs",anchor:"transformers.VisionEncoderDecoderConfig.from_encoder_decoder_configs",parameters:[{name:"encoder_config",val:": PretrainedConfig"},{name:"decoder_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py#L99",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig"
>VisionEncoderDecoderConfig</a></p>
`}}),Ae=new G({}),Oe=new B({props:{name:"class transformers.VisionEncoderDecoderModel",anchor:"transformers.VisionEncoderDecoderModel",parameters:[{name:"config",val:": typing.Optional[transformers.configuration_utils.PretrainedConfig] = None"},{name:"encoder",val:": typing.Optional[transformers.modeling_utils.PreTrainedModel] = None"},{name:"decoder",val:": typing.Optional[transformers.modeling_utils.PreTrainedModel] = None"}],parametersDescription:[{anchor:"transformers.VisionEncoderDecoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py#L151"}}),Ke=new B({props:{name:"forward",anchor:"transformers.VisionEncoderDecoderModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VisionEncoderDecoderModel.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 an image processor (e.g. if you use ViT as the encoder,
you should use <a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>). See <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.VisionEncoderDecoderModel.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>For training, <code>decoder_input_ids</code> are automatically created by the model by shifting the <code>labels</code> to the
right, replacing -100 by the <code>pad_token_id</code> and prepending them with the <code>decoder_start_token_id</code>.`,name:"decoder_input_ids"},{anchor:"transformers.VisionEncoderDecoderModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.VisionEncoderDecoderModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
This tuple must consist of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) is a tensor
of hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the
decoder.`,name:"encoder_outputs"},{anchor:"transformers.VisionEncoderDecoderModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.VisionEncoderDecoderModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. This is useful if you want more control over how to convert <code>decoder_input_ids</code> indices
into associated vectors than the model&#x2019;s internal embedding lookup matrix.`,name:"decoder_inputs_embeds"},{anchor:"transformers.VisionEncoderDecoderModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.VisionEncoderDecoderModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.VisionEncoderDecoderModel.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.VisionEncoderDecoderModel.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.VisionEncoderDecoderModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <code>~utils.Seq2SeqLMOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.VisionEncoderDecoderModel.forward.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014; Remaining dictionary of keyword arguments. Keyword arguments come in two flavors:</p>
<ul>
<li>Without a prefix which will be input as <code>**encoder_kwargs</code> for the encoder forward function.</li>
<li>With a <em>decoder_</em> prefix which will be input as <code>**decoder_kwargs</code> for the decoder forward function.</li>
</ul>`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py#L519",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> 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 (<a
  href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig"
>VisionEncoderDecoderConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new us({props:{$$slots:{default:[Ia]},$$scope:{ctx:J}}}),pe=new uo({props:{anchor:"transformers.VisionEncoderDecoderModel.forward.example",$$slots:{default:[Ra]},$$scope:{ctx:J}}}),eo=new B({props:{name:"from_encoder_decoder_pretrained",anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained",parameters:[{name:"encoder_pretrained_model_name_or_path",val:": str = None"},{name:"decoder_pretrained_model_name_or_path",val:": str = None"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained.encoder_pretrained_model_name_or_path",description:`<strong>encoder_pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Information necessary to initiate the image encoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co. An
example is <code>google/vit-base-patch16-224-in21k</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>tensorflow index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In
this case, <code>from_tf</code> should be set to <code>True</code> and a configuration object should be provided as
<code>config</code> argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.</li>
</ul>`,name:"encoder_pretrained_model_name_or_path"},{anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained.decoder_pretrained_model_name_or_path",description:`<strong>decoder_pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Information necessary to initiate the text decoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>tensorflow index checkpoint file</em> (e.g, <code>./tf_model/model.ckpt.index</code>). In
this case, <code>from_tf</code> should be set to <code>True</code> and a configuration object should be provided as
<code>config</code> argument. This loading path is slower than converting the TensorFlow checkpoint in a
PyTorch model using the provided conversion scripts and loading the PyTorch model afterwards.</li>
</ul>`,name:"decoder_pretrained_model_name_or_path"},{anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained.model_args",description:`<strong>model_args</strong> (remaining positional arguments, <em>optional</em>) &#x2014;
All remaning positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
<code>output_attentions=True</code>).</p>
<ul>
<li>To update the encoder configuration, use the prefix <em>encoder_</em> for each configuration parameter.</li>
<li>To update the decoder configuration, use the prefix <em>decoder_</em> for each configuration parameter.</li>
<li>To update the parent model configuration, do not use a prefix for each configuration parameter.</li>
</ul>
<p>Behaves differently depending on whether a <code>config</code> is provided or automatically loaded.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py#L365"}}),me=new uo({props:{anchor:"transformers.VisionEncoderDecoderModel.from_encoder_decoder_pretrained.example",$$slots:{default:[Ba]},$$scope:{ctx:J}}}),oo=new G({}),to=new B({props:{name:"class transformers.TFVisionEncoderDecoderModel",anchor:"transformers.TFVisionEncoderDecoderModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFVisionEncoderDecoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py#L176"}}),no=new B({props:{name:"call",anchor:"transformers.TFVisionEncoderDecoderModel.call",parameters:[{name:"pixel_values",val:": np.ndarray | tf.Tensor | None = None"},{name:"decoder_input_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"decoder_attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"encoder_outputs",val:": Optional[Union[Tuple, TFBaseModelOutput]] = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"decoder_inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFVisionEncoderDecoderModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using the vision&#x2019;s model&#x2019;s image processor. For example, using
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>Provide for sequence to sequence training to the decoder. Indices can be obtained using
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for
details.`,name:"decoder_input_ids"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(tf.Tensor)</code>, <em>optional</em>) &#x2014;
This tuple must consist of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) is a tensor of hidden-states at the output
of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(tf.Tensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. This is useful if you want more control over how to convert <code>decoder_input_ids</code> indices
into associated vectors than the model&#x2019;s internal embedding lookup matrix.`,name:"decoder_inputs_embeds"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.labels",description:`<strong>labels</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss for the decoder. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.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.TFVisionEncoderDecoderModel.call.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.TFVisionEncoderDecoderModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <code>~utils.Seq2SeqLMOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFVisionEncoderDecoderModel.call.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014; Remaining dictionary of keyword arguments. Keyword arguments come in two flavors:</p>
<ul>
<li>Without a prefix which will be input as <code>**encoder_kwargs</code> for the encoder forward function.</li>
<li>With a <em>decoder_</em> prefix which will be input as <code>**decoder_kwargs</code> for the decoder forward function.</li>
</ul>`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py#L486",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_tf_outputs.TFSeq2SeqLMOutput"
>transformers.modeling_tf_outputs.TFSeq2SeqLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig"
>VisionEncoderDecoderConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) — Language modeling loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) of the decoder that can be
used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_tf_outputs.TFSeq2SeqLMOutput"
>transformers.modeling_tf_outputs.TFSeq2SeqLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ue=new us({props:{$$slots:{default:[Ga]},$$scope:{ctx:J}}}),ge=new uo({props:{anchor:"transformers.TFVisionEncoderDecoderModel.call.example",$$slots:{default:[Xa]},$$scope:{ctx:J}}}),so=new B({props:{name:"from_encoder_decoder_pretrained",anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained",parameters:[{name:"encoder_pretrained_model_name_or_path",val:": str = None"},{name:"decoder_pretrained_model_name_or_path",val:": str = None"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained.encoder_pretrained_model_name_or_path",description:`<strong>encoder_pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Information necessary to initiate the encoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co. An
example is <code>google/vit-base-patch16-224-in21k</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>pytorch index checkpoint file</em> (e.g, <code>./pt_model/</code>). In this case,
<code>encoder_from_pt</code> should be set to <code>True</code>.</li>
</ul>`,name:"encoder_pretrained_model_name_or_path"},{anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained.decoder_pretrained_model_name_or_path",description:`<strong>decoder_pretrained_model_name_or_path</strong> (<code>str</code>, <em>optional</em>, defaults to <em>None</em>) &#x2014;
Information necessary to initiate the decoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.TFPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
<li>A path or url to a <em>pytorch checkpoint file</em> (e.g, <code>./pt_model/</code>). In this case,
<code>decoder_from_pt</code> should be set to <code>True</code>.</li>
</ul>`,name:"decoder_pretrained_model_name_or_path"},{anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained.model_args",description:`<strong>model_args</strong> (remaining positional arguments, <em>optional</em>) &#x2014;
All remaning positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
<code>output_attentions=True</code>).</p>
<ul>
<li>To update the encoder configuration, use the prefix <em>encoder_</em> for each configuration parameter.</li>
<li>To update the decoder configuration, use the prefix <em>decoder_</em> for each configuration parameter.</li>
<li>To update the parent model configuration, do not use a prefix for each configuration parameter.</li>
</ul>
<p>Behaves differently depending on whether a <code>config</code> is provided or automatically loaded.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_tf_vision_encoder_decoder.py#L338"}}),fe=new uo({props:{anchor:"transformers.TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained.example",$$slots:{default:[za]},$$scope:{ctx:J}}}),ao=new G({}),ro=new B({props:{name:"class transformers.FlaxVisionEncoderDecoderModel",anchor:"transformers.FlaxVisionEncoderDecoderModel",parameters:[{name:"config",val:": VisionEncoderDecoderConfig"},{name:"input_shape",val:": typing.Optional[typing.Tuple] = None"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxVisionEncoderDecoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig">VisionEncoderDecoderConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_flax_vision_encoder_decoder.py#L268"}}),lo=new B({props:{name:"__call__",anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__",parameters:[{name:"pixel_values",val:": Array"},{name:"decoder_input_ids",val:": typing.Optional[jax.Array] = None"},{name:"decoder_attention_mask",val:": typing.Optional[jax.Array] = None"},{name:"decoder_position_ids",val:": typing.Optional[jax.Array] = None"},{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"},{name:"train",val:": bool = False"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"}],parametersDescription:[{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.pixel_values",description:`<strong>pixel_values</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using the vision model&#x2019;s image processor. For example, using
<a href="/docs/transformers/v4.33.3/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.33.3/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.3/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a>`,name:"decoder_input_ids"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.decoder_position_ids",description:`<strong>decoder_position_ids</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each decoder input sequence tokens in the position embeddings. Selected in the
range <code>[0, config.decoder.max_position_embeddings - 1]</code>.`,name:"decoder_position_ids"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.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.FlaxVisionEncoderDecoderModel.__call__.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.FlaxVisionEncoderDecoderModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the model will return a <code>~utils.FlaxSeq2SeqLMOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_flax_vision_encoder_decoder.py#L598",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput"
>transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput</a> 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 (<a
  href="/docs/transformers/v4.33.3/en/model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderConfig"
>VisionEncoderDecoderConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(jnp.ndarray))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(jnp.ndarray)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.3/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput"
>transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new us({props:{$$slots:{default:[Na]},$$scope:{ctx:J}}}),ye=new uo({props:{anchor:"transformers.FlaxVisionEncoderDecoderModel.__call__.example",$$slots:{default:[Da]},$$scope:{ctx:J}}}),io=new B({props:{name:"from_encoder_decoder_pretrained",anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained",parameters:[{name:"encoder_pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"decoder_pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"*model_args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained.encoder_pretrained_model_name_or_path",description:`<strong>encoder_pretrained_model_name_or_path</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Information necessary to initiate the encoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co. An
example is <code>google/vit-base-patch16-224-in21k</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
</ul>`,name:"encoder_pretrained_model_name_or_path"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained.decoder_pretrained_model_name_or_path",description:`<strong>decoder_pretrained_model_name_or_path</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Information necessary to initiate the decoder. Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using
<a href="/docs/transformers/v4.33.3/en/main_classes/model#transformers.FlaxPreTrainedModel.save_pretrained">save_pretrained()</a>, e.g., <code>./my_model_directory/</code>.</li>
</ul>`,name:"decoder_pretrained_model_name_or_path"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained.model_args",description:`<strong>model_args</strong> (remaining positional arguments, <em>optional</em>) &#x2014;
All remaning positional arguments will be passed to the underlying model&#x2019;s <code>__init__</code> method.`,name:"model_args"},{anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to update the configuration object (after it being loaded) and initiate the model (e.g.,
<code>output_attentions=True</code>).</p>
<ul>
<li>To update the encoder configuration, use the prefix <em>encoder_</em> for each configuration parameter.</li>
<li>To update the decoder configuration, use the prefix <em>decoder_</em> for each configuration parameter.</li>
<li>To update the parent model configuration, do not use a prefix for each configuration parameter.</li>
</ul>
<p>Behaves differently depending on whether a <code>config</code> is provided or automatically loaded.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.33.3/src/transformers/models/vision_encoder_decoder/modeling_flax_vision_encoder_decoder.py#L723"}}),be=new uo({props:{anchor:"transformers.FlaxVisionEncoderDecoderModel.from_encoder_decoder_pretrained.example",$$slots:{default:[qa]},$$scope:{ctx:J}}}),{c(){i=s("meta"),w=r(),h=s("p"),p=r(),f=s("h1"),n=s("a"),j=s("span"),_(Ze.$$.fragment),dn=r(),go=s("span"),go.textContent=gs,Tt=r(),q=s("h2"),ee=s("a"),at=s("span"),_(ke.$$.fragment),cn=r(),fo=s("span"),fo.textContent=fs,wt=r(),Ve=s("p"),Ve.innerHTML=_s,jt=r(),Je=s("p"),Je.innerHTML=Ms,Zt=r(),We=s("p"),We.innerHTML=ys,kt=r(),xe=s("p"),xe.innerHTML=bs,Vt=r(),H=s("h2"),oe=s("a"),rt=s("span"),_(Ee.$$.fragment),pn=r(),_o=s("span"),_o.innerHTML=vs,Jt=r(),Ue=s("p"),Ue.innerHTML=Ts,Wt=r(),_($e.$$.fragment),xt=r(),Y=s("h2"),te=s("a"),lt=s("span"),_(Fe.$$.fragment),mn=r(),Mo=s("span"),Mo.innerHTML=ws,Et=r(),Ce=s("p"),Ce.innerHTML=js,Ut=r(),_(Ie.$$.fragment),$t=r(),L=s("h2"),ne=s("a"),dt=s("span"),_(Re.$$.fragment),hn=r(),yo=s("span"),yo.innerHTML=Zs,Ft=r(),Be=s("p"),Be.innerHTML=ks,Ct=r(),Ge=s("p"),Ge.innerHTML=Vs,It=r(),_(Xe.$$.fragment),Rt=r(),S=s("h2"),se=s("a"),it=s("span"),_(ze.$$.fragment),un=r(),bo=s("span"),bo.innerHTML=Js,Bt=r(),Ne=s("p"),Ne.innerHTML=Ws,Gt=r(),_(De.$$.fragment),Xt=r(),Q=s("h2"),ae=s("a"),ct=s("span"),_(qe.$$.fragment),gn=r(),vo=s("span"),vo.textContent=xs,zt=r(),He=s("p"),He.innerHTML=Es,Nt=r(),_(Ye.$$.fragment),Dt=r(),Le=s("p"),Le.innerHTML=Us,qt=r(),P=s("h2"),re=s("a"),pt=s("span"),_(Se.$$.fragment),fn=r(),To=s("span"),To.textContent=$s,Ht=r(),U=s("div"),_(Qe.$$.fragment),_n=r(),wo=s("p"),wo.innerHTML=Fs,Mn=r(),jo=s("p"),jo.innerHTML=Cs,yn=r(),_(le.$$.fragment),bn=r(),de=s("div"),_(Pe.$$.fragment),vn=r(),Zo=s("p"),Zo.innerHTML=Is,Yt=r(),A=s("h2"),ie=s("a"),mt=s("span"),_(Ae.$$.fragment),Tn=r(),ko=s("span"),ko.textContent=Rs,Lt=r(),Z=s("div"),_(Oe.$$.fragment),wn=r(),Vo=s("p"),Vo.innerHTML=Bs,jn=r(),Jo=s("p"),Jo.innerHTML=Gs,Zn=r(),Wo=s("p"),Wo.innerHTML=Xs,kn=r(),xo=s("p"),xo.textContent=zs,Vn=r(),Eo=s("p"),Eo.innerHTML=Ns,Jn=r(),Uo=s("p"),Uo.innerHTML=Ds,Wn=r(),$o=s("p"),$o.innerHTML=qs,xn=r(),$=s("div"),_(Ke.$$.fragment),En=r(),Fo=s("p"),Fo.innerHTML=Hs,Un=r(),_(ce.$$.fragment),$n=r(),_(pe.$$.fragment),Fn=r(),F=s("div"),_(eo.$$.fragment),Cn=r(),Co=s("p"),Co.textContent=Ys,In=r(),Io=s("p"),Io.innerHTML=Ls,Rn=r(),_(me.$$.fragment),St=r(),O=s("h2"),he=s("a"),ht=s("span"),_(oo.$$.fragment),Bn=r(),Ro=s("span"),Ro.textContent=Ss,Qt=r(),k=s("div"),_(to.$$.fragment),Gn=r(),Bo=s("p"),Bo.innerHTML=Qs,Xn=r(),Go=s("p"),Go.innerHTML=Ps,zn=r(),Xo=s("p"),Xo.innerHTML=As,Nn=r(),zo=s("p"),zo.textContent=Os,Dn=r(),No=s("p"),No.innerHTML=Ks,qn=r(),Do=s("p"),Do.innerHTML=ea,Hn=r(),qo=s("p"),qo.innerHTML=oa,Yn=r(),C=s("div"),_(no.$$.fragment),Ln=r(),Ho=s("p"),Ho.innerHTML=ta,Sn=r(),_(ue.$$.fragment),Qn=r(),_(ge.$$.fragment),Pn=r(),X=s("div"),_(so.$$.fragment),An=r(),Yo=s("p"),Yo.textContent=na,On=r(),_(fe.$$.fragment),Pt=r(),K=s("h2"),_e=s("a"),ut=s("span"),_(ao.$$.fragment),Kn=r(),Lo=s("span"),Lo.textContent=sa,At=r(),V=s("div"),_(ro.$$.fragment),es=r(),So=s("p"),So.innerHTML=aa,os=r(),Qo=s("p"),Qo.innerHTML=ra,ts=r(),Po=s("p"),Po.innerHTML=la,ns=r(),Ao=s("p"),Ao.textContent=da,ss=r(),Oo=s("p"),Oo.innerHTML=ia,as=r(),Ko=s("p"),Ko.innerHTML=ca,rs=r(),et=s("p"),et.innerHTML=pa,ls=r(),I=s("div"),_(lo.$$.fragment),ds=r(),ot=s("p"),ot.innerHTML=ma,is=r(),_(Me.$$.fragment),cs=r(),_(ye.$$.fragment),ps=r(),z=s("div"),_(io.$$.fragment),ms=r(),tt=s("p"),tt.textContent=ha,hs=r(),_(be.$$.fragment),Ot=r(),gt=s("p"),this.h()},l(e){const d=Fa("svelte-1phssyn",document.head);i=a(d,"META",{name:!0,content:!0}),d.forEach(t),w=l(e),h=a(e,"P",{}),g(h).forEach(t),p=l(e),f=a(e,"H1",{class:!0});var co=g(f);n=a(co,"A",{id:!0,class:!0,href:!0});var ft=g(n);j=a(ft,"SPAN",{});var _t=g(j);M(Ze.$$.fragment,_t),_t.forEach(t),ft.forEach(t),dn=l(co),go=a(co,"SPAN",{"data-svelte-h":!0}),m(go)!=="svelte-1ppaj05"&&(go.textContent=gs),co.forEach(t),Tt=l(e),q=a(e,"H2",{class:!0});var po=g(q);ee=a(po,"A",{id:!0,class:!0,href:!0});var Mt=g(ee);at=a(Mt,"SPAN",{});var yt=g(at);M(ke.$$.fragment,yt),yt.forEach(t),Mt.forEach(t),cn=l(po),fo=a(po,"SPAN",{"data-svelte-h":!0}),m(fo)!=="svelte-1jsw1pg"&&(fo.textContent=fs),po.forEach(t),wt=l(e),Ve=a(e,"P",{"data-svelte-h":!0}),m(Ve)!=="svelte-1m1ay6o"&&(Ve.innerHTML=_s),jt=l(e),Je=a(e,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-3c28cv"&&(Je.innerHTML=Ms),Zt=l(e),We=a(e,"P",{"data-svelte-h":!0}),m(We)!=="svelte-8m86m1"&&(We.innerHTML=ys),kt=l(e),xe=a(e,"P",{"data-svelte-h":!0}),m(xe)!=="svelte-iaod89"&&(xe.innerHTML=bs),Vt=l(e),H=a(e,"H2",{class:!0});var mo=g(H);oe=a(mo,"A",{id:!0,class:!0,href:!0});var bt=g(oe);rt=a(bt,"SPAN",{});var vt=g(rt);M(Ee.$$.fragment,vt),vt.forEach(t),bt.forEach(t),pn=l(mo),_o=a(mo,"SPAN",{"data-svelte-h":!0}),m(_o)!=="svelte-1gm2njo"&&(_o.innerHTML=vs),mo.forEach(t),Jt=l(e),Ue=a(e,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-1u8popb"&&(Ue.innerHTML=Ts),Wt=l(e),M($e.$$.fragment,e),xt=l(e),Y=a(e,"H2",{class:!0});var ho=g(Y);te=a(ho,"A",{id:!0,class:!0,href:!0});var ua=g(te);lt=a(ua,"SPAN",{});var ga=g(lt);M(Fe.$$.fragment,ga),ga.forEach(t),ua.forEach(t),mn=l(ho),Mo=a(ho,"SPAN",{"data-svelte-h":!0}),m(Mo)!=="svelte-169i8n6"&&(Mo.innerHTML=ws),ho.forEach(t),Et=l(e),Ce=a(e,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-fqxqv3"&&(Ce.innerHTML=js),Ut=l(e),M(Ie.$$.fragment,e),$t=l(e),L=a(e,"H2",{class:!0});var en=g(L);ne=a(en,"A",{id:!0,class:!0,href:!0});var fa=g(ne);dt=a(fa,"SPAN",{});var _a=g(dt);M(Re.$$.fragment,_a),_a.forEach(t),fa.forEach(t),hn=l(en),yo=a(en,"SPAN",{"data-svelte-h":!0}),m(yo)!=="svelte-13unqmy"&&(yo.innerHTML=Zs),en.forEach(t),Ft=l(e),Be=a(e,"P",{"data-svelte-h":!0}),m(Be)!=="svelte-5eh7wn"&&(Be.innerHTML=ks),Ct=l(e),Ge=a(e,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-otiwkm"&&(Ge.innerHTML=Vs),It=l(e),M(Xe.$$.fragment,e),Rt=l(e),S=a(e,"H2",{class:!0});var on=g(S);se=a(on,"A",{id:!0,class:!0,href:!0});var Ma=g(se);it=a(Ma,"SPAN",{});var ya=g(it);M(ze.$$.fragment,ya),ya.forEach(t),Ma.forEach(t),un=l(on),bo=a(on,"SPAN",{"data-svelte-h":!0}),m(bo)!=="svelte-xpt4iv"&&(bo.innerHTML=Js),on.forEach(t),Bt=l(e),Ne=a(e,"P",{"data-svelte-h":!0}),m(Ne)!=="svelte-ime2r"&&(Ne.innerHTML=Ws),Gt=l(e),M(De.$$.fragment,e),Xt=l(e),Q=a(e,"H2",{class:!0});var tn=g(Q);ae=a(tn,"A",{id:!0,class:!0,href:!0});var ba=g(ae);ct=a(ba,"SPAN",{});var va=g(ct);M(qe.$$.fragment,va),va.forEach(t),ba.forEach(t),gn=l(tn),vo=a(tn,"SPAN",{"data-svelte-h":!0}),m(vo)!=="svelte-1q1s287"&&(vo.textContent=xs),tn.forEach(t),zt=l(e),He=a(e,"P",{"data-svelte-h":!0}),m(He)!=="svelte-f1ugst"&&(He.innerHTML=Es),Nt=l(e),M(Ye.$$.fragment,e),Dt=l(e),Le=a(e,"P",{"data-svelte-h":!0}),m(Le)!=="svelte-52yqis"&&(Le.innerHTML=Us),qt=l(e),P=a(e,"H2",{class:!0});var nn=g(P);re=a(nn,"A",{id:!0,class:!0,href:!0});var Ta=g(re);pt=a(Ta,"SPAN",{});var wa=g(pt);M(Se.$$.fragment,wa),wa.forEach(t),Ta.forEach(t),fn=l(nn),To=a(nn,"SPAN",{"data-svelte-h":!0}),m(To)!=="svelte-ec8qhb"&&(To.textContent=$s),nn.forEach(t),Ht=l(e),U=a(e,"DIV",{class:!0});var N=g(U);M(Qe.$$.fragment,N),_n=l(N),wo=a(N,"P",{"data-svelte-h":!0}),m(wo)!=="svelte-a9zw9a"&&(wo.innerHTML=Fs),Mn=l(N),jo=a(N,"P",{"data-svelte-h":!0}),m(jo)!=="svelte-cfh5wl"&&(jo.innerHTML=Cs),yn=l(N),M(le.$$.fragment,N),bn=l(N),de=a(N,"DIV",{class:!0});var sn=g(de);M(Pe.$$.fragment,sn),vn=l(sn),Zo=a(sn,"P",{"data-svelte-h":!0}),m(Zo)!=="svelte-7j3bd9"&&(Zo.innerHTML=Is),sn.forEach(t),N.forEach(t),Yt=l(e),A=a(e,"H2",{class:!0});var an=g(A);ie=a(an,"A",{id:!0,class:!0,href:!0});var ja=g(ie);mt=a(ja,"SPAN",{});var Za=g(mt);M(Ae.$$.fragment,Za),Za.forEach(t),ja.forEach(t),Tn=l(an),ko=a(an,"SPAN",{"data-svelte-h":!0}),m(ko)!=="svelte-19dn9ii"&&(ko.textContent=Rs),an.forEach(t),Lt=l(e),Z=a(e,"DIV",{class:!0});var W=g(Z);M(Oe.$$.fragment,W),wn=l(W),Vo=a(W,"P",{"data-svelte-h":!0}),m(Vo)!=="svelte-11o0qfo"&&(Vo.innerHTML=Bs),jn=l(W),Jo=a(W,"P",{"data-svelte-h":!0}),m(Jo)!=="svelte-1faerbf"&&(Jo.innerHTML=Gs),Zn=l(W),Wo=a(W,"P",{"data-svelte-h":!0}),m(Wo)!=="svelte-yi0xwh"&&(Wo.innerHTML=Xs),kn=l(W),xo=a(W,"P",{"data-svelte-h":!0}),m(xo)!=="svelte-1q35eh4"&&(xo.textContent=zs),Vn=l(W),Eo=a(W,"P",{"data-svelte-h":!0}),m(Eo)!=="svelte-ev63c"&&(Eo.innerHTML=Ns),Jn=l(W),Uo=a(W,"P",{"data-svelte-h":!0}),m(Uo)!=="svelte-hswkmf"&&(Uo.innerHTML=Ds),Wn=l(W),$o=a(W,"P",{"data-svelte-h":!0}),m($o)!=="svelte-1muhc7f"&&($o.innerHTML=qs),xn=l(W),$=a(W,"DIV",{class:!0});var ve=g($);M(Ke.$$.fragment,ve),En=l(ve),Fo=a(ve,"P",{"data-svelte-h":!0}),m(Fo)!=="svelte-1v2vv29"&&(Fo.innerHTML=Hs),Un=l(ve),M(ce.$$.fragment,ve),$n=l(ve),M(pe.$$.fragment,ve),ve.forEach(t),Fn=l(W),F=a(W,"DIV",{class:!0});var Te=g(F);M(eo.$$.fragment,Te),Cn=l(Te),Co=a(Te,"P",{"data-svelte-h":!0}),m(Co)!=="svelte-n4p3zm"&&(Co.textContent=Ys),In=l(Te),Io=a(Te,"P",{"data-svelte-h":!0}),m(Io)!=="svelte-ce5sus"&&(Io.innerHTML=Ls),Rn=l(Te),M(me.$$.fragment,Te),Te.forEach(t),W.forEach(t),St=l(e),O=a(e,"H2",{class:!0});var rn=g(O);he=a(rn,"A",{id:!0,class:!0,href:!0});var ka=g(he);ht=a(ka,"SPAN",{});var Va=g(ht);M(oo.$$.fragment,Va),Va.forEach(t),ka.forEach(t),Bn=l(rn),Ro=a(rn,"SPAN",{"data-svelte-h":!0}),m(Ro)!=="svelte-rz6g64"&&(Ro.textContent=Ss),rn.forEach(t),Qt=l(e),k=a(e,"DIV",{class:!0});var x=g(k);M(to.$$.fragment,x),Gn=l(x),Bo=a(x,"P",{"data-svelte-h":!0}),m(Bo)!=="svelte-11o0qfo"&&(Bo.innerHTML=Qs),Xn=l(x),Go=a(x,"P",{"data-svelte-h":!0}),m(Go)!=="svelte-1faerbf"&&(Go.innerHTML=Ps),zn=l(x),Xo=a(x,"P",{"data-svelte-h":!0}),m(Xo)!=="svelte-yi0xwh"&&(Xo.innerHTML=As),Nn=l(x),zo=a(x,"P",{"data-svelte-h":!0}),m(zo)!=="svelte-1q35eh4"&&(zo.textContent=Os),Dn=l(x),No=a(x,"P",{"data-svelte-h":!0}),m(No)!=="svelte-1e9g3w8"&&(No.innerHTML=Ks),qn=l(x),Do=a(x,"P",{"data-svelte-h":!0}),m(Do)!=="svelte-1ivrf8m"&&(Do.innerHTML=ea),Hn=l(x),qo=a(x,"P",{"data-svelte-h":!0}),m(qo)!=="svelte-wl0hby"&&(qo.innerHTML=oa),Yn=l(x),C=a(x,"DIV",{class:!0});var we=g(C);M(no.$$.fragment,we),Ln=l(we),Ho=a(we,"P",{"data-svelte-h":!0}),m(Ho)!=="svelte-2mckex"&&(Ho.innerHTML=ta),Sn=l(we),M(ue.$$.fragment,we),Qn=l(we),M(ge.$$.fragment,we),we.forEach(t),Pn=l(x),X=a(x,"DIV",{class:!0});var nt=g(X);M(so.$$.fragment,nt),An=l(nt),Yo=a(nt,"P",{"data-svelte-h":!0}),m(Yo)!=="svelte-n4p3zm"&&(Yo.textContent=na),On=l(nt),M(fe.$$.fragment,nt),nt.forEach(t),x.forEach(t),Pt=l(e),K=a(e,"H2",{class:!0});var ln=g(K);_e=a(ln,"A",{id:!0,class:!0,href:!0});var Ja=g(_e);ut=a(Ja,"SPAN",{});var Wa=g(ut);M(ao.$$.fragment,Wa),Wa.forEach(t),Ja.forEach(t),Kn=l(ln),Lo=a(ln,"SPAN",{"data-svelte-h":!0}),m(Lo)!=="svelte-3aqoor"&&(Lo.textContent=sa),ln.forEach(t),At=l(e),V=a(e,"DIV",{class:!0});var E=g(V);M(ro.$$.fragment,E),es=l(E),So=a(E,"P",{"data-svelte-h":!0}),m(So)!=="svelte-11o0qfo"&&(So.innerHTML=aa),os=l(E),Qo=a(E,"P",{"data-svelte-h":!0}),m(Qo)!=="svelte-1faerbf"&&(Qo.innerHTML=ra),ts=l(E),Po=a(E,"P",{"data-svelte-h":!0}),m(Po)!=="svelte-yi0xwh"&&(Po.innerHTML=la),ns=l(E),Ao=a(E,"P",{"data-svelte-h":!0}),m(Ao)!=="svelte-1q35eh4"&&(Ao.textContent=da),ss=l(E),Oo=a(E,"P",{"data-svelte-h":!0}),m(Oo)!=="svelte-fs5cck"&&(Oo.innerHTML=ia),as=l(E),Ko=a(E,"P",{"data-svelte-h":!0}),m(Ko)!=="svelte-idybz1"&&(Ko.innerHTML=ca),rs=l(E),et=a(E,"P",{"data-svelte-h":!0}),m(et)!=="svelte-qai4qb"&&(et.innerHTML=pa),ls=l(E),I=a(E,"DIV",{class:!0});var je=g(I);M(lo.$$.fragment,je),ds=l(je),ot=a(je,"P",{"data-svelte-h":!0}),m(ot)!=="svelte-bb9p3d"&&(ot.innerHTML=ma),is=l(je),M(Me.$$.fragment,je),cs=l(je),M(ye.$$.fragment,je),je.forEach(t),ps=l(E),z=a(E,"DIV",{class:!0});var st=g(z);M(io.$$.fragment,st),ms=l(st),tt=a(st,"P",{"data-svelte-h":!0}),m(tt)!=="svelte-n4p3zm"&&(tt.textContent=ha),hs=l(st),M(be.$$.fragment,st),st.forEach(t),E.forEach(t),Ot=l(e),gt=a(e,"P",{}),g(gt).forEach(t),this.h()},h(){u(i,"name","hf:doc:metadata"),u(i,"content",JSON.stringify(Ya)),u(n,"id","vision-encoder-decoder-models"),u(n,"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"),u(n,"href","#vision-encoder-decoder-models"),u(f,"class","relative group"),u(ee,"id","overview"),u(ee,"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"),u(ee,"href","#overview"),u(q,"class","relative group"),u(oe,"id","randomly-initializing-visionencoderdecodermodel-from-model-configurations"),u(oe,"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"),u(oe,"href","#randomly-initializing-visionencoderdecodermodel-from-model-configurations"),u(H,"class","relative group"),u(te,"id","initialising-visionencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder"),u(te,"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"),u(te,"href","#initialising-visionencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder"),u(Y,"class","relative group"),u(ne,"id","loading-an-existing-visionencoderdecodermodel-checkpoint-and-perform-inference"),u(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"),u(ne,"href","#loading-an-existing-visionencoderdecodermodel-checkpoint-and-perform-inference"),u(L,"class","relative group"),u(se,"id","loading-a-pytorch-checkpoint-into-tfvisionencoderdecodermodel"),u(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"),u(se,"href","#loading-a-pytorch-checkpoint-into-tfvisionencoderdecodermodel"),u(S,"class","relative group"),u(ae,"id","training"),u(ae,"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"),u(ae,"href","#training"),u(Q,"class","relative group"),u(re,"id","transformers.VisionEncoderDecoderConfig"),u(re,"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"),u(re,"href","#transformers.VisionEncoderDecoderConfig"),u(P,"class","relative group"),u(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(ie,"id","transformers.VisionEncoderDecoderModel"),u(ie,"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"),u(ie,"href","#transformers.VisionEncoderDecoderModel"),u(A,"class","relative group"),u($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(he,"id","transformers.TFVisionEncoderDecoderModel"),u(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"),u(he,"href","#transformers.TFVisionEncoderDecoderModel"),u(O,"class","relative group"),u(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(_e,"id","transformers.FlaxVisionEncoderDecoderModel"),u(_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"),u(_e,"href","#transformers.FlaxVisionEncoderDecoderModel"),u(K,"class","relative group"),u(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,d){o(document.head,i),c(e,w,d),c(e,h,d),c(e,p,d),c(e,f,d),o(f,n),o(n,j),y(Ze,j,null),o(f,dn),o(f,go),c(e,Tt,d),c(e,q,d),o(q,ee),o(ee,at),y(ke,at,null),o(q,cn),o(q,fo),c(e,wt,d),c(e,Ve,d),c(e,jt,d),c(e,Je,d),c(e,Zt,d),c(e,We,d),c(e,kt,d),c(e,xe,d),c(e,Vt,d),c(e,H,d),o(H,oe),o(oe,rt),y(Ee,rt,null),o(H,pn),o(H,_o),c(e,Jt,d),c(e,Ue,d),c(e,Wt,d),y($e,e,d),c(e,xt,d),c(e,Y,d),o(Y,te),o(te,lt),y(Fe,lt,null),o(Y,mn),o(Y,Mo),c(e,Et,d),c(e,Ce,d),c(e,Ut,d),y(Ie,e,d),c(e,$t,d),c(e,L,d),o(L,ne),o(ne,dt),y(Re,dt,null),o(L,hn),o(L,yo),c(e,Ft,d),c(e,Be,d),c(e,Ct,d),c(e,Ge,d),c(e,It,d),y(Xe,e,d),c(e,Rt,d),c(e,S,d),o(S,se),o(se,it),y(ze,it,null),o(S,un),o(S,bo),c(e,Bt,d),c(e,Ne,d),c(e,Gt,d),y(De,e,d),c(e,Xt,d),c(e,Q,d),o(Q,ae),o(ae,ct),y(qe,ct,null),o(Q,gn),o(Q,vo),c(e,zt,d),c(e,He,d),c(e,Nt,d),y(Ye,e,d),c(e,Dt,d),c(e,Le,d),c(e,qt,d),c(e,P,d),o(P,re),o(re,pt),y(Se,pt,null),o(P,fn),o(P,To),c(e,Ht,d),c(e,U,d),y(Qe,U,null),o(U,_n),o(U,wo),o(U,Mn),o(U,jo),o(U,yn),y(le,U,null),o(U,bn),o(U,de),y(Pe,de,null),o(de,vn),o(de,Zo),c(e,Yt,d),c(e,A,d),o(A,ie),o(ie,mt),y(Ae,mt,null),o(A,Tn),o(A,ko),c(e,Lt,d),c(e,Z,d),y(Oe,Z,null),o(Z,wn),o(Z,Vo),o(Z,jn),o(Z,Jo),o(Z,Zn),o(Z,Wo),o(Z,kn),o(Z,xo),o(Z,Vn),o(Z,Eo),o(Z,Jn),o(Z,Uo),o(Z,Wn),o(Z,$o),o(Z,xn),o(Z,$),y(Ke,$,null),o($,En),o($,Fo),o($,Un),y(ce,$,null),o($,$n),y(pe,$,null),o(Z,Fn),o(Z,F),y(eo,F,null),o(F,Cn),o(F,Co),o(F,In),o(F,Io),o(F,Rn),y(me,F,null),c(e,St,d),c(e,O,d),o(O,he),o(he,ht),y(oo,ht,null),o(O,Bn),o(O,Ro),c(e,Qt,d),c(e,k,d),y(to,k,null),o(k,Gn),o(k,Bo),o(k,Xn),o(k,Go),o(k,zn),o(k,Xo),o(k,Nn),o(k,zo),o(k,Dn),o(k,No),o(k,qn),o(k,Do),o(k,Hn),o(k,qo),o(k,Yn),o(k,C),y(no,C,null),o(C,Ln),o(C,Ho),o(C,Sn),y(ue,C,null),o(C,Qn),y(ge,C,null),o(k,Pn),o(k,X),y(so,X,null),o(X,An),o(X,Yo),o(X,On),y(fe,X,null),c(e,Pt,d),c(e,K,d),o(K,_e),o(_e,ut),y(ao,ut,null),o(K,Kn),o(K,Lo),c(e,At,d),c(e,V,d),y(ro,V,null),o(V,es),o(V,So),o(V,os),o(V,Qo),o(V,ts),o(V,Po),o(V,ns),o(V,Ao),o(V,ss),o(V,Oo),o(V,as),o(V,Ko),o(V,rs),o(V,et),o(V,ls),o(V,I),y(lo,I,null),o(I,ds),o(I,ot),o(I,is),y(Me,I,null),o(I,cs),y(ye,I,null),o(V,ps),o(V,z),y(io,z,null),o(z,ms),o(z,tt),o(z,hs),y(be,z,null),c(e,Ot,d),c(e,gt,d),Kt=!0},p(e,[d]){const co={};d&2&&(co.$$scope={dirty:d,ctx:e}),le.$set(co);const ft={};d&2&&(ft.$$scope={dirty:d,ctx:e}),ce.$set(ft);const _t={};d&2&&(_t.$$scope={dirty:d,ctx:e}),pe.$set(_t);const po={};d&2&&(po.$$scope={dirty:d,ctx:e}),me.$set(po);const Mt={};d&2&&(Mt.$$scope={dirty:d,ctx:e}),ue.$set(Mt);const yt={};d&2&&(yt.$$scope={dirty:d,ctx:e}),ge.$set(yt);const mo={};d&2&&(mo.$$scope={dirty:d,ctx:e}),fe.$set(mo);const bt={};d&2&&(bt.$$scope={dirty:d,ctx:e}),Me.$set(bt);const vt={};d&2&&(vt.$$scope={dirty:d,ctx:e}),ye.$set(vt);const ho={};d&2&&(ho.$$scope={dirty:d,ctx:e}),be.$set(ho)},i(e){Kt||(b(Ze.$$.fragment,e),b(ke.$$.fragment,e),b(Ee.$$.fragment,e),b($e.$$.fragment,e),b(Fe.$$.fragment,e),b(Ie.$$.fragment,e),b(Re.$$.fragment,e),b(Xe.$$.fragment,e),b(ze.$$.fragment,e),b(De.$$.fragment,e),b(qe.$$.fragment,e),b(Ye.$$.fragment,e),b(Se.$$.fragment,e),b(Qe.$$.fragment,e),b(le.$$.fragment,e),b(Pe.$$.fragment,e),b(Ae.$$.fragment,e),b(Oe.$$.fragment,e),b(Ke.$$.fragment,e),b(ce.$$.fragment,e),b(pe.$$.fragment,e),b(eo.$$.fragment,e),b(me.$$.fragment,e),b(oo.$$.fragment,e),b(to.$$.fragment,e),b(no.$$.fragment,e),b(ue.$$.fragment,e),b(ge.$$.fragment,e),b(so.$$.fragment,e),b(fe.$$.fragment,e),b(ao.$$.fragment,e),b(ro.$$.fragment,e),b(lo.$$.fragment,e),b(Me.$$.fragment,e),b(ye.$$.fragment,e),b(io.$$.fragment,e),b(be.$$.fragment,e),Kt=!0)},o(e){v(Ze.$$.fragment,e),v(ke.$$.fragment,e),v(Ee.$$.fragment,e),v($e.$$.fragment,e),v(Fe.$$.fragment,e),v(Ie.$$.fragment,e),v(Re.$$.fragment,e),v(Xe.$$.fragment,e),v(ze.$$.fragment,e),v(De.$$.fragment,e),v(qe.$$.fragment,e),v(Ye.$$.fragment,e),v(Se.$$.fragment,e),v(Qe.$$.fragment,e),v(le.$$.fragment,e),v(Pe.$$.fragment,e),v(Ae.$$.fragment,e),v(Oe.$$.fragment,e),v(Ke.$$.fragment,e),v(ce.$$.fragment,e),v(pe.$$.fragment,e),v(eo.$$.fragment,e),v(me.$$.fragment,e),v(oo.$$.fragment,e),v(to.$$.fragment,e),v(no.$$.fragment,e),v(ue.$$.fragment,e),v(ge.$$.fragment,e),v(so.$$.fragment,e),v(fe.$$.fragment,e),v(ao.$$.fragment,e),v(ro.$$.fragment,e),v(lo.$$.fragment,e),v(Me.$$.fragment,e),v(ye.$$.fragment,e),v(io.$$.fragment,e),v(be.$$.fragment,e),Kt=!1},d(e){e&&(t(w),t(h),t(p),t(f),t(Tt),t(q),t(wt),t(Ve),t(jt),t(Je),t(Zt),t(We),t(kt),t(xe),t(Vt),t(H),t(Jt),t(Ue),t(Wt),t(xt),t(Y),t(Et),t(Ce),t(Ut),t($t),t(L),t(Ft),t(Be),t(Ct),t(Ge),t(It),t(Rt),t(S),t(Bt),t(Ne),t(Gt),t(Xt),t(Q),t(zt),t(He),t(Nt),t(Dt),t(Le),t(qt),t(P),t(Ht),t(U),t(Yt),t(A),t(Lt),t(Z),t(St),t(O),t(Qt),t(k),t(Pt),t(K),t(At),t(V),t(Ot),t(gt)),t(i),T(Ze),T(ke),T(Ee),T($e,e),T(Fe),T(Ie,e),T(Re),T(Xe,e),T(ze),T(De,e),T(qe),T(Ye,e),T(Se),T(Qe),T(le),T(Pe),T(Ae),T(Oe),T(Ke),T(ce),T(pe),T(eo),T(me),T(oo),T(to),T(no),T(ue),T(ge),T(so),T(fe),T(ao),T(ro),T(lo),T(Me),T(ye),T(io),T(be)}}}const Ya={local:"vision-encoder-decoder-models",sections:[{local:"overview",title:"Overview"},{local:"randomly-initializing-visionencoderdecodermodel-from-model-configurations",title:"Randomly initializing `VisionEncoderDecoderModel` from model configurations."},{local:"initialising-visionencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder",title:"Initialising `VisionEncoderDecoderModel` from a pretrained encoder and a pretrained decoder."},{local:"loading-an-existing-visionencoderdecodermodel-checkpoint-and-perform-inference",title:"Loading an existing `VisionEncoderDecoderModel` checkpoint and perform inference."},{local:"loading-a-pytorch-checkpoint-into-tfvisionencoderdecodermodel",title:"Loading a PyTorch checkpoint into `TFVisionEncoderDecoderModel`."},{local:"training",title:"Training"},{local:"transformers.VisionEncoderDecoderConfig",title:"VisionEncoderDecoderConfig"},{local:"transformers.VisionEncoderDecoderModel",title:"VisionEncoderDecoderModel"},{local:"transformers.TFVisionEncoderDecoderModel",title:"TFVisionEncoderDecoderModel"},{local:"transformers.FlaxVisionEncoderDecoderModel",title:"FlaxVisionEncoderDecoderModel"}],title:"Vision Encoder Decoder Models"};function La(J){return Ea(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class or extends Ua{constructor(i){super(),$a(this,i,La,Ha,xa,{})}}export{or as component};
