import{S as yc,i as bc,s as vc,e as r,k as i,w as b,t as n,M as Mc,c as s,d as t,m as p,a as d,x as v,h as a,b as c,G as e,g as u,y as M,q as w,o as j,B as T,v as wc,L as sn}from"../../chunks/vendor-hf-doc-builder.js";import{T as _c}from"../../chunks/Tip-hf-doc-builder.js";import{D as ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ie}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Re}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as rn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function jc(V){let m,E,_,f,y;return f=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBXYXYyVmVjMkNvbmZpZyUyQyUyMFNwZWVjaEVuY29kZXJEZWNvZGVyQ29uZmlnJTJDJTIwU3BlZWNoRW5jb2RlckRlY29kZXJNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBXYXYyVmVjMiUyMCUyNiUyMEJFUlQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWdfZW5jb2RlciUyMCUzRCUyMFdhdjJWZWMyQ29uZmlnKCklMEFjb25maWdfZGVjb2RlciUyMCUzRCUyMEJlcnRDb25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyQ29uZmlnLmZyb21fZW5jb2Rlcl9kZWNvZGVyX2NvbmZpZ3MoY29uZmlnX2VuY29kZXIlMkMlMjBjb25maWdfZGVjb2RlciklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwV2F2MlZlYzJCZXJ0JTIwbW9kZWwlMjBmcm9tJTIwYSUyMFdhdjJWZWMyJTIwJTI2JTIwYmVydC1iYXNlLXVuY2FzZWQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb25zJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsKGNvbmZpZyUzRGNvbmZpZyklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWdfZW5jb2RlciUyMCUzRCUyMG1vZGVsLmNvbmZpZy5lbmNvZGVyJTBBY29uZmlnX2RlY29kZXIlMjAlM0QlMjBtb2RlbC5jb25maWcuZGVjb2RlciUwQSUyMyUyMHNldCUyMGRlY29kZXIlMjBjb25maWclMjB0byUyMGNhdXNhbCUyMGxtJTBBY29uZmlnX2RlY29kZXIuaXNfZGVjb2RlciUyMCUzRCUyMFRydWUlMEFjb25maWdfZGVjb2Rlci5hZGRfY3Jvc3NfYXR0ZW50aW9uJTIwJTNEJTIwVHJ1ZSUwQSUwQSUyMyUyMFNhdmluZyUyMHRoZSUyMG1vZGVsJTJDJTIwaW5jbHVkaW5nJTIwaXRzJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsLnNhdmVfcHJldHJhaW5lZCglMjJteS1tb2RlbCUyMiklMEElMEElMjMlMjBsb2FkaW5nJTIwbW9kZWwlMjBhbmQlMjBjb25maWclMjBmcm9tJTIwcHJldHJhaW5lZCUyMGZvbGRlciUwQWVuY29kZXJfZGVjb2Rlcl9jb25maWclMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2RlckNvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIybXktbW9kZWwlMjIpJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJteS1tb2RlbCUyMiUyQyUyMGNvbmZpZyUzRGVuY29kZXJfZGVjb2Rlcl9jb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, Wav2Vec2Config, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Wav2Vec2Bert model from a Wav2Vec2 &amp; bert-base-uncased style configurations</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel(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 = SpeechEncoderDecoderConfig.from_pretrained(<span class="hljs-string">&quot;my-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;my-model&quot;</span>, config=encoder_decoder_config)`}}),{c(){m=r("p"),E=n("Examples:"),_=i(),b(f.$$.fragment)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Examples:"),g.forEach(t),_=p(l),v(f.$$.fragment,l)},m(l,g){u(l,m,g),e(m,E),u(l,_,g),M(f,l,g),y=!0},p:sn,i(l){y||(w(f.$$.fragment,l),y=!0)},o(l){j(f.$$.fragment,l),y=!1},d(l){l&&t(m),l&&t(_),T(f,l)}}}function Tc(V){let m,E,_,f,y;return{c(){m=r("p"),E=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),f=n("Module"),y=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var D=d(_);f=a(D,"Module"),D.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(l,g){u(l,m,g),e(m,E),e(m,_),e(_,f),e(m,y)},d(l){l&&t(m)}}}function Ec(V){let m,E,_,f,y;return f=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwlMkMlMjBBdXRvUHJvY2Vzc29yJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRndhdjJ2ZWMyLXhscy1yLTMwMG0tZW4tdG8tMTUlMjIpJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRndhdjJ2ZWMyLXhscy1yLTMwMG0tZW4tdG8tMTUlMjIpJTBBJTBBZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmxpYnJpc3BlZWNoX2Fzcl9kdW1teSUyMiUyQyUyMCUyMmNsZWFuJTIyJTJDJTIwc3BsaXQlM0QlMjJ2YWxpZGF0aW9uJTIyKSUwQSUwQWlucHV0X3ZhbHVlcyUyMCUzRCUyMHByb2Nlc3NvcihkcyU1QjAlNUQlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikuaW5wdXRfdmFsdWVzJTBBJTIzJTIwSW5mZXJlbmNlJTNBJTIwVHJhbnNsYXRlJTIwRW5nbGlzaCUyMHNwZWVjaCUyMHRvJTIwR2VybWFuJTBBZ2VuZXJhdGVkJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfdmFsdWVzKSUwQWRlY29kZWQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQlMEFkZWNvZGVkJTBBJTBBJTIzJTIwVHJhaW5pbmclM0ElMjBUcmFpbiUyMG1vZGVsJTIwb24lMjBFbmdsaXNoJTIwdHJhbnNjcmlwdGlvbiUwQWxhYmVscyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEZHMlNUIwJTVEJTVCJTIydGV4dCUyMiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQWxvc3MlMjAlM0QlMjBtb2RlbChpbnB1dF92YWx1ZXMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3MlMEFsb3NzLmJhY2t3YXJkKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SpeechEncoderDecoderModel, AutoProcessor
<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><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-xls-r-300m-en-to-15&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-xls-r-300m-en-to-15&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_values
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Inference: Translate English speech to German</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generated = model.generate(input_values)
<span class="hljs-meta">&gt;&gt;&gt; </span>decoded = processor.batch_decode(generated, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>decoded
<span class="hljs-string">&#x27;Mr. Quilter ist der Apostel der Mittelschicht und wir freuen uns, sein Evangelium willkommen hei\xDFen zu k\xF6nnen.&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Training: Train model on English transcription</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor(text=ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;text&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(input_values, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span>loss.backward()`}}),{c(){m=r("p"),E=n("Examples:"),_=i(),b(f.$$.fragment)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Examples:"),g.forEach(t),_=p(l),v(f.$$.fragment,l)},m(l,g){u(l,m,g),e(m,E),u(l,_,g),M(f,l,g),y=!0},p:sn,i(l){y||(w(f.$$.fragment,l),y=!0)},o(l){j(f.$$.fragment,l),y=!1},d(l){l&&t(m),l&&t(_),T(f,l)}}}function kc(V){let m,E,_,f,y;return f=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEElMjMlMjBpbml0aWFsaXplJTIwYSUyMHdhdjJ2ZWMyYmVydCUyMGZyb20lMjBhJTIwcHJldHJhaW5lZCUyMFdhdjJWZWMyJTIwYW5kJTIwYSUyMHByZXRyYWluZWQlMjBCRVJUJTIwbW9kZWwuJTIwTm90ZSUyMHRoYXQlMjB0aGUlMjBjcm9zcy1hdHRlbnRpb24lMjBsYXllcnMlMjB3aWxsJTIwYmUlMjByYW5kb21seSUyMGluaXRpYWxpemVkJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZmFjZWJvb2slMkZ3YXYydmVjMi1iYXNlLTk2MGglMjIlMkMlMjAlMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUwQSklMEElMjMlMjBzYXZpbmclMjBtb2RlbCUyMGFmdGVyJTIwZmluZS10dW5pbmclMEFtb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIyLiUyRndhdjJ2ZWMyYmVydCUyMiklMEElMjMlMjBsb2FkJTIwZmluZS10dW5lZCUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjIuJTJGd2F2MnZlYzJiZXJ0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SpeechEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a wav2vec2bert from a pretrained Wav2Vec2 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 = SpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&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;./wav2vec2bert&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 = SpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;./wav2vec2bert&quot;</span>)`}}),{c(){m=r("p"),E=n("Example:"),_=i(),b(f.$$.fragment)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Example:"),g.forEach(t),_=p(l),v(f.$$.fragment,l)},m(l,g){u(l,m,g),e(m,E),u(l,_,g),M(f,l,g),y=!0},p:sn,i(l){y||(w(f.$$.fragment,l),y=!0)},o(l){j(f.$$.fragment,l),y=!1},d(l){l&&t(m),l&&t(_),T(f,l)}}}function Zc(V){let m,E,_,f,y;return{c(){m=r("p"),E=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),f=n("Module"),y=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var D=d(_);f=a(D,"Module"),D.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(l,g){u(l,m,g),e(m,E),e(m,_),e(_,f),e(m,y)},d(l){l&&t(m)}}}function Jc(V){let m,E,_,f,y;return f=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQSUyMyUyMGxvYWQlMjBhJTIwZmluZS10dW5lZCUyMHdhdjJ2ZWMyLTItYmFydCUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBGbGF4U3BlZWNoRW5jb2RlckRlY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIycGF0cmlja3ZvbnBsYXRlbiUyRndhdjJ2ZWMyLTItYmFydC1sYXJnZSUyMiklMEElMjMlMjBsb2FkJTIwb3V0cHV0JTIwdG9rZW5pemVyJTBBdG9rZW5pemVyX291dHB1dCUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGYmFydC1sYXJnZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBqbnAub25lcygoMiUyQyUyMDUwMDApJTJDJTIwZHR5cGUlM0RqbnAuZmxvYXQzMiklMEElMEElMjMlMjB1c2UlMjBiYXJ0J3MlMjBzcGVjaWFsJTIwYm9zJTJDJTIwcGFkJTIwYW5kJTIwZW9zJTIwdG9rZW5zJTBBbW9kZWwuY29uZmlnLmRlY29kZXJfc3RhcnRfdG9rZW5faWQlMjAlM0QlMjBtb2RlbC5kZWNvZGVyLmNvbmZpZy5ib3NfdG9rZW5faWQlMEFtb2RlbC5jb25maWcucGFkX3Rva2VuX2lkJTIwJTNEJTIwbW9kZWwuZGVjb2Rlci5jb25maWcucGFkX3Rva2VuX2lkJTBBbW9kZWwuY29uZmlnLmVvc190b2tlbl9pZCUyMCUzRCUyMG1vZGVsLmRlY29kZXIuY29uZmlnLmVvc190b2tlbl9pZCUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxSpeechEncoderDecoderModel, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load a fine-tuned wav2vec2-2-bart model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxSpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/wav2vec2-2-bart-large&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;facebook/bart-large&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = jnp.ones((<span class="hljs-number">2</span>, <span class="hljs-number">5000</span>), dtype=jnp.float32)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># use bart&#x27;s special bos, pad and eos tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.decoder_start_token_id = model.decoder.config.bos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = model.decoder.config.pad_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.eos_token_id = model.decoder.config.eos_token_id

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs)
<span class="hljs-comment"># Assert something? More interesting input? dtype correct?</span>`}}),{c(){m=r("p"),E=n("Examples:"),_=i(),b(f.$$.fragment)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Examples:"),g.forEach(t),_=p(l),v(f.$$.fragment,l)},m(l,g){u(l,m,g),e(m,E),u(l,_,g),M(f,l,g),y=!0},p:sn,i(l){y||(w(f.$$.fragment,l),y=!0)},o(l){j(f.$$.fragment,l),y=!1},d(l){l&&t(m),l&&t(_),T(f,l)}}}function Wc(V){let m,E,_,f,y;return f=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZsYXhTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsJTBBJTBBJTIzJTIwaW5pdGlhbGl6ZSUyMGElMjB3YXYydmVjMi0yLWJhcnQlMjBmcm9tJTIwcHJldHJhaW5lZCUyMHdhdjJ2ZWMyJTIwYW5kJTIwYmFydCUyMG1vZGVscy4lMjBOb3RlJTIwdGhhdCUyMHRoZSUyMGNyb3NzLWF0dGVudGlvbiUyMGxheWVycyUyMHdpbGwlMjBiZSUyMHJhbmRvbWx5JTIwaW5pdGlhbGl6ZWQlMEFtb2RlbCUyMCUzRCUyMEZsYXhTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZmFjZWJvb2slMkZ3YXYydmVjMi1sYXJnZS1sdjYwJTIyJTJDJTIwJTIyZmFjZWJvb2slMkZiYXJ0LWxhcmdlJTIyJTBBKSUwQSUyMyUyMHNhdmluZyUyMG1vZGVsJTIwYWZ0ZXIlMjBmaW5lLXR1bmluZyUwQW1vZGVsLnNhdmVfcHJldHJhaW5lZCglMjIuJTJGd2F2MnZlYzItMi1iYXJ0LWxhcmdlJTIyKSUwQSUyMyUyMGxvYWQlMjBmaW5lLXR1bmVkJTIwbW9kZWwlMEFtb2RlbCUyMCUzRCUyMEZsYXhTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjIuJTJGd2F2MnZlYzItMi1iYXJ0LWxhcmdlJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FlaxSpeechEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initialize a wav2vec2-2-bart from pretrained wav2vec2 and bart models. Note that the cross-attention layers will be randomly initialized</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxSpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/wav2vec2-large-lv60&quot;</span>, <span class="hljs-string">&quot;facebook/bart-large&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;./wav2vec2-2-bart-large&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 = FlaxSpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;./wav2vec2-2-bart-large&quot;</span>)`}}),{c(){m=r("p"),E=n("Example:"),_=i(),b(f.$$.fragment)},l(l){m=s(l,"P",{});var g=d(m);E=a(g,"Example:"),g.forEach(t),_=p(l),v(f.$$.fragment,l)},m(l,g){u(l,m,g),e(m,E),u(l,_,g),M(f,l,g),y=!0},p:sn,i(l){y||(w(f.$$.fragment,l),y=!0)},o(l){j(f.$$.fragment,l),y=!1},d(l){l&&t(m),l&&t(_),T(f,l)}}}function Sc(V){let m,E,_,f,y,l,g,D,Kn,dn,x,ea,ko,oa,ta,it,na,aa,Zo,ra,sa,Jo,da,la,ln,N,ca,pt,ia,pa,Ce,ha,ma,cn,X,fa,Wo,ua,ga,So,_a,ya,pn,Q,pe,ht,Ge,ba,Fe,va,mt,Ma,wa,hn,Y,Uo,ja,Ta,$o,Ea,ka,ft,Za,Ja,mn,Be,fn,H,he,ut,ze,Wa,Ie,Sa,gt,Ua,$a,un,k,Vo,Va,xa,_t,Ra,Ca,xo,Ga,Fa,Ro,Ba,za,yt,Ia,Da,bt,Ya,Na,vt,Xa,qa,Co,Aa,Pa,me,Qa,Mt,Ha,La,wt,Oa,Ka,Go,er,or,gn,De,_n,L,fe,jt,Ye,tr,Ne,nr,Tt,ar,rr,yn,C,sr,Et,dr,lr,Fo,cr,ir,kt,pr,hr,bn,ue,mr,Zt,fr,ur,vn,Xe,Mn,O,ge,Jt,qe,gr,Wt,_r,wn,G,yr,St,br,vr,Ut,Mr,wr,$t,jr,Tr,jn,Ae,Tn,K,_e,Vt,Pe,Er,xt,kr,En,$,Qe,Zr,ye,Bo,Jr,Wr,zo,Sr,Ur,$r,ee,Vr,Io,xr,Rr,Do,Cr,Gr,Fr,be,Br,ve,He,zr,Le,Ir,Yo,Dr,Yr,Nr,Me,Oe,Xr,oe,qr,Rt,Ar,Pr,Ct,Qr,Hr,kn,te,we,Gt,Ke,Lr,Ft,Or,Zn,Z,eo,Kr,ne,es,No,os,ts,Xo,ns,as,rs,oo,ss,to,ds,ls,cs,no,is,ao,ps,hs,ms,Bt,fs,us,ro,gs,qo,_s,ys,bs,so,vs,lo,Ms,ws,js,q,Ao,Ts,Es,zt,ks,Zs,It,Js,Ws,Ss,F,co,Us,ae,$s,Po,Vs,xs,Dt,Rs,Cs,Gs,je,Fs,Te,Bs,B,io,zs,Yt,Is,Ds,re,Ys,Nt,Ns,Xs,Xt,qs,As,Ps,Ee,Jn,se,ke,qt,po,Qs,At,Hs,Wn,J,ho,Ls,de,Os,Qo,Ks,ed,Ho,od,td,nd,mo,ad,fo,rd,sd,dd,uo,ld,go,cd,id,pd,Pt,hd,md,_o,fd,Lo,ud,gd,_d,yo,yd,bo,bd,vd,Md,A,Oo,wd,jd,Qt,Td,Ed,Ht,kd,Zd,Jd,z,vo,Wd,le,Sd,Ko,Ud,$d,Lt,Vd,xd,Rd,Ze,Cd,Je,Gd,P,Mo,Fd,Ot,Bd,zd,We,Sn;return l=new Re({}),Ge=new Re({}),Be=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRDb25maWclMkMlMjBXYXYyVmVjMkNvbmZpZyUyQyUyMFNwZWVjaEVuY29kZXJEZWNvZGVyQ29uZmlnJTJDJTIwU3BlZWNoRW5jb2RlckRlY29kZXJNb2RlbCUwQSUwQWNvbmZpZ19lbmNvZGVyJTIwJTNEJTIwV2F2MlZlYzJDb25maWcoKSUwQWNvbmZpZ19kZWNvZGVyJTIwJTNEJTIwQmVydENvbmZpZygpJTBBJTBBY29uZmlnJTIwJTNEJTIwU3BlZWNoRW5jb2RlckRlY29kZXJDb25maWcuZnJvbV9lbmNvZGVyX2RlY29kZXJfY29uZmlncyhjb25maWdfZW5jb2RlciUyQyUyMGNvbmZpZ19kZWNvZGVyKSUwQW1vZGVsJTIwJTNEJTIwU3BlZWNoRW5jb2RlckRlY29kZXJNb2RlbChjb25maWclM0Rjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, Wav2Vec2Config, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span>config = SpeechEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel(config=config)`}}),ze=new Re({}),De=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9lbmNvZGVyX2RlY29kZXJfcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRmh1YmVydC1sYXJnZS1sbDYwayUyMiUyQyUyMCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SpeechEncoderDecoderModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/hubert-large-ll60k&quot;</span>, <span class="hljs-string">&quot;bert-base-uncased&quot;</span>
<span class="hljs-meta">... </span>)`}}),Ye=new Re({}),Xe=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyUHJvY2Vzc29yJTJDJTIwU3BlZWNoRW5jb2RlckRlY29kZXJNb2RlbCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTIzJTIwbG9hZCUyMGElMjBmaW5lLXR1bmVkJTIwc3BlZWNoJTIwdHJhbnNsYXRpb24lMjBtb2RlbCUyMGFuZCUyMGNvcnJlc3BvbmRpbmclMjBwcm9jZXNzb3IlMEFtb2RlbCUyMCUzRCUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGd2F2MnZlYzIteGxzLXItMzAwbS1lbi10by0xNSUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBXYXYyVmVjMlByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZ3YXYydmVjMi14bHMtci0zMDBtLWVuLXRvLTE1JTIyKSUwQSUwQSUyMyUyMGxldCdzJTIwcGVyZm9ybSUyMGluZmVyZW5jZSUyMG9uJTIwYSUyMHBpZWNlJTIwb2YlMjBFbmdsaXNoJTIwc3BlZWNoJTIwKHdoaWNoJTIwd2UnbGwlMjB0cmFuc2xhdGUlMjB0byUyMEdlcm1hbiklMEFkcyUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2R1bW15JTIyJTJDJTIwJTIyY2xlYW4lMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIpJTBBaW5wdXRfdmFsdWVzJTIwJTNEJTIwcHJvY2Vzc29yKGRzJTVCMCU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyYXJyYXklMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF92YWx1ZXMlMEElMEElMjMlMjBhdXRvcmVncmVzc2l2ZWx5JTIwZ2VuZXJhdGUlMjB0cmFuc2NyaXB0aW9uJTIwKHVzZXMlMjBncmVlZHklMjBkZWNvZGluZyUyMGJ5JTIwZGVmYXVsdCklMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfdmFsdWVzKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCUwQXByaW50KGdlbmVyYXRlZF90ZXh0KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2Processor, SpeechEncoderDecoderModel
<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><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load a fine-tuned speech translation model and corresponding processor</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-xls-r-300m-en-to-15&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Wav2Vec2Processor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-xls-r-300m-en-to-15&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s perform inference on a piece of English speech (which we&#x27;ll translate to German)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_values

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># autoregressively generate transcription (uses greedy decoding by default)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(input_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>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(generated_text)
Mr. Quilter ist der Apostel der Mittelschicht und wir freuen uns, sein Evangelium willkommen hei\xDFen zu k\xF6nnen.`}}),qe=new Re({}),Ae=new ie({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvRmVhdHVyZUV4dHJhY3RvciUyQyUyMFNwZWVjaEVuY29kZXJEZWNvZGVyTW9kZWwlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFlbmNvZGVyX2lkJTIwJTNEJTIwJTIyZmFjZWJvb2slMkZ3YXYydmVjMi1iYXNlLTk2MGglMjIlMjAlMjAlMjMlMjBhY291c3RpYyUyMG1vZGVsJTIwZW5jb2RlciUwQWRlY29kZXJfaWQlMjAlM0QlMjAlMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyMCUyMCUyMyUyMHRleHQlMjBkZWNvZGVyJTBBJTBBZmVhdHVyZV9leHRyYWN0b3IlMjAlM0QlMjBBdXRvRmVhdHVyZUV4dHJhY3Rvci5mcm9tX3ByZXRyYWluZWQoZW5jb2Rlcl9pZCklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChkZWNvZGVyX2lkKSUwQSUyMyUyMENvbWJpbmUlMjBwcmUtdHJhaW5lZCUyMGVuY29kZXIlMjBhbmQlMjBwcmUtdHJhaW5lZCUyMGRlY29kZXIlMjB0byUyMGZvcm0lMjBhJTIwU2VxMlNlcSUyMG1vZGVsJTBBbW9kZWwlMjAlM0QlMjBTcGVlY2hFbmNvZGVyRGVjb2Rlck1vZGVsLmZyb21fZW5jb2Rlcl9kZWNvZGVyX3ByZXRyYWluZWQoZW5jb2Rlcl9pZCUyQyUyMGRlY29kZXJfaWQpJTBBJTBBbW9kZWwuY29uZmlnLmRlY29kZXJfc3RhcnRfdG9rZW5faWQlMjAlM0QlMjB0b2tlbml6ZXIuY2xzX3Rva2VuX2lkJTBBbW9kZWwuY29uZmlnLnBhZF90b2tlbl9pZCUyMCUzRCUyMHRva2VuaXplci5wYWRfdG9rZW5faWQlMEElMEElMjMlMjBsb2FkJTIwYW4lMjBhdWRpbyUyMGlucHV0JTIwYW5kJTIwcHJlLXByb2Nlc3MlMjAobm9ybWFsaXNlJTIwbWVhbiUyRnN0ZCUyMHRvJTIwMCUyRjEpJTBBZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmxpYnJpc3BlZWNoX2Fzcl9kdW1teSUyMiUyQyUyMCUyMmNsZWFuJTIyJTJDJTIwc3BsaXQlM0QlMjJ2YWxpZGF0aW9uJTIyKSUwQWlucHV0X3ZhbHVlcyUyMCUzRCUyMGZlYXR1cmVfZXh0cmFjdG9yKGRzJTVCMCU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyYXJyYXklMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF92YWx1ZXMlMEElMEElMjMlMjBsb2FkJTIwaXRzJTIwY29ycmVzcG9uZGluZyUyMHRyYW5zY3JpcHRpb24lMjBhbmQlMjB0b2tlbml6ZSUyMHRvJTIwZ2VuZXJhdGUlMjBsYWJlbHMlMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoZHMlNUIwJTVEJTVCJTIydGV4dCUyMiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQSUyMyUyMHRoZSUyMGZvcndhcmQlMjBmdW5jdGlvbiUyMGF1dG9tYXRpY2FsbHklMjBjcmVhdGVzJTIwdGhlJTIwY29ycmVjdCUyMGRlY29kZXJfaW5wdXRfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRfZmVhdHVyZXMpLmxvc3MlMEFsb3NzLmJhY2t3YXJkKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoFeatureExtractor, SpeechEncoderDecoderModel
<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>encoder_id = <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>  <span class="hljs-comment"># acoustic model encoder</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_id = <span class="hljs-string">&quot;bert-base-uncased&quot;</span>  <span class="hljs-comment"># text decoder</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(encoder_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(decoder_id)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Combine pre-trained encoder and pre-trained decoder to form a Seq2Seq model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_encoder_decoder_pretrained(encoder_id, decoder_id)

<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><span class="hljs-comment"># load an audio input and pre-process (normalise mean/std to 0/1)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = feature_extractor(ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_values

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load its corresponding transcription and tokenize to generate labels</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;text&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</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(**input_features).loss
<span class="hljs-meta">&gt;&gt;&gt; </span>loss.backward()`}}),Pe=new Re({}),Qe=new ce({props:{name:"class transformers.SpeechEncoderDecoderConfig",anchor:"transformers.SpeechEncoderDecoderConfig",parameters:[{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SpeechEncoderDecoderConfig.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.31.0/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.31.0/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.31.0/src/transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py#L27"}}),be=new rn({props:{anchor:"transformers.SpeechEncoderDecoderConfig.example",$$slots:{default:[jc]},$$scope:{ctx:V}}}),He=new ce({props:{name:"from_encoder_decoder_configs",anchor:"transformers.SpeechEncoderDecoderConfig.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.31.0/src/transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py#L93",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig"
>SpeechEncoderDecoderConfig</a></p>
`}}),Oe=new ce({props:{name:"to_dict",anchor:"transformers.SpeechEncoderDecoderConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py#L110",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),Ke=new Re({}),eo=new ce({props:{name:"class transformers.SpeechEncoderDecoderModel",anchor:"transformers.SpeechEncoderDecoderModel",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.SpeechEncoderDecoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig">SpeechEncoderDecoderConfig</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.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py#L173"}}),co=new ce({props:{name:"forward",anchor:"transformers.SpeechEncoderDecoderModel.forward",parameters:[{name:"inputs",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",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:"input_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"input_features",val:": typing.Optional[torch.FloatTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SpeechEncoderDecoderModel.forward.inputs",description:`<strong>inputs</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code> or <code>(batch_size, sequence_length, feature_dim)</code>, <em>optional</em>) &#x2014;
Float values of input raw speech waveform or speech features. Values can be obtained by loading a <code>.flac</code>
or <code>.wav</code> audio file into an array of type <code>List[float]</code> or a <code>numpy.ndarray</code>, <em>e.g.</em> via the soundfile
library (<code>pip install soundfile</code>). To prepare the array into <code>inputs</code>, either the <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor">Wav2Vec2Processor</a> or
<a href="/docs/transformers/v4.31.0/en/model_doc/speech_to_text#transformers.Speech2TextProcessor">Speech2TextProcessor</a> should be used for padding and conversion into a tensor of type
<code>torch.FloatTensor</code>.`,name:"inputs"},{anchor:"transformers.SpeechEncoderDecoderModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.SpeechEncoderDecoderModel.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.31.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>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>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Float values of input raw speech waveform. Values can be obtained by loading a <em>.flac</em> or <em>.wav</em> audio file
into an array of type <em>List[float]</em> or a <em>numpy.ndarray</em>, <em>e.g.</em> via the soundfile library (<em>pip install
soundfile</em>). To prepare the array into <em>input_values</em>, the <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor">Wav2Vec2Processor</a> should be used for padding
and conversion into a tensor of type <em>torch.FloatTensor</em>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.SpeechEncoderDecoderModel.forward.input_features",description:`<strong>input_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, feature_size)</code>, <em>optional</em>) &#x2014;
Float values of fbank features extracted from the raw speech waveform. Raw speech waveform can be obtained
by loading a <code>.flac</code> or <code>.wav</code> audio file into an array of type <code>List[float]</code> or a <code>numpy.ndarray</code>, <em>e.g.</em>
via the soundfile library (<code>pip install soundfile</code>). To prepare the array into <code>input_features</code>, the
<a href="/docs/transformers/v4.31.0/en/model_doc/speech_to_text#transformers.Speech2TextFeatureExtractor">Speech2TextFeatureExtractor</a> should be used for extracting the fbank features, padding and conversion
into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/v4.31.0/en/model_doc/speech_to_text#transformers.Speech2TextFeatureExtractor.__call__"><strong>call</strong>()</a>`,name:"input_features"},{anchor:"transformers.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.31.0/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py#L442",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig"
>SpeechEncoderDecoderConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the 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>) \u2014 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>) \u2014 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\u2019s 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>) \u2014 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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the 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>) \u2014 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.31.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new _c({props:{$$slots:{default:[Tc]},$$scope:{ctx:V}}}),Te=new rn({props:{anchor:"transformers.SpeechEncoderDecoderModel.forward.example",$$slots:{default:[Ec]},$$scope:{ctx:V}}}),io=new ce({props:{name:"from_encoder_decoder_pretrained",anchor:"transformers.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.
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.31.0/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.SpeechEncoderDecoderModel.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 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.31.0/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.SpeechEncoderDecoderModel.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.SpeechEncoderDecoderModel.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.31.0/src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py#L287"}}),Ee=new rn({props:{anchor:"transformers.SpeechEncoderDecoderModel.from_encoder_decoder_pretrained.example",$$slots:{default:[kc]},$$scope:{ctx:V}}}),po=new Re({}),ho=new ce({props:{name:"class transformers.FlaxSpeechEncoderDecoderModel",anchor:"transformers.FlaxSpeechEncoderDecoderModel",parameters:[{name:"config",val:": SpeechEncoderDecoderConfig"},{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.FlaxSpeechEncoderDecoderModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig">SpeechEncoderDecoderConfig</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.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxSpeechEncoderDecoderModel.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.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/speech_encoder_decoder/modeling_flax_speech_encoder_decoder.py#L329"}}),vo=new ce({props:{name:"__call__",anchor:"transformers.FlaxSpeechEncoderDecoderModel.__call__",parameters:[{name:"inputs",val:": Array"},{name:"attention_mask",val:": typing.Optional[jax.Array] = None"},{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:"freeze_feature_encoder",val:": bool = False"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"}],parametersDescription:[{anchor:"transformers.FlaxSpeechEncoderDecoderModel.__call__.inputs",description:`<strong>inputs</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code> or <code>(batch_size, sequence_length, feature_dim)</code>, <em>optional</em>) &#x2014;
Float values of input raw speech waveform or speech features. Values can be obtained by loading a <code>.flac</code>
or <code>.wav</code> audio file into an array of type <code>List[float]</code> or a <code>numpy.ndarray</code>, <em>e.g.</em> via the soundfile
library (<code>pip install soundfile</code>). To prepare the array into <code>inputs</code>, either the <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor">Wav2Vec2Processor</a> or
<a href="/docs/transformers/v4.31.0/en/model_doc/speech_to_text#transformers.Speech2TextProcessor">Speech2TextProcessor</a> should be used for padding and conversion into a tensor of type
<code>torch.FloatTensor</code>.`,name:"inputs"},{anchor:"transformers.FlaxSpeechEncoderDecoderModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxSpeechEncoderDecoderModel.__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.31.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__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 sequence to sequence training, <code>decoder_input_ids</code> should be provided. <code>decoder_input_ids</code> should be
created outside of 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.FlaxSpeechEncoderDecoderModel.__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.FlaxSpeechEncoderDecoderModel.__call__.decoder_position_ids",description:`<strong>decoder_position_ids</strong> (<code>numpy.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.FlaxSpeechEncoderDecoderModel.__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.FlaxSpeechEncoderDecoderModel.__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.31.0/src/transformers/models/speech_encoder_decoder/modeling_flax_speech_encoder_decoder.py#L660",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig"
>SpeechEncoderDecoderConfig</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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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\u2019s 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>) \u2014 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>) \u2014 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>) \u2014 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.31.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput"
>transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ze=new _c({props:{$$slots:{default:[Zc]},$$scope:{ctx:V}}}),Je=new rn({props:{anchor:"transformers.FlaxSpeechEncoderDecoderModel.__call__.example",$$slots:{default:[Jc]},$$scope:{ctx:V}}}),Mo=new ce({props:{name:"from_encoder_decoder_pretrained",anchor:"transformers.FlaxSpeechEncoderDecoderModel.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.FlaxSpeechEncoderDecoderModel.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.
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.31.0/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.FlaxSpeechEncoderDecoderModel.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.31.0/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.FlaxSpeechEncoderDecoderModel.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.FlaxSpeechEncoderDecoderModel.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.31.0/src/transformers/models/speech_encoder_decoder/modeling_flax_speech_encoder_decoder.py#L782"}}),We=new rn({props:{anchor:"transformers.FlaxSpeechEncoderDecoderModel.from_encoder_decoder_pretrained.example",$$slots:{default:[Wc]},$$scope:{ctx:V}}}),{c(){m=r("meta"),E=i(),_=r("h1"),f=r("a"),y=r("span"),b(l.$$.fragment),g=i(),D=r("span"),Kn=n("Speech Encoder Decoder Models"),dn=i(),x=r("p"),ea=n("The "),ko=r("a"),oa=n("SpeechEncoderDecoderModel"),ta=n(` can be used to initialize a speech-to-text model
with any pretrained speech autoencoding model as the encoder (`),it=r("em"),na=n("e.g."),aa=i(),Zo=r("a"),ra=n("Wav2Vec2"),sa=n(", "),Jo=r("a"),da=n("Hubert"),la=n(") and any pretrained autoregressive model as the decoder."),ln=i(),N=r("p"),ca=n(`The effectiveness of initializing speech-sequence-to-text-sequence models with pretrained checkpoints for speech
recognition and speech translation has `),pt=r("em"),ia=n("e.g."),pa=n(" been shown in "),Ce=r("a"),ha=n(`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),ma=n(` by Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli,
Alexis Conneau.`),cn=i(),X=r("p"),fa=n("An example of how to use a "),Wo=r("a"),ua=n("SpeechEncoderDecoderModel"),ga=n(" for inference can be seen in "),So=r("a"),_a=n("Speech2Text2"),ya=n("."),pn=i(),Q=r("h2"),pe=r("a"),ht=r("span"),b(Ge.$$.fragment),ba=i(),Fe=r("span"),va=n("Randomly initializing "),mt=r("code"),Ma=n("SpeechEncoderDecoderModel"),wa=n(" from model configurations."),hn=i(),Y=r("p"),Uo=r("a"),ja=n("SpeechEncoderDecoderModel"),Ta=n(" can be randomly initialized from an encoder and a decoder config. In the following example, we show how to do this using the default "),$o=r("a"),Ea=n("Wav2Vec2Model"),ka=n(` configuration for the encoder
and the default `),ft=r("code"),Za=n("BertForCausalLM"),Ja=n(" configuration for the decoder."),mn=i(),b(Be.$$.fragment),fn=i(),H=r("h2"),he=r("a"),ut=r("span"),b(ze.$$.fragment),Wa=i(),Ie=r("span"),Sa=n("Initialising "),gt=r("code"),Ua=n("SpeechEncoderDecoderModel"),$a=n(" from a pretrained encoder and a pretrained decoder."),un=i(),k=r("p"),Vo=r("a"),Va=n("SpeechEncoderDecoderModel"),xa=n(" can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based speech model, "),_t=r("em"),Ra=n("e.g."),Ca=i(),xo=r("a"),Ga=n("Wav2Vec2"),Fa=n(", "),Ro=r("a"),Ba=n("Hubert"),za=n(" can serve as the encoder and both pretrained auto-encoding models, "),yt=r("em"),Ia=n("e.g."),Da=n(" BERT, pretrained causal language models, "),bt=r("em"),Ya=n("e.g."),Na=n(" GPT2, as well as the pretrained decoder part of sequence-to-sequence models, "),vt=r("em"),Xa=n("e.g."),qa=n(` 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 `),Co=r("a"),Aa=n("SpeechEncoderDecoderModel"),Pa=n(" from a pretrained encoder and decoder checkpoint requires the model to be fine-tuned on a downstream task, as has been shown in "),me=r("a"),Qa=n("the "),Mt=r("em"),Ha=n("Warm-starting-encoder-decoder blog post"),La=n(`.
To do so, the `),wt=r("code"),Oa=n("SpeechEncoderDecoderModel"),Ka=n(" class provides a "),Go=r("a"),er=n("SpeechEncoderDecoderModel.from_encoder_decoder_pretrained()"),or=n(" method."),gn=i(),b(De.$$.fragment),_n=i(),L=r("h2"),fe=r("a"),jt=r("span"),b(Ye.$$.fragment),tr=i(),Ne=r("span"),nr=n("Loading an existing "),Tt=r("code"),ar=n("SpeechEncoderDecoderModel"),rr=n(" checkpoint and perform inference."),yn=i(),C=r("p"),sr=n("To load fine-tuned checkpoints of the "),Et=r("code"),dr=n("SpeechEncoderDecoderModel"),lr=n(" class, "),Fo=r("a"),cr=n("SpeechEncoderDecoderModel"),ir=n(" provides the "),kt=r("code"),pr=n("from_pretrained(...)"),hr=n(" method just like any other model architecture in Transformers."),bn=i(),ue=r("p"),mr=n("To perform inference, one uses the "),Zt=r("code"),fr=n("generate"),ur=n(" method, which allows to autoregressively generate text. This method supports various forms of decoding, such as greedy, beam search and multinomial sampling."),vn=i(),b(Xe.$$.fragment),Mn=i(),O=r("h2"),ge=r("a"),Jt=r("span"),b(qe.$$.fragment),gr=i(),Wt=r("span"),_r=n("Training"),wn=i(),G=r("p"),yr=n(`Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (speech, text) pairs.
As you can see, only 2 inputs are required for the model in order to compute a loss: `),St=r("code"),br=n("input_values"),vr=n(` (which are the
speech inputs) and `),Ut=r("code"),Mr=n("labels"),wr=n(" (which are the "),$t=r("code"),jr=n("input_ids"),Tr=n(" of the encoded target sequence)."),jn=i(),b(Ae.$$.fragment),Tn=i(),K=r("h2"),_e=r("a"),Vt=r("span"),b(Pe.$$.fragment),Er=i(),xt=r("span"),kr=n("SpeechEncoderDecoderConfig"),En=i(),$=r("div"),b(Qe.$$.fragment),Zr=i(),ye=r("p"),Bo=r("a"),Jr=n("SpeechEncoderDecoderConfig"),Wr=n(` is the configuration class to store the configuration of a
`),zo=r("a"),Sr=n("SpeechEncoderDecoderModel"),Ur=n(`. It is used to instantiate an Encoder Decoder model according to the specified
arguments, defining the encoder and decoder configs.`),$r=i(),ee=r("p"),Vr=n("Configuration objects inherit from "),Io=r("a"),xr=n("PretrainedConfig"),Rr=n(` and can be used to control the model outputs. Read the
documentation from `),Do=r("a"),Cr=n("PretrainedConfig"),Gr=n(" for more information."),Fr=i(),b(be.$$.fragment),Br=i(),ve=r("div"),b(He.$$.fragment),zr=i(),Le=r("p"),Ir=n("Instantiate a "),Yo=r("a"),Dr=n("SpeechEncoderDecoderConfig"),Yr=n(` (or a derived class) from a pre-trained encoder model
configuration and decoder model configuration.`),Nr=i(),Me=r("div"),b(Oe.$$.fragment),Xr=i(),oe=r("p"),qr=n("Serializes this instance to a Python dictionary. Override the default "),Rt=r("em"),Ar=n("to_dict()"),Pr=n(" from "),Ct=r("em"),Qr=n("PretrainedConfig"),Hr=n("."),kn=i(),te=r("h2"),we=r("a"),Gt=r("span"),b(Ke.$$.fragment),Lr=i(),Ft=r("span"),Or=n("SpeechEncoderDecoderModel"),Zn=i(),Z=r("div"),b(eo.$$.fragment),Kr=i(),ne=r("p"),es=n(`This class can be used to initialize a speech-sequence-to-text-sequence model with any pretrained speech
autoencoding model as the encoder and any pretrained text autoregressive model as the decoder. The encoder is
loaded via `),No=r("a"),os=n("from_pretrained()"),ts=n(` function and the decoder is loaded via
`),Xo=r("a"),ns=n("from_pretrained()"),as=n(` function. Cross-attention layers are automatically added to the decoder
and should be fine-tuned on a downstream generative task, like summarization.`),rs=i(),oo=r("p"),ss=n(`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in `),to=r("a"),ds=n(`Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks`),ls=n(` by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`),cs=i(),no=r("p"),is=n("Additionally, in "),ao=r("a"),ps=n(`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),hs=n(` it is shown how leveraging large pretrained speech models for speech
translation yields a significant performance improvement.`),ms=i(),Bt=r("p"),fs=n(`After such an Speech-Encoder Decoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),us=i(),ro=r("p"),gs=n("This model inherits from "),qo=r("a"),_s=n("PreTrainedModel"),ys=n(`. 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.)`),bs=i(),so=r("p"),vs=n("This model is also a PyTorch "),lo=r("a"),Ms=n("torch.nn.Module"),ws=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),js=i(),q=r("p"),Ao=r("a"),Ts=n("SpeechEncoderDecoderModel"),Es=n(` is a generic model class that will be instantiated as a transformer architecture with
one of the base model classes of the library as encoder and another one as decoder when created with the
:meth`),zt=r("em"),ks=n("~transformers.AutoModel.from_pretrained"),Zs=n(` class method for the encoder and
:meth`),It=r("em"),Js=n("~transformers.AutoModelForCausalLM.from_pretrained"),Ws=n(" class method for the decoder."),Ss=i(),F=r("div"),b(co.$$.fragment),Us=i(),ae=r("p"),$s=n("The "),Po=r("a"),Vs=n("SpeechEncoderDecoderModel"),xs=n(" forward method, overrides the "),Dt=r("code"),Rs=n("__call__"),Cs=n(" special method."),Gs=i(),b(je.$$.fragment),Fs=i(),b(Te.$$.fragment),Bs=i(),B=r("div"),b(io.$$.fragment),zs=i(),Yt=r("p"),Is=n(`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`),Ds=i(),re=r("p"),Ys=n("The model is set in evaluation mode by default using "),Nt=r("code"),Ns=n("model.eval()"),Xs=n(` (Dropout modules are deactivated). To train
the model, you need to first set it back in training mode with `),Xt=r("code"),qs=n("model.train()"),As=n("."),Ps=i(),b(Ee.$$.fragment),Jn=i(),se=r("h2"),ke=r("a"),qt=r("span"),b(po.$$.fragment),Qs=i(),At=r("span"),Hs=n("FlaxSpeechEncoderDecoderModel"),Wn=i(),J=r("div"),b(ho.$$.fragment),Ls=i(),de=r("p"),Os=n(`This class can be used to initialize a speech-sequence-to-text-sequence model with any pretrained speech
autoencoding model as the encoder and any pretrained text autoregressive model as the decoder. The encoder is
loaded via `),Qo=r("a"),Ks=n("from_pretrained()"),ed=n(` function and the decoder is loaded via
`),Ho=r("a"),od=n("from_pretrained()"),td=n(` function. Cross-attention layers are automatically added to the decoder
and should be fine-tuned on a downstream generative task, like summarization.`),nd=i(),mo=r("p"),ad=n(`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in `),fo=r("a"),rd=n(`Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks`),sd=n(` by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`),dd=i(),uo=r("p"),ld=n("Additionally, in "),go=r("a"),cd=n(`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),id=n(` it is shown how leveraging large pretrained speech models for speech
translation yields a significant performance improvement.`),pd=i(),Pt=r("p"),hd=n(`After such an Speech-Encoder Decoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),md=i(),_o=r("p"),fd=n("This model inherits from "),Lo=r("a"),ud=n("FlaxPreTrainedModel"),gd=n(`. 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.)`),_d=i(),yo=r("p"),yd=n(`This model is also a Flax Linen
`),bo=r("a"),bd=n("flax.nn.Module"),vd=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Md=i(),A=r("p"),Oo=r("a"),wd=n("FlaxSpeechEncoderDecoderModel"),jd=n(` is a generic model class that will be instantiated as a transformer architecture
with the module (flax.nn.Module) of one of the base model classes of the library as encoder module and another one
as decoder module when created with the :meth`),Qt=r("em"),Td=n("~transformers.FlaxAutoModel.from_pretrained"),Ed=n(` class method for the
encoder and :meth`),Ht=r("em"),kd=n("~transformers.FlaxAutoModelForCausalLM.from_pretrained"),Zd=n(" class method for the decoder."),Jd=i(),z=r("div"),b(vo.$$.fragment),Wd=i(),le=r("p"),Sd=n("The "),Ko=r("a"),Ud=n("FlaxSpeechEncoderDecoderModel"),$d=n(" forward method, overrides the "),Lt=r("code"),Vd=n("__call__"),xd=n(" special method."),Rd=i(),b(Ze.$$.fragment),Cd=i(),b(Je.$$.fragment),Gd=i(),P=r("div"),b(Mo.$$.fragment),Fd=i(),Ot=r("p"),Bd=n(`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`),zd=i(),b(We.$$.fragment),this.h()},l(o){const h=Mc('[data-svelte="svelte-1phssyn"]',document.head);m=s(h,"META",{name:!0,content:!0}),h.forEach(t),E=p(o),_=s(o,"H1",{class:!0});var wo=d(_);f=s(wo,"A",{id:!0,class:!0,href:!0});var Kt=d(f);y=s(Kt,"SPAN",{});var en=d(y);v(l.$$.fragment,en),en.forEach(t),Kt.forEach(t),g=p(wo),D=s(wo,"SPAN",{});var on=d(D);Kn=a(on,"Speech Encoder Decoder Models"),on.forEach(t),wo.forEach(t),dn=p(o),x=s(o,"P",{});var R=d(x);ea=a(R,"The "),ko=s(R,"A",{href:!0});var tn=d(ko);oa=a(tn,"SpeechEncoderDecoderModel"),tn.forEach(t),ta=a(R,` can be used to initialize a speech-to-text model
with any pretrained speech autoencoding model as the encoder (`),it=s(R,"EM",{});var nn=d(it);na=a(nn,"e.g."),nn.forEach(t),aa=p(R),Zo=s(R,"A",{href:!0});var Dd=d(Zo);ra=a(Dd,"Wav2Vec2"),Dd.forEach(t),sa=a(R,", "),Jo=s(R,"A",{href:!0});var Yd=d(Jo);da=a(Yd,"Hubert"),Yd.forEach(t),la=a(R,") and any pretrained autoregressive model as the decoder."),R.forEach(t),ln=p(o),N=s(o,"P",{});var et=d(N);ca=a(et,`The effectiveness of initializing speech-sequence-to-text-sequence models with pretrained checkpoints for speech
recognition and speech translation has `),pt=s(et,"EM",{});var Nd=d(pt);ia=a(Nd,"e.g."),Nd.forEach(t),pa=a(et," been shown in "),Ce=s(et,"A",{href:!0,rel:!0});var Xd=d(Ce);ha=a(Xd,`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),Xd.forEach(t),ma=a(et,` by Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli,
Alexis Conneau.`),et.forEach(t),cn=p(o),X=s(o,"P",{});var ot=d(X);fa=a(ot,"An example of how to use a "),Wo=s(ot,"A",{href:!0});var qd=d(Wo);ua=a(qd,"SpeechEncoderDecoderModel"),qd.forEach(t),ga=a(ot," for inference can be seen in "),So=s(ot,"A",{href:!0});var Ad=d(So);_a=a(Ad,"Speech2Text2"),Ad.forEach(t),ya=a(ot,"."),ot.forEach(t),pn=p(o),Q=s(o,"H2",{class:!0});var Un=d(Q);pe=s(Un,"A",{id:!0,class:!0,href:!0});var Pd=d(pe);ht=s(Pd,"SPAN",{});var Qd=d(ht);v(Ge.$$.fragment,Qd),Qd.forEach(t),Pd.forEach(t),ba=p(Un),Fe=s(Un,"SPAN",{});var $n=d(Fe);va=a($n,"Randomly initializing "),mt=s($n,"CODE",{});var Hd=d(mt);Ma=a(Hd,"SpeechEncoderDecoderModel"),Hd.forEach(t),wa=a($n," from model configurations."),$n.forEach(t),Un.forEach(t),hn=p(o),Y=s(o,"P",{});var jo=d(Y);Uo=s(jo,"A",{href:!0});var Ld=d(Uo);ja=a(Ld,"SpeechEncoderDecoderModel"),Ld.forEach(t),Ta=a(jo," can be randomly initialized from an encoder and a decoder config. In the following example, we show how to do this using the default "),$o=s(jo,"A",{href:!0});var Od=d($o);Ea=a(Od,"Wav2Vec2Model"),Od.forEach(t),ka=a(jo,` configuration for the encoder
and the default `),ft=s(jo,"CODE",{});var Kd=d(ft);Za=a(Kd,"BertForCausalLM"),Kd.forEach(t),Ja=a(jo," configuration for the decoder."),jo.forEach(t),mn=p(o),v(Be.$$.fragment,o),fn=p(o),H=s(o,"H2",{class:!0});var Vn=d(H);he=s(Vn,"A",{id:!0,class:!0,href:!0});var el=d(he);ut=s(el,"SPAN",{});var ol=d(ut);v(ze.$$.fragment,ol),ol.forEach(t),el.forEach(t),Wa=p(Vn),Ie=s(Vn,"SPAN",{});var xn=d(Ie);Sa=a(xn,"Initialising "),gt=s(xn,"CODE",{});var tl=d(gt);Ua=a(tl,"SpeechEncoderDecoderModel"),tl.forEach(t),$a=a(xn," from a pretrained encoder and a pretrained decoder."),xn.forEach(t),Vn.forEach(t),un=p(o),k=s(o,"P",{});var W=d(k);Vo=s(W,"A",{href:!0});var nl=d(Vo);Va=a(nl,"SpeechEncoderDecoderModel"),nl.forEach(t),xa=a(W," can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based speech model, "),_t=s(W,"EM",{});var al=d(_t);Ra=a(al,"e.g."),al.forEach(t),Ca=p(W),xo=s(W,"A",{href:!0});var rl=d(xo);Ga=a(rl,"Wav2Vec2"),rl.forEach(t),Fa=a(W,", "),Ro=s(W,"A",{href:!0});var sl=d(Ro);Ba=a(sl,"Hubert"),sl.forEach(t),za=a(W," can serve as the encoder and both pretrained auto-encoding models, "),yt=s(W,"EM",{});var dl=d(yt);Ia=a(dl,"e.g."),dl.forEach(t),Da=a(W," BERT, pretrained causal language models, "),bt=s(W,"EM",{});var ll=d(bt);Ya=a(ll,"e.g."),ll.forEach(t),Na=a(W," GPT2, as well as the pretrained decoder part of sequence-to-sequence models, "),vt=s(W,"EM",{});var cl=d(vt);Xa=a(cl,"e.g."),cl.forEach(t),qa=a(W,` 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 `),Co=s(W,"A",{href:!0});var il=d(Co);Aa=a(il,"SpeechEncoderDecoderModel"),il.forEach(t),Pa=a(W," from a pretrained encoder and decoder checkpoint requires the model to be fine-tuned on a downstream task, as has been shown in "),me=s(W,"A",{href:!0,rel:!0});var Id=d(me);Qa=a(Id,"the "),Mt=s(Id,"EM",{});var pl=d(Mt);Ha=a(pl,"Warm-starting-encoder-decoder blog post"),pl.forEach(t),Id.forEach(t),La=a(W,`.
To do so, the `),wt=s(W,"CODE",{});var hl=d(wt);Oa=a(hl,"SpeechEncoderDecoderModel"),hl.forEach(t),Ka=a(W," class provides a "),Go=s(W,"A",{href:!0});var ml=d(Go);er=a(ml,"SpeechEncoderDecoderModel.from_encoder_decoder_pretrained()"),ml.forEach(t),or=a(W," method."),W.forEach(t),gn=p(o),v(De.$$.fragment,o),_n=p(o),L=s(o,"H2",{class:!0});var Rn=d(L);fe=s(Rn,"A",{id:!0,class:!0,href:!0});var fl=d(fe);jt=s(fl,"SPAN",{});var ul=d(jt);v(Ye.$$.fragment,ul),ul.forEach(t),fl.forEach(t),tr=p(Rn),Ne=s(Rn,"SPAN",{});var Cn=d(Ne);nr=a(Cn,"Loading an existing "),Tt=s(Cn,"CODE",{});var gl=d(Tt);ar=a(gl,"SpeechEncoderDecoderModel"),gl.forEach(t),rr=a(Cn," checkpoint and perform inference."),Cn.forEach(t),Rn.forEach(t),yn=p(o),C=s(o,"P",{});var Se=d(C);sr=a(Se,"To load fine-tuned checkpoints of the "),Et=s(Se,"CODE",{});var _l=d(Et);dr=a(_l,"SpeechEncoderDecoderModel"),_l.forEach(t),lr=a(Se," class, "),Fo=s(Se,"A",{href:!0});var yl=d(Fo);cr=a(yl,"SpeechEncoderDecoderModel"),yl.forEach(t),ir=a(Se," provides the "),kt=s(Se,"CODE",{});var bl=d(kt);pr=a(bl,"from_pretrained(...)"),bl.forEach(t),hr=a(Se," method just like any other model architecture in Transformers."),Se.forEach(t),bn=p(o),ue=s(o,"P",{});var Gn=d(ue);mr=a(Gn,"To perform inference, one uses the "),Zt=s(Gn,"CODE",{});var vl=d(Zt);fr=a(vl,"generate"),vl.forEach(t),ur=a(Gn," method, which allows to autoregressively generate text. This method supports various forms of decoding, such as greedy, beam search and multinomial sampling."),Gn.forEach(t),vn=p(o),v(Xe.$$.fragment,o),Mn=p(o),O=s(o,"H2",{class:!0});var Fn=d(O);ge=s(Fn,"A",{id:!0,class:!0,href:!0});var Ml=d(ge);Jt=s(Ml,"SPAN",{});var wl=d(Jt);v(qe.$$.fragment,wl),wl.forEach(t),Ml.forEach(t),gr=p(Fn),Wt=s(Fn,"SPAN",{});var jl=d(Wt);_r=a(jl,"Training"),jl.forEach(t),Fn.forEach(t),wn=p(o),G=s(o,"P",{});var Ue=d(G);yr=a(Ue,`Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (speech, text) pairs.
As you can see, only 2 inputs are required for the model in order to compute a loss: `),St=s(Ue,"CODE",{});var Tl=d(St);br=a(Tl,"input_values"),Tl.forEach(t),vr=a(Ue,` (which are the
speech inputs) and `),Ut=s(Ue,"CODE",{});var El=d(Ut);Mr=a(El,"labels"),El.forEach(t),wr=a(Ue," (which are the "),$t=s(Ue,"CODE",{});var kl=d($t);jr=a(kl,"input_ids"),kl.forEach(t),Tr=a(Ue," of the encoded target sequence)."),Ue.forEach(t),jn=p(o),v(Ae.$$.fragment,o),Tn=p(o),K=s(o,"H2",{class:!0});var Bn=d(K);_e=s(Bn,"A",{id:!0,class:!0,href:!0});var Zl=d(_e);Vt=s(Zl,"SPAN",{});var Jl=d(Vt);v(Pe.$$.fragment,Jl),Jl.forEach(t),Zl.forEach(t),Er=p(Bn),xt=s(Bn,"SPAN",{});var Wl=d(xt);kr=a(Wl,"SpeechEncoderDecoderConfig"),Wl.forEach(t),Bn.forEach(t),En=p(o),$=s(o,"DIV",{class:!0});var I=d($);v(Qe.$$.fragment,I),Zr=p(I),ye=s(I,"P",{});var an=d(ye);Bo=s(an,"A",{href:!0});var Sl=d(Bo);Jr=a(Sl,"SpeechEncoderDecoderConfig"),Sl.forEach(t),Wr=a(an,` is the configuration class to store the configuration of a
`),zo=s(an,"A",{href:!0});var Ul=d(zo);Sr=a(Ul,"SpeechEncoderDecoderModel"),Ul.forEach(t),Ur=a(an,`. It is used to instantiate an Encoder Decoder model according to the specified
arguments, defining the encoder and decoder configs.`),an.forEach(t),$r=p(I),ee=s(I,"P",{});var tt=d(ee);Vr=a(tt,"Configuration objects inherit from "),Io=s(tt,"A",{href:!0});var $l=d(Io);xr=a($l,"PretrainedConfig"),$l.forEach(t),Rr=a(tt,` and can be used to control the model outputs. Read the
documentation from `),Do=s(tt,"A",{href:!0});var Vl=d(Do);Cr=a(Vl,"PretrainedConfig"),Vl.forEach(t),Gr=a(tt," for more information."),tt.forEach(t),Fr=p(I),v(be.$$.fragment,I),Br=p(I),ve=s(I,"DIV",{class:!0});var zn=d(ve);v(He.$$.fragment,zn),zr=p(zn),Le=s(zn,"P",{});var In=d(Le);Ir=a(In,"Instantiate a "),Yo=s(In,"A",{href:!0});var xl=d(Yo);Dr=a(xl,"SpeechEncoderDecoderConfig"),xl.forEach(t),Yr=a(In,` (or a derived class) from a pre-trained encoder model
configuration and decoder model configuration.`),In.forEach(t),zn.forEach(t),Nr=p(I),Me=s(I,"DIV",{class:!0});var Dn=d(Me);v(Oe.$$.fragment,Dn),Xr=p(Dn),oe=s(Dn,"P",{});var nt=d(oe);qr=a(nt,"Serializes this instance to a Python dictionary. Override the default "),Rt=s(nt,"EM",{});var Rl=d(Rt);Ar=a(Rl,"to_dict()"),Rl.forEach(t),Pr=a(nt," from "),Ct=s(nt,"EM",{});var Cl=d(Ct);Qr=a(Cl,"PretrainedConfig"),Cl.forEach(t),Hr=a(nt,"."),nt.forEach(t),Dn.forEach(t),I.forEach(t),kn=p(o),te=s(o,"H2",{class:!0});var Yn=d(te);we=s(Yn,"A",{id:!0,class:!0,href:!0});var Gl=d(we);Gt=s(Gl,"SPAN",{});var Fl=d(Gt);v(Ke.$$.fragment,Fl),Fl.forEach(t),Gl.forEach(t),Lr=p(Yn),Ft=s(Yn,"SPAN",{});var Bl=d(Ft);Or=a(Bl,"SpeechEncoderDecoderModel"),Bl.forEach(t),Yn.forEach(t),Zn=p(o),Z=s(o,"DIV",{class:!0});var S=d(Z);v(eo.$$.fragment,S),Kr=p(S),ne=s(S,"P",{});var at=d(ne);es=a(at,`This class can be used to initialize a speech-sequence-to-text-sequence model with any pretrained speech
autoencoding model as the encoder and any pretrained text autoregressive model as the decoder. The encoder is
loaded via `),No=s(at,"A",{href:!0});var zl=d(No);os=a(zl,"from_pretrained()"),zl.forEach(t),ts=a(at,` function and the decoder is loaded via
`),Xo=s(at,"A",{href:!0});var Il=d(Xo);ns=a(Il,"from_pretrained()"),Il.forEach(t),as=a(at,` function. Cross-attention layers are automatically added to the decoder
and should be fine-tuned on a downstream generative task, like summarization.`),at.forEach(t),rs=p(S),oo=s(S,"P",{});var Nn=d(oo);ss=a(Nn,`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in `),to=s(Nn,"A",{href:!0,rel:!0});var Dl=d(to);ds=a(Dl,`Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks`),Dl.forEach(t),ls=a(Nn,` by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`),Nn.forEach(t),cs=p(S),no=s(S,"P",{});var Xn=d(no);is=a(Xn,"Additionally, in "),ao=s(Xn,"A",{href:!0,rel:!0});var Yl=d(ao);ps=a(Yl,`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),Yl.forEach(t),hs=a(Xn,` it is shown how leveraging large pretrained speech models for speech
translation yields a significant performance improvement.`),Xn.forEach(t),ms=p(S),Bt=s(S,"P",{});var Nl=d(Bt);fs=a(Nl,`After such an Speech-Encoder Decoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),Nl.forEach(t),us=p(S),ro=s(S,"P",{});var qn=d(ro);gs=a(qn,"This model inherits from "),qo=s(qn,"A",{href:!0});var Xl=d(qo);_s=a(Xl,"PreTrainedModel"),Xl.forEach(t),ys=a(qn,`. 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.forEach(t),bs=p(S),so=s(S,"P",{});var An=d(so);vs=a(An,"This model is also a PyTorch "),lo=s(An,"A",{href:!0,rel:!0});var ql=d(lo);Ms=a(ql,"torch.nn.Module"),ql.forEach(t),ws=a(An,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),An.forEach(t),js=p(S),q=s(S,"P",{});var To=d(q);Ao=s(To,"A",{href:!0});var Al=d(Ao);Ts=a(Al,"SpeechEncoderDecoderModel"),Al.forEach(t),Es=a(To,` is a generic model class that will be instantiated as a transformer architecture with
one of the base model classes of the library as encoder and another one as decoder when created with the
:meth`),zt=s(To,"EM",{});var Pl=d(zt);ks=a(Pl,"~transformers.AutoModel.from_pretrained"),Pl.forEach(t),Zs=a(To,` class method for the encoder and
:meth`),It=s(To,"EM",{});var Ql=d(It);Js=a(Ql,"~transformers.AutoModelForCausalLM.from_pretrained"),Ql.forEach(t),Ws=a(To," class method for the decoder."),To.forEach(t),Ss=p(S),F=s(S,"DIV",{class:!0});var $e=d(F);v(co.$$.fragment,$e),Us=p($e),ae=s($e,"P",{});var rt=d(ae);$s=a(rt,"The "),Po=s(rt,"A",{href:!0});var Hl=d(Po);Vs=a(Hl,"SpeechEncoderDecoderModel"),Hl.forEach(t),xs=a(rt," forward method, overrides the "),Dt=s(rt,"CODE",{});var Ll=d(Dt);Rs=a(Ll,"__call__"),Ll.forEach(t),Cs=a(rt," special method."),rt.forEach(t),Gs=p($e),v(je.$$.fragment,$e),Fs=p($e),v(Te.$$.fragment,$e),$e.forEach(t),Bs=p(S),B=s(S,"DIV",{class:!0});var Ve=d(B);v(io.$$.fragment,Ve),zs=p(Ve),Yt=s(Ve,"P",{});var Ol=d(Yt);Is=a(Ol,`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`),Ol.forEach(t),Ds=p(Ve),re=s(Ve,"P",{});var st=d(re);Ys=a(st,"The model is set in evaluation mode by default using "),Nt=s(st,"CODE",{});var Kl=d(Nt);Ns=a(Kl,"model.eval()"),Kl.forEach(t),Xs=a(st,` (Dropout modules are deactivated). To train
the model, you need to first set it back in training mode with `),Xt=s(st,"CODE",{});var ec=d(Xt);qs=a(ec,"model.train()"),ec.forEach(t),As=a(st,"."),st.forEach(t),Ps=p(Ve),v(Ee.$$.fragment,Ve),Ve.forEach(t),S.forEach(t),Jn=p(o),se=s(o,"H2",{class:!0});var Pn=d(se);ke=s(Pn,"A",{id:!0,class:!0,href:!0});var oc=d(ke);qt=s(oc,"SPAN",{});var tc=d(qt);v(po.$$.fragment,tc),tc.forEach(t),oc.forEach(t),Qs=p(Pn),At=s(Pn,"SPAN",{});var nc=d(At);Hs=a(nc,"FlaxSpeechEncoderDecoderModel"),nc.forEach(t),Pn.forEach(t),Wn=p(o),J=s(o,"DIV",{class:!0});var U=d(J);v(ho.$$.fragment,U),Ls=p(U),de=s(U,"P",{});var dt=d(de);Os=a(dt,`This class can be used to initialize a speech-sequence-to-text-sequence model with any pretrained speech
autoencoding model as the encoder and any pretrained text autoregressive model as the decoder. The encoder is
loaded via `),Qo=s(dt,"A",{href:!0});var ac=d(Qo);Ks=a(ac,"from_pretrained()"),ac.forEach(t),ed=a(dt,` function and the decoder is loaded via
`),Ho=s(dt,"A",{href:!0});var rc=d(Ho);od=a(rc,"from_pretrained()"),rc.forEach(t),td=a(dt,` function. Cross-attention layers are automatically added to the decoder
and should be fine-tuned on a downstream generative task, like summarization.`),dt.forEach(t),nd=p(U),mo=s(U,"P",{});var Qn=d(mo);ad=a(Qn,`The effectiveness of initializing sequence-to-sequence models with pretrained checkpoints for sequence generation
tasks was shown in `),fo=s(Qn,"A",{href:!0,rel:!0});var sc=d(fo);rd=a(sc,`Leveraging Pre-trained Checkpoints for Sequence Generation
Tasks`),sc.forEach(t),sd=a(Qn,` by Sascha Rothe, Shashi Narayan, Aliaksei Severyn. Michael Matena, Yanqi
Zhou, Wei Li, Peter J. Liu.`),Qn.forEach(t),dd=p(U),uo=s(U,"P",{});var Hn=d(uo);ld=a(Hn,"Additionally, in "),go=s(Hn,"A",{href:!0,rel:!0});var dc=d(go);cd=a(dc,`Large-Scale Self- and Semi-Supervised Learning for Speech
Translation`),dc.forEach(t),id=a(Hn,` it is shown how leveraging large pretrained speech models for speech
translation yields a significant performance improvement.`),Hn.forEach(t),pd=p(U),Pt=s(U,"P",{});var lc=d(Pt);hd=a(lc,`After such an Speech-Encoder Decoder model has been trained/fine-tuned, it can be saved/loaded just like any other
models (see the examples for more information).`),lc.forEach(t),md=p(U),_o=s(U,"P",{});var Ln=d(_o);fd=a(Ln,"This model inherits from "),Lo=s(Ln,"A",{href:!0});var cc=d(Lo);ud=a(cc,"FlaxPreTrainedModel"),cc.forEach(t),gd=a(Ln,`. 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.)`),Ln.forEach(t),_d=p(U),yo=s(U,"P",{});var On=d(yo);yd=a(On,`This model is also a Flax Linen
`),bo=s(On,"A",{href:!0,rel:!0});var ic=d(bo);bd=a(ic,"flax.nn.Module"),ic.forEach(t),vd=a(On,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),On.forEach(t),Md=p(U),A=s(U,"P",{});var Eo=d(A);Oo=s(Eo,"A",{href:!0});var pc=d(Oo);wd=a(pc,"FlaxSpeechEncoderDecoderModel"),pc.forEach(t),jd=a(Eo,` is a generic model class that will be instantiated as a transformer architecture
with the module (flax.nn.Module) of one of the base model classes of the library as encoder module and another one
as decoder module when created with the :meth`),Qt=s(Eo,"EM",{});var hc=d(Qt);Td=a(hc,"~transformers.FlaxAutoModel.from_pretrained"),hc.forEach(t),Ed=a(Eo,` class method for the
encoder and :meth`),Ht=s(Eo,"EM",{});var mc=d(Ht);kd=a(mc,"~transformers.FlaxAutoModelForCausalLM.from_pretrained"),mc.forEach(t),Zd=a(Eo," class method for the decoder."),Eo.forEach(t),Jd=p(U),z=s(U,"DIV",{class:!0});var xe=d(z);v(vo.$$.fragment,xe),Wd=p(xe),le=s(xe,"P",{});var lt=d(le);Sd=a(lt,"The "),Ko=s(lt,"A",{href:!0});var fc=d(Ko);Ud=a(fc,"FlaxSpeechEncoderDecoderModel"),fc.forEach(t),$d=a(lt," forward method, overrides the "),Lt=s(lt,"CODE",{});var uc=d(Lt);Vd=a(uc,"__call__"),uc.forEach(t),xd=a(lt," special method."),lt.forEach(t),Rd=p(xe),v(Ze.$$.fragment,xe),Cd=p(xe),v(Je.$$.fragment,xe),xe.forEach(t),Gd=p(U),P=s(U,"DIV",{class:!0});var ct=d(P);v(Mo.$$.fragment,ct),Fd=p(ct),Ot=s(ct,"P",{});var gc=d(Ot);Bd=a(gc,`Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model
checkpoints.`),gc.forEach(t),zd=p(ct),v(We.$$.fragment,ct),ct.forEach(t),U.forEach(t),this.h()},h(){c(m,"name","hf:doc:metadata"),c(m,"content",JSON.stringify(Uc)),c(f,"id","speech-encoder-decoder-models"),c(f,"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"),c(f,"href","#speech-encoder-decoder-models"),c(_,"class","relative group"),c(ko,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(Zo,"href","wav2vec2"),c(Jo,"href","hubert"),c(Ce,"href","https://arxiv.org/abs/2104.06678"),c(Ce,"rel","nofollow"),c(Wo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(So,"href","speech_to_text_2"),c(pe,"id","randomly-initializing-speechencoderdecodermodel-from-model-configurations"),c(pe,"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"),c(pe,"href","#randomly-initializing-speechencoderdecodermodel-from-model-configurations"),c(Q,"class","relative group"),c(Uo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c($o,"href","/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Model"),c(he,"id","initialising-speechencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder"),c(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"),c(he,"href","#initialising-speechencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder"),c(H,"class","relative group"),c(Vo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(xo,"href","wav2vec2"),c(Ro,"href","hubert"),c(Co,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(me,"href","https://huggingface.co/blog/warm-starting-encoder-decoder"),c(me,"rel","nofollow"),c(Go,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel.from_encoder_decoder_pretrained"),c(fe,"id","loading-an-existing-speechencoderdecodermodel-checkpoint-and-perform-inference"),c(fe,"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"),c(fe,"href","#loading-an-existing-speechencoderdecodermodel-checkpoint-and-perform-inference"),c(L,"class","relative group"),c(Fo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(ge,"id","training"),c(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ge,"href","#training"),c(O,"class","relative group"),c(_e,"id","transformers.SpeechEncoderDecoderConfig"),c(_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"),c(_e,"href","#transformers.SpeechEncoderDecoderConfig"),c(K,"class","relative group"),c(Bo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig"),c(zo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(Io,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Do,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Yo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderConfig"),c(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(we,"id","transformers.SpeechEncoderDecoderModel"),c(we,"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"),c(we,"href","#transformers.SpeechEncoderDecoderModel"),c(te,"class","relative group"),c(No,"href","/docs/transformers/v4.31.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),c(Xo,"href","/docs/transformers/v4.31.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),c(to,"href","https://arxiv.org/abs/1907.12461"),c(to,"rel","nofollow"),c(ao,"href","https://arxiv.org/abs/2104.06678"),c(ao,"rel","nofollow"),c(qo,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),c(lo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(lo,"rel","nofollow"),c(Ao,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(Po,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ke,"id","transformers.FlaxSpeechEncoderDecoderModel"),c(ke,"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"),c(ke,"href","#transformers.FlaxSpeechEncoderDecoderModel"),c(se,"class","relative group"),c(Qo,"href","/docs/transformers/v4.31.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),c(Ho,"href","/docs/transformers/v4.31.0/en/model_doc/auto#transformers.FlaxAutoModelForVision2Seq.from_pretrained"),c(fo,"href","https://arxiv.org/abs/1907.12461"),c(fo,"rel","nofollow"),c(go,"href","https://arxiv.org/abs/2104.06678"),c(go,"rel","nofollow"),c(Lo,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),c(bo,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c(bo,"rel","nofollow"),c(Oo,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.FlaxSpeechEncoderDecoderModel"),c(Ko,"href","/docs/transformers/v4.31.0/en/model_doc/speech-encoder-decoder#transformers.FlaxSpeechEncoderDecoderModel"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,h){e(document.head,m),u(o,E,h),u(o,_,h),e(_,f),e(f,y),M(l,y,null),e(_,g),e(_,D),e(D,Kn),u(o,dn,h),u(o,x,h),e(x,ea),e(x,ko),e(ko,oa),e(x,ta),e(x,it),e(it,na),e(x,aa),e(x,Zo),e(Zo,ra),e(x,sa),e(x,Jo),e(Jo,da),e(x,la),u(o,ln,h),u(o,N,h),e(N,ca),e(N,pt),e(pt,ia),e(N,pa),e(N,Ce),e(Ce,ha),e(N,ma),u(o,cn,h),u(o,X,h),e(X,fa),e(X,Wo),e(Wo,ua),e(X,ga),e(X,So),e(So,_a),e(X,ya),u(o,pn,h),u(o,Q,h),e(Q,pe),e(pe,ht),M(Ge,ht,null),e(Q,ba),e(Q,Fe),e(Fe,va),e(Fe,mt),e(mt,Ma),e(Fe,wa),u(o,hn,h),u(o,Y,h),e(Y,Uo),e(Uo,ja),e(Y,Ta),e(Y,$o),e($o,Ea),e(Y,ka),e(Y,ft),e(ft,Za),e(Y,Ja),u(o,mn,h),M(Be,o,h),u(o,fn,h),u(o,H,h),e(H,he),e(he,ut),M(ze,ut,null),e(H,Wa),e(H,Ie),e(Ie,Sa),e(Ie,gt),e(gt,Ua),e(Ie,$a),u(o,un,h),u(o,k,h),e(k,Vo),e(Vo,Va),e(k,xa),e(k,_t),e(_t,Ra),e(k,Ca),e(k,xo),e(xo,Ga),e(k,Fa),e(k,Ro),e(Ro,Ba),e(k,za),e(k,yt),e(yt,Ia),e(k,Da),e(k,bt),e(bt,Ya),e(k,Na),e(k,vt),e(vt,Xa),e(k,qa),e(k,Co),e(Co,Aa),e(k,Pa),e(k,me),e(me,Qa),e(me,Mt),e(Mt,Ha),e(k,La),e(k,wt),e(wt,Oa),e(k,Ka),e(k,Go),e(Go,er),e(k,or),u(o,gn,h),M(De,o,h),u(o,_n,h),u(o,L,h),e(L,fe),e(fe,jt),M(Ye,jt,null),e(L,tr),e(L,Ne),e(Ne,nr),e(Ne,Tt),e(Tt,ar),e(Ne,rr),u(o,yn,h),u(o,C,h),e(C,sr),e(C,Et),e(Et,dr),e(C,lr),e(C,Fo),e(Fo,cr),e(C,ir),e(C,kt),e(kt,pr),e(C,hr),u(o,bn,h),u(o,ue,h),e(ue,mr),e(ue,Zt),e(Zt,fr),e(ue,ur),u(o,vn,h),M(Xe,o,h),u(o,Mn,h),u(o,O,h),e(O,ge),e(ge,Jt),M(qe,Jt,null),e(O,gr),e(O,Wt),e(Wt,_r),u(o,wn,h),u(o,G,h),e(G,yr),e(G,St),e(St,br),e(G,vr),e(G,Ut),e(Ut,Mr),e(G,wr),e(G,$t),e($t,jr),e(G,Tr),u(o,jn,h),M(Ae,o,h),u(o,Tn,h),u(o,K,h),e(K,_e),e(_e,Vt),M(Pe,Vt,null),e(K,Er),e(K,xt),e(xt,kr),u(o,En,h),u(o,$,h),M(Qe,$,null),e($,Zr),e($,ye),e(ye,Bo),e(Bo,Jr),e(ye,Wr),e(ye,zo),e(zo,Sr),e(ye,Ur),e($,$r),e($,ee),e(ee,Vr),e(ee,Io),e(Io,xr),e(ee,Rr),e(ee,Do),e(Do,Cr),e(ee,Gr),e($,Fr),M(be,$,null),e($,Br),e($,ve),M(He,ve,null),e(ve,zr),e(ve,Le),e(Le,Ir),e(Le,Yo),e(Yo,Dr),e(Le,Yr),e($,Nr),e($,Me),M(Oe,Me,null),e(Me,Xr),e(Me,oe),e(oe,qr),e(oe,Rt),e(Rt,Ar),e(oe,Pr),e(oe,Ct),e(Ct,Qr),e(oe,Hr),u(o,kn,h),u(o,te,h),e(te,we),e(we,Gt),M(Ke,Gt,null),e(te,Lr),e(te,Ft),e(Ft,Or),u(o,Zn,h),u(o,Z,h),M(eo,Z,null),e(Z,Kr),e(Z,ne),e(ne,es),e(ne,No),e(No,os),e(ne,ts),e(ne,Xo),e(Xo,ns),e(ne,as),e(Z,rs),e(Z,oo),e(oo,ss),e(oo,to),e(to,ds),e(oo,ls),e(Z,cs),e(Z,no),e(no,is),e(no,ao),e(ao,ps),e(no,hs),e(Z,ms),e(Z,Bt),e(Bt,fs),e(Z,us),e(Z,ro),e(ro,gs),e(ro,qo),e(qo,_s),e(ro,ys),e(Z,bs),e(Z,so),e(so,vs),e(so,lo),e(lo,Ms),e(so,ws),e(Z,js),e(Z,q),e(q,Ao),e(Ao,Ts),e(q,Es),e(q,zt),e(zt,ks),e(q,Zs),e(q,It),e(It,Js),e(q,Ws),e(Z,Ss),e(Z,F),M(co,F,null),e(F,Us),e(F,ae),e(ae,$s),e(ae,Po),e(Po,Vs),e(ae,xs),e(ae,Dt),e(Dt,Rs),e(ae,Cs),e(F,Gs),M(je,F,null),e(F,Fs),M(Te,F,null),e(Z,Bs),e(Z,B),M(io,B,null),e(B,zs),e(B,Yt),e(Yt,Is),e(B,Ds),e(B,re),e(re,Ys),e(re,Nt),e(Nt,Ns),e(re,Xs),e(re,Xt),e(Xt,qs),e(re,As),e(B,Ps),M(Ee,B,null),u(o,Jn,h),u(o,se,h),e(se,ke),e(ke,qt),M(po,qt,null),e(se,Qs),e(se,At),e(At,Hs),u(o,Wn,h),u(o,J,h),M(ho,J,null),e(J,Ls),e(J,de),e(de,Os),e(de,Qo),e(Qo,Ks),e(de,ed),e(de,Ho),e(Ho,od),e(de,td),e(J,nd),e(J,mo),e(mo,ad),e(mo,fo),e(fo,rd),e(mo,sd),e(J,dd),e(J,uo),e(uo,ld),e(uo,go),e(go,cd),e(uo,id),e(J,pd),e(J,Pt),e(Pt,hd),e(J,md),e(J,_o),e(_o,fd),e(_o,Lo),e(Lo,ud),e(_o,gd),e(J,_d),e(J,yo),e(yo,yd),e(yo,bo),e(bo,bd),e(yo,vd),e(J,Md),e(J,A),e(A,Oo),e(Oo,wd),e(A,jd),e(A,Qt),e(Qt,Td),e(A,Ed),e(A,Ht),e(Ht,kd),e(A,Zd),e(J,Jd),e(J,z),M(vo,z,null),e(z,Wd),e(z,le),e(le,Sd),e(le,Ko),e(Ko,Ud),e(le,$d),e(le,Lt),e(Lt,Vd),e(le,xd),e(z,Rd),M(Ze,z,null),e(z,Cd),M(Je,z,null),e(J,Gd),e(J,P),M(Mo,P,null),e(P,Fd),e(P,Ot),e(Ot,Bd),e(P,zd),M(We,P,null),Sn=!0},p(o,[h]){const wo={};h&2&&(wo.$$scope={dirty:h,ctx:o}),be.$set(wo);const Kt={};h&2&&(Kt.$$scope={dirty:h,ctx:o}),je.$set(Kt);const en={};h&2&&(en.$$scope={dirty:h,ctx:o}),Te.$set(en);const on={};h&2&&(on.$$scope={dirty:h,ctx:o}),Ee.$set(on);const R={};h&2&&(R.$$scope={dirty:h,ctx:o}),Ze.$set(R);const tn={};h&2&&(tn.$$scope={dirty:h,ctx:o}),Je.$set(tn);const nn={};h&2&&(nn.$$scope={dirty:h,ctx:o}),We.$set(nn)},i(o){Sn||(w(l.$$.fragment,o),w(Ge.$$.fragment,o),w(Be.$$.fragment,o),w(ze.$$.fragment,o),w(De.$$.fragment,o),w(Ye.$$.fragment,o),w(Xe.$$.fragment,o),w(qe.$$.fragment,o),w(Ae.$$.fragment,o),w(Pe.$$.fragment,o),w(Qe.$$.fragment,o),w(be.$$.fragment,o),w(He.$$.fragment,o),w(Oe.$$.fragment,o),w(Ke.$$.fragment,o),w(eo.$$.fragment,o),w(co.$$.fragment,o),w(je.$$.fragment,o),w(Te.$$.fragment,o),w(io.$$.fragment,o),w(Ee.$$.fragment,o),w(po.$$.fragment,o),w(ho.$$.fragment,o),w(vo.$$.fragment,o),w(Ze.$$.fragment,o),w(Je.$$.fragment,o),w(Mo.$$.fragment,o),w(We.$$.fragment,o),Sn=!0)},o(o){j(l.$$.fragment,o),j(Ge.$$.fragment,o),j(Be.$$.fragment,o),j(ze.$$.fragment,o),j(De.$$.fragment,o),j(Ye.$$.fragment,o),j(Xe.$$.fragment,o),j(qe.$$.fragment,o),j(Ae.$$.fragment,o),j(Pe.$$.fragment,o),j(Qe.$$.fragment,o),j(be.$$.fragment,o),j(He.$$.fragment,o),j(Oe.$$.fragment,o),j(Ke.$$.fragment,o),j(eo.$$.fragment,o),j(co.$$.fragment,o),j(je.$$.fragment,o),j(Te.$$.fragment,o),j(io.$$.fragment,o),j(Ee.$$.fragment,o),j(po.$$.fragment,o),j(ho.$$.fragment,o),j(vo.$$.fragment,o),j(Ze.$$.fragment,o),j(Je.$$.fragment,o),j(Mo.$$.fragment,o),j(We.$$.fragment,o),Sn=!1},d(o){t(m),o&&t(E),o&&t(_),T(l),o&&t(dn),o&&t(x),o&&t(ln),o&&t(N),o&&t(cn),o&&t(X),o&&t(pn),o&&t(Q),T(Ge),o&&t(hn),o&&t(Y),o&&t(mn),T(Be,o),o&&t(fn),o&&t(H),T(ze),o&&t(un),o&&t(k),o&&t(gn),T(De,o),o&&t(_n),o&&t(L),T(Ye),o&&t(yn),o&&t(C),o&&t(bn),o&&t(ue),o&&t(vn),T(Xe,o),o&&t(Mn),o&&t(O),T(qe),o&&t(wn),o&&t(G),o&&t(jn),T(Ae,o),o&&t(Tn),o&&t(K),T(Pe),o&&t(En),o&&t($),T(Qe),T(be),T(He),T(Oe),o&&t(kn),o&&t(te),T(Ke),o&&t(Zn),o&&t(Z),T(eo),T(co),T(je),T(Te),T(io),T(Ee),o&&t(Jn),o&&t(se),T(po),o&&t(Wn),o&&t(J),T(ho),T(vo),T(Ze),T(Je),T(Mo),T(We)}}}const Uc={local:"speech-encoder-decoder-models",sections:[{local:"randomly-initializing-speechencoderdecodermodel-from-model-configurations",title:"Randomly initializing `SpeechEncoderDecoderModel` from model configurations."},{local:"initialising-speechencoderdecodermodel-from-a-pretrained-encoder-and-a-pretrained-decoder",title:"Initialising `SpeechEncoderDecoderModel` from a pretrained encoder and a pretrained decoder."},{local:"loading-an-existing-speechencoderdecodermodel-checkpoint-and-perform-inference",title:"Loading an existing `SpeechEncoderDecoderModel` checkpoint and perform inference."},{local:"training",title:"Training"},{local:"transformers.SpeechEncoderDecoderConfig",title:"SpeechEncoderDecoderConfig"},{local:"transformers.SpeechEncoderDecoderModel",title:"SpeechEncoderDecoderModel"},{local:"transformers.FlaxSpeechEncoderDecoderModel",title:"FlaxSpeechEncoderDecoderModel"}],title:"Speech Encoder Decoder Models"};function $c(V){return wc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bc extends yc{constructor(m){super();bc(this,m,$c,Sc,vc,{})}}export{Bc as default,Uc as metadata};
