import{S as Ji,i as Gi,s as Yi,e as s,k as l,w as _,t as r,M as Ki,c as n,d as o,m as d,a as i,x as v,h as a,b as c,G as e,g as m,y as T,q as x,o as k,B as b,v as Qi,L as Hi}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ri}from"../../chunks/Tip-hf-doc-builder.js";import{D as N}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $r}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as _t}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ui}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Xi(J){let f,$,u,g,S;return g=new $r({props:{code:`from transformers import Speech2Text2Config, Speech2Text2ForCausalLM

# Initializing a Speech2Text2 s2t_transformer_s style configuration
configuration = Speech2Text2Config()

# Initializing a model (with random weights) from the s2t_transformer_s style configuration
model = Speech2Text2ForCausalLM(configuration)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Speech2Text2 s2t_transformer_s style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Speech2Text2Config()

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){f=s("p"),$=r("Example:"),u=l(),_(g.$$.fragment)},l(h){f=n(h,"P",{});var w=i(f);$=a(w,"Example:"),w.forEach(o),u=d(h),v(g.$$.fragment,h)},m(h,w){m(h,f,w),e(f,$),m(h,u,w),T(g,h,w),S=!0},p:Hi,i(h){S||(x(g.$$.fragment,h),S=!0)},o(h){k(g.$$.fragment,h),S=!1},d(h){h&&o(f),h&&o(u),b(g,h)}}}function Zi(J){let f,$,u,g,S,h,w,I,A,z,C;return{c(){f=s("p"),$=r(`This class method is simply calling the feature extractor
`),u=s("a"),g=r("from_pretrained()"),S=r(`, image processor
`),h=s("a"),w=r("ImageProcessingMixin"),I=r(` and the tokenizer
`),A=s("code"),z=r("~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),C=r(` methods. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(P){f=n(P,"P",{});var q=i(f);$=a(q,`This class method is simply calling the feature extractor
`),u=n(q,"A",{href:!0});var G=i(u);g=a(G,"from_pretrained()"),G.forEach(o),S=a(q,`, image processor
`),h=n(q,"A",{href:!0});var vt=i(h);w=a(vt,"ImageProcessingMixin"),vt.forEach(o),I=a(q,` and the tokenizer
`),A=n(q,"CODE",{});var ce=i(A);z=a(ce,"~tokenization_utils_base.PreTrainedTokenizer.from_pretrained"),ce.forEach(o),C=a(q,` methods. Please refer to the docstrings of the
methods above for more information.`),q.forEach(o),this.h()},h(){c(u,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),c(h,"href","/docs/transformers/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin")},m(P,q){m(P,f,q),e(f,$),e(f,u),e(u,g),e(f,S),e(f,h),e(h,w),e(f,I),e(f,A),e(A,z),e(f,C)},d(P){P&&o(f)}}}function ec(J){let f,$,u,g,S,h,w,I;return{c(){f=s("p"),$=r("This class method is simply calling "),u=s("a"),g=r("save_pretrained()"),S=r(` and
`),h=s("a"),w=r("save_pretrained()"),I=r(`. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(A){f=n(A,"P",{});var z=i(f);$=a(z,"This class method is simply calling "),u=n(z,"A",{href:!0});var C=i(u);g=a(C,"save_pretrained()"),C.forEach(o),S=a(z,` and
`),h=n(z,"A",{href:!0});var P=i(h);w=a(P,"save_pretrained()"),P.forEach(o),I=a(z,`. Please refer to the docstrings of the
methods above for more information.`),z.forEach(o),this.h()},h(){c(u,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained"),c(h,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.save_pretrained")},m(A,z){m(A,f,z),e(f,$),e(f,u),e(u,g),e(f,S),e(f,h),e(h,w),e(f,I)},d(A){A&&o(f)}}}function tc(J){let f,$,u,g,S;return g=new $r({props:{code:`from transformers import (
    SpeechEncoderDecoderModel,
    Speech2Text2ForCausalLM,
    Wav2Vec2Model,
    Speech2Text2Config,
    Wav2Vec2Config,
    Wav2Vec2FeatureExtractor,
    Speech2Text2Tokenizer,
)
from datasets import load_dataset

feature_extractor = Wav2Vec2FeatureExtractor()
tokenizer = Speech2Text2Tokenizer.from_pretrained("facebook/s2t-wav2vec2-large-en-de")

encoder = Wav2Vec2Model(Wav2Vec2Config())
decoder = Speech2Text2ForCausalLM(Speech2Text2Config())
# init random speech2text model

model = SpeechEncoderDecoderModel(encoder=encoder, decoder=decoder)
model.config.pad_token_id = tokenizer.pad_token_id
model.config.decoder_start_token_id = tokenizer.bos_token_id
# pre-process inputs and labels

ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
inputs = feature_extractor(
    ds[0]["audio"]["array"], sampling_rate=ds[0]["audio"]["sampling_rate"], return_tensors="pt"
)
input_values = inputs.input_values
decoder_input_ids = tokenizer(ds[0]["text"], return_tensors="pt").input_ids
# compute loss

loss = model(inputs=input_values, labels=decoder_input_ids).loss
# backprop loss

loss.backward()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    SpeechEncoderDecoderModel,
<span class="hljs-meta">... </span>    Speech2Text2ForCausalLM,
<span class="hljs-meta">... </span>    Wav2Vec2Model,
<span class="hljs-meta">... </span>    Speech2Text2Config,
<span class="hljs-meta">... </span>    Wav2Vec2Config,
<span class="hljs-meta">... </span>    Wav2Vec2FeatureExtractor,
<span class="hljs-meta">... </span>    Speech2Text2Tokenizer,
<span class="hljs-meta">... </span>)
<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>feature_extractor = Wav2Vec2FeatureExtractor()
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Speech2Text2Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/s2t-wav2vec2-large-en-de&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>encoder = Wav2Vec2Model(Wav2Vec2Config())
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder = Speech2Text2ForCausalLM(Speech2Text2Config())
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># init random speech2text model</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel(encoder=encoder, decoder=decoder)
<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>model.config.decoder_start_token_id = tokenizer.bos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># pre-process inputs and labels</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>inputs = feature_extractor(
<span class="hljs-meta">... </span>    ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;sampling_rate&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = inputs.input_values
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = 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"># compute loss</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(inputs=input_values, labels=decoder_input_ids).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># backprop loss</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>loss.backward()`}}),{c(){f=s("p"),$=r("Example:"),u=l(),_(g.$$.fragment)},l(h){f=n(h,"P",{});var w=i(f);$=a(w,"Example:"),w.forEach(o),u=d(h),v(g.$$.fragment,h)},m(h,w){m(h,f,w),e(f,$),m(h,u,w),T(g,h,w),S=!0},p:Hi,i(h){S||(x(g.$$.fragment,h),S=!0)},o(h){k(g.$$.fragment,h),S=!1},d(h){h&&o(f),h&&o(u),b(g,h)}}}function oc(J){let f,$,u,g,S,h,w,I,A,z,C,P,q,G,vt,ce,Er,Mo,Y,zr,Tt,Pr,jr,je,Cr,qr,Fo,E,Mr,oo,Fr,Ar,ro,Lr,Dr,xt,Ir,Wr,kt,Vr,Nr,bt,Or,Br,ao,Rr,Ur,Ao,le,Hr,Ce,Jr,Gr,Lo,de,Yr,qe,Kr,Qr,Do,wt,Xr,Io,K,Me,Zr,Fe,ea,ta,oa,Ae,ra,St,aa,sa,na,Le,ia,De,ca,la,Wo,te,pe,so,Ie,da,no,pa,Vo,Q,ha,yt,ma,fa,$t,ua,ga,No,M,_a,Et,va,Ta,zt,xa,ka,Pt,ba,wa,jt,Sa,ya,Ct,$a,Ea,Oo,qt,io,za,Bo,We,Ro,Mt,Ve,co,Pa,ja,lo,Ca,Uo,Ne,Ho,he,qa,Oe,Ma,Fa,Jo,oe,me,po,Be,Aa,ho,La,Go,W,Re,Da,re,Ia,Ft,Wa,Va,Ue,Na,Oa,Ba,ae,Ra,At,Ua,Ha,Lt,Ja,Ga,Ya,fe,Yo,se,ue,mo,He,Ka,fo,Qa,Ko,j,Je,Xa,uo,Za,es,Ge,ts,Dt,os,rs,as,ge,Ye,ss,go,ns,is,X,Ke,cs,_o,ls,ds,Qe,ps,vo,hs,ms,fs,It,Xe,Qo,ne,_e,To,Ze,us,xo,gs,Xo,y,et,_s,ko,vs,Ts,L,Wt,xs,ks,Vt,bs,ws,Nt,Ss,ys,tt,bo,$s,Es,zs,Ot,Ps,js,Cs,ve,ot,qs,R,Ms,wo,Fs,As,So,Ls,Ds,rt,yo,Is,Ws,Vs,Ns,Z,at,Os,$o,Bs,Rs,Te,Us,ee,st,Hs,nt,Js,Bt,Gs,Ys,Ks,xe,Qs,ke,it,Xs,ct,Zs,Rt,en,tn,on,be,lt,rn,dt,an,Ut,sn,nn,Zo,ie,we,Eo,pt,cn,zo,ln,er,V,ht,dn,U,pn,Ht,hn,mn,Po,fn,un,Jt,gn,_n,vn,mt,Tn,ft,xn,kn,bn,Se,ut,wn,ye,tr;return h=new _t({}),G=new _t({}),Ie=new _t({}),We=new $r({props:{code:`import torch
from transformers import Speech2Text2Processor, SpeechEncoderDecoderModel
from datasets import load_dataset
import soundfile as sf

model = SpeechEncoderDecoderModel.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-de")


def map_to_array(batch):
    speech, _ = sf.read(batch["file"])
    batch["speech"] = speech
    return batch


ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
ds = ds.map(map_to_array)

inputs = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt")
generated_ids = model.generate(inputs=inputs["input_values"], attention_mask=inputs["attention_mask"])

transcription = processor.batch_decode(generated_ids)`,highlighted:`<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-keyword">from</span> transformers <span class="hljs-keyword">import</span> Speech2Text2Processor, 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> soundfile <span class="hljs-keyword">as</span> sf

<span class="hljs-meta">&gt;&gt;&gt; </span>model = SpeechEncoderDecoderModel.from_pretrained(<span class="hljs-string">&quot;facebook/s2t-wav2vec2-large-en-de&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Speech2Text2Processor.from_pretrained(<span class="hljs-string">&quot;facebook/s2t-wav2vec2-large-en-de&quot;</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">map_to_array</span>(<span class="hljs-params">batch</span>):
<span class="hljs-meta">... </span>    speech, _ = sf.read(batch[<span class="hljs-string">&quot;file&quot;</span>])
<span class="hljs-meta">... </span>    batch[<span class="hljs-string">&quot;speech&quot;</span>] = speech
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> batch


<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>ds = ds.<span class="hljs-built_in">map</span>(map_to_array)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], sampling_rate=<span class="hljs-number">16_000</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(inputs=inputs[<span class="hljs-string">&quot;input_values&quot;</span>], attention_mask=inputs[<span class="hljs-string">&quot;attention_mask&quot;</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>transcription = processor.batch_decode(generated_ids)`}}),Ne=new $r({props:{code:`from datasets import load_dataset
from transformers import pipeline

librispeech_en = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
asr = pipeline(
    "automatic-speech-recognition",
    model="facebook/s2t-wav2vec2-large-en-de",
    feature_extractor="facebook/s2t-wav2vec2-large-en-de",
)

translation_de = asr(librispeech_en[0]["file"])`,highlighted:`<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">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>librispeech_en = 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>asr = pipeline(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>,
<span class="hljs-meta">... </span>    model=<span class="hljs-string">&quot;facebook/s2t-wav2vec2-large-en-de&quot;</span>,
<span class="hljs-meta">... </span>    feature_extractor=<span class="hljs-string">&quot;facebook/s2t-wav2vec2-large-en-de&quot;</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>translation_de = asr(librispeech_en[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;file&quot;</span>])`}}),Be=new _t({}),Re=new N({props:{name:"class transformers.Speech2Text2Config",anchor:"transformers.Speech2Text2Config",parameters:[{name:"vocab_size",val:" = 10000"},{name:"decoder_layers",val:" = 6"},{name:"decoder_ffn_dim",val:" = 2048"},{name:"decoder_attention_heads",val:" = 4"},{name:"decoder_layerdrop",val:" = 0.0"},{name:"use_cache",val:" = True"},{name:"activation_function",val:" = 'relu'"},{name:"d_model",val:" = 256"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.0"},{name:"activation_dropout",val:" = 0.0"},{name:"init_std",val:" = 0.02"},{name:"decoder_start_token_id",val:" = 2"},{name:"scale_embedding",val:" = True"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"max_target_positions",val:" = 1024"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50265) &#x2014;
Vocabulary size of the Speech2Text model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/speech_to_text#transformers.Speech2TextModel">Speech2TextModel</a>`,name:"vocab_size"},{anchor:"transformers.Speech2Text2Config.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimensionality of the layers and the pooler layer.`,name:"d_model"},{anchor:"transformers.Speech2Text2Config.decoder_layers",description:`<strong>decoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of decoder layers.`,name:"decoder_layers"},{anchor:"transformers.Speech2Text2Config.decoder_attention_heads",description:`<strong>decoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"decoder_attention_heads"},{anchor:"transformers.Speech2Text2Config.decoder_ffn_dim",description:`<strong>decoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"decoder_ffn_dim"},{anchor:"transformers.Speech2Text2Config.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the pooler. If string, <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>,
<code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.Speech2Text2Config.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, and pooler.`,name:"dropout"},{anchor:"transformers.Speech2Text2Config.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Speech2Text2Config.activation_dropout",description:`<strong>activation_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for activations inside the fully connected layer.`,name:"activation_dropout"},{anchor:"transformers.Speech2Text2Config.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
<a href="https://arxiv.org/abs/1909.11556%3E%60" rel="nofollow">https://arxiv.org/abs/1909.11556&gt;\`</a>__ for more details.`,name:"init_std"},{anchor:"transformers.Speech2Text2Config.decoder_layerdrop",description:`<strong>decoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the decoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"decoder_layerdrop"},{anchor:"transformers.Speech2Text2Config.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.Speech2Text2Config.max_target_positions",description:`<strong>max_target_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_target_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/configuration_speech_to_text_2.py#L31"}}),fe=new Ui({props:{anchor:"transformers.Speech2Text2Config.example",$$slots:{default:[Xi]},$$scope:{ctx:J}}}),He=new _t({}),Je=new N({props:{name:"class transformers.Speech2Text2Tokenizer",anchor:"transformers.Speech2Text2Tokenizer",parameters:[{name:"vocab_file",val:""},{name:"bos_token",val:" = '<s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"do_lower_case",val:" = False"},{name:"merges_file",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Tokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.Speech2Text2Tokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sentence token.`,name:"bos_token"},{anchor:"transformers.Speech2Text2Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sentence token.`,name:"eos_token"},{anchor:"transformers.Speech2Text2Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.Speech2Text2Tokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.</p>
<p>**kwargs &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>`,name:"pad_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py#L73"}}),Ye=new N({props:{name:"batch_decode",anchor:"transformers.Speech2Text2Tokenizer.batch_decode",parameters:[{name:"sequences",val:": typing.Union[typing.List[int], typing.List[typing.List[int]], ForwardRef('np.ndarray'), ForwardRef('torch.Tensor'), ForwardRef('tf.Tensor')]"},{name:"skip_special_tokens",val:": bool = False"},{name:"clean_up_tokenization_spaces",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Tokenizer.batch_decode.sequences",description:`<strong>sequences</strong> (<code>Union[List[int], List[List[int]], np.ndarray, torch.Tensor, tf.Tensor]</code>) &#x2014;
List of tokenized input ids. Can be obtained using the <code>__call__</code> method.`,name:"sequences"},{anchor:"transformers.Speech2Text2Tokenizer.batch_decode.skip_special_tokens",description:`<strong>skip_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to remove special tokens in the decoding.`,name:"skip_special_tokens"},{anchor:"transformers.Speech2Text2Tokenizer.batch_decode.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean up the tokenization spaces.`,name:"clean_up_tokenization_spaces"},{anchor:"transformers.Speech2Text2Tokenizer.batch_decode.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Will be passed to the underlying model specific decode method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L3413",returnDescription:`
<p>The list of decoded sentences.</p>
`,returnType:`
<p><code>List[str]</code></p>
`}}),Ke=new N({props:{name:"decode",anchor:"transformers.Speech2Text2Tokenizer.decode",parameters:[{name:"token_ids",val:": typing.Union[int, typing.List[int], ForwardRef('np.ndarray'), ForwardRef('torch.Tensor'), ForwardRef('tf.Tensor')]"},{name:"skip_special_tokens",val:": bool = False"},{name:"clean_up_tokenization_spaces",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Tokenizer.decode.token_ids",description:`<strong>token_ids</strong> (<code>Union[int, List[int], np.ndarray, torch.Tensor, tf.Tensor]</code>) &#x2014;
List of tokenized input ids. Can be obtained using the <code>__call__</code> method.`,name:"token_ids"},{anchor:"transformers.Speech2Text2Tokenizer.decode.skip_special_tokens",description:`<strong>skip_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to remove special tokens in the decoding.`,name:"skip_special_tokens"},{anchor:"transformers.Speech2Text2Tokenizer.decode.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean up the tokenization spaces.`,name:"clean_up_tokenization_spaces"},{anchor:"transformers.Speech2Text2Tokenizer.decode.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Will be passed to the underlying model specific decode method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L3446",returnDescription:`
<p>The decoded sentence.</p>
`,returnType:`
<p><code>str</code></p>
`}}),Xe=new N({props:{name:"save_vocabulary",anchor:"transformers.Speech2Text2Tokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/tokenization_speech_to_text_2.py#L241"}}),Ze=new _t({}),et=new N({props:{name:"class transformers.Speech2Text2Processor",anchor:"transformers.Speech2Text2Processor",parameters:[{name:"feature_extractor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Processor.feature_extractor",description:`<strong>feature_extractor</strong> (<code>AutoFeatureExtractor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. The feature extractor is a required input.`,name:"feature_extractor"},{anchor:"transformers.Speech2Text2Processor.tokenizer",description:`<strong>tokenizer</strong> (<code>Speech2Text2Tokenizer</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer">Speech2Text2Tokenizer</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py#L24"}}),ot=new N({props:{name:"__call__",anchor:"transformers.Speech2Text2Processor.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py#L46"}}),at=new N({props:{name:"from_pretrained",anchor:"transformers.Speech2Text2Processor.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Processor.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
This can be either:</p>
<ul>
<li>a string, the <em>model id</em> of a pretrained feature_extractor 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 a feature extractor file saved using the
<a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained">save_pretrained()</a> method, e.g., <code>./my_model_directory/</code>.</li>
<li>a path or url to a saved feature extractor JSON <em>file</em>, e.g.,
<code>./my_model_directory/preprocessor_config.json</code>.
**kwargs &#x2014;
Additional keyword arguments passed along to both
<a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained">from_pretrained()</a> and
<code>~tokenization_utils_base.PreTrainedTokenizer.from_pretrained</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/processing_utils.py#L157"}}),Te=new Ri({props:{$$slots:{default:[Zi]},$$scope:{ctx:J}}}),st=new N({props:{name:"save_pretrained",anchor:"transformers.Speech2Text2Processor.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2Processor.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory where the feature extractor JSON file and the tokenizer files will be saved (directory will
be created if it does not exist).`,name:"save_directory"},{anchor:"transformers.Speech2Text2Processor.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).
kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/processing_utils.py#L95"}}),xe=new Ri({props:{$$slots:{default:[ec]},$$scope:{ctx:J}}}),it=new N({props:{name:"batch_decode",anchor:"transformers.Speech2Text2Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py#L85"}}),lt=new N({props:{name:"decode",anchor:"transformers.Speech2Text2Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py#L92"}}),pt=new _t({}),ht=new N({props:{name:"class transformers.Speech2Text2ForCausalLM",anchor:"transformers.Speech2Text2ForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Speech2Text2ForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Config">Speech2Text2Config</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/modeling_speech_to_text_2.py#L754"}}),ut=new N({props:{name:"forward",anchor:"transformers.Speech2Text2ForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Speech2Text2ForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
provide it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer">Speech2Text2Tokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Speech2Text2ForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</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.Speech2Text2ForCausalLM.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention
if the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.Speech2Text2ForCausalLM.forward.encoder_attention_mask",description:`<strong>encoder_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 the padding token indices of the encoder input. This mask is used
in the cross-attention if the model is configured as a decoder. Mask values selected in <code>[0, 1]</code>:`,name:"encoder_attention_mask"},{anchor:"transformers.Speech2Text2ForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(decoder_layers, decoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Speech2Text2ForCausalLM.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(decoder_layers, decoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.Speech2Text2ForCausalLM.forward.past_key_values",description:`<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>) &#x2014;
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>. The two additional
tensors are only required when the model is used as a decoder in a Sequence to Sequence model.</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>
<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.Speech2Text2ForCausalLM.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. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (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.Speech2Text2ForCausalLM.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>).</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>`,name:"use_cache"},{anchor:"transformers.Speech2Text2ForCausalLM.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.Speech2Text2ForCausalLM.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.Speech2Text2ForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/speech_to_text_2/modeling_speech_to_text_2.py#L787",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</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/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Config"
>Speech2Text2Config</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 (for next-token prediction).</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>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>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>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</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>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ye=new Ui({props:{anchor:"transformers.Speech2Text2ForCausalLM.forward.example",$$slots:{default:[tc]},$$scope:{ctx:J}}}),{c(){f=s("meta"),$=l(),u=s("h1"),g=s("a"),S=s("span"),_(h.$$.fragment),w=l(),I=s("span"),A=r("Speech2Text2"),z=l(),C=s("h2"),P=s("a"),q=s("span"),_(G.$$.fragment),vt=l(),ce=s("span"),Er=r("Overview"),Mo=l(),Y=s("p"),zr=r("The Speech2Text2 model is used together with "),Tt=s("a"),Pr=r("Wav2Vec2"),jr=r(` for Speech Translation models proposed in
`),je=s("a"),Cr=r("Large-Scale Self- and Semi-Supervised Learning for Speech Translation"),qr=r(` by
Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.`),Fo=l(),E=s("p"),Mr=r("Speech2Text2 is a "),oo=s("em"),Fr=r("decoder-only"),Ar=r(" transformer model that can be used with any speech "),ro=s("em"),Lr=r("encoder-only"),Dr=r(`, such as
`),xt=s("a"),Ir=r("Wav2Vec2"),Wr=r(" or "),kt=s("a"),Vr=r("HuBERT"),Nr=r(` for Speech-to-Text tasks. Please refer to the
`),bt=s("a"),Or=r("SpeechEncoderDecoder"),Br=r(" class on how to combine Speech2Text2 with any speech "),ao=s("em"),Rr=r("encoder-only"),Ur=r(`
model.`),Ao=l(),le=s("p"),Hr=r("This model was contributed by "),Ce=s("a"),Jr=r("Patrick von Platen"),Gr=r("."),Lo=l(),de=s("p"),Yr=r("The original code can be found "),qe=s("a"),Kr=r("here"),Qr=r("."),Do=l(),wt=s("p"),Xr=r("Tips:"),Io=l(),K=s("ul"),Me=s("li"),Zr=r(`Speech2Text2 achieves state-of-the-art results on the CoVoST Speech Translation dataset. For more information, see
the `),Fe=s("a"),ea=r("official models"),ta=r(" ."),oa=l(),Ae=s("li"),ra=r("Speech2Text2 is always used within the "),St=s("a"),aa=r("SpeechEncoderDecoder"),sa=r(" framework."),na=l(),Le=s("li"),ia=r("Speech2Text2\u2019s tokenizer is based on "),De=s("a"),ca=r("fastBPE"),la=r("."),Wo=l(),te=s("h2"),pe=s("a"),so=s("span"),_(Ie.$$.fragment),da=l(),no=s("span"),pa=r("Inference"),Vo=l(),Q=s("p"),ha=r("Speech2Text2\u2019s "),yt=s("a"),ma=r("SpeechEncoderDecoderModel"),fa=r(` model accepts raw waveform input values from speech and
makes use of `),$t=s("a"),ua=r("generate()"),ga=r(` to translate the input speech
autoregressively to the target language.`),No=l(),M=s("p"),_a=r("The "),Et=s("a"),va=r("Wav2Vec2FeatureExtractor"),Ta=r(` class is responsible for preprocessing the input speech and
`),zt=s("a"),xa=r("Speech2Text2Tokenizer"),ka=r(` decodes the generated target tokens to the target string. The
`),Pt=s("a"),ba=r("Speech2Text2Processor"),wa=r(" wraps "),jt=s("a"),Sa=r("Wav2Vec2FeatureExtractor"),ya=r(` and
`),Ct=s("a"),$a=r("Speech2Text2Tokenizer"),Ea=r(` into a single instance to both extract the input features and decode the
predicted token ids.`),Oo=l(),qt=s("ul"),io=s("li"),za=r("Step-by-step Speech Translation"),Bo=l(),_(We.$$.fragment),Ro=l(),Mt=s("ul"),Ve=s("li"),co=s("p"),Pa=r("Speech Translation via Pipelines"),ja=l(),lo=s("p"),Ca=r("The automatic speech recognition pipeline can also be used to translate speech in just a couple lines of code"),Uo=l(),_(Ne.$$.fragment),Ho=l(),he=s("p"),qa=r("See "),Oe=s("a"),Ma=r("model hub"),Fa=r(" to look for Speech2Text2 checkpoints."),Jo=l(),oe=s("h2"),me=s("a"),po=s("span"),_(Be.$$.fragment),Aa=l(),ho=s("span"),La=r("Speech2Text2Config"),Go=l(),W=s("div"),_(Re.$$.fragment),Da=l(),re=s("p"),Ia=r("This is the configuration class to store the configuration of a "),Ft=s("a"),Wa=r("Speech2Text2ForCausalLM"),Va=r(`. It is used to
instantiate an Speech2Text2 model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a similar configuration to that of the Speech2Text2
`),Ue=s("a"),Na=r("facebook/s2t-wav2vec2-large-en-de"),Oa=r(" architecture."),Ba=l(),ae=s("p"),Ra=r("Configuration objects inherit from "),At=s("a"),Ua=r("PretrainedConfig"),Ha=r(` and can be used to control the model outputs. Read the
documentation from `),Lt=s("a"),Ja=r("PretrainedConfig"),Ga=r(" for more information."),Ya=l(),_(fe.$$.fragment),Yo=l(),se=s("h2"),ue=s("a"),mo=s("span"),_(He.$$.fragment),Ka=l(),fo=s("span"),Qa=r("Speech2TextTokenizer"),Ko=l(),j=s("div"),_(Je.$$.fragment),Xa=l(),uo=s("p"),Za=r("Constructs a Speech2Text2Tokenizer."),es=l(),Ge=s("p"),ts=r("This tokenizer inherits from "),Dt=s("a"),os=r("PreTrainedTokenizer"),rs=r(` which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.`),as=l(),ge=s("div"),_(Ye.$$.fragment),ss=l(),go=s("p"),ns=r("Convert a list of lists of token ids into a list of strings by calling decode."),is=l(),X=s("div"),_(Ke.$$.fragment),cs=l(),_o=s("p"),ls=r(`Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
tokens and clean up tokenization spaces.`),ds=l(),Qe=s("p"),ps=r("Similar to doing "),vo=s("code"),hs=r("self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))"),ms=r("."),fs=l(),It=s("div"),_(Xe.$$.fragment),Qo=l(),ne=s("h2"),_e=s("a"),To=s("span"),_(Ze.$$.fragment),us=l(),xo=s("span"),gs=r("Speech2Text2Processor"),Xo=l(),y=s("div"),_(et.$$.fragment),_s=l(),ko=s("p"),vs=r(`Constructs a Speech2Text2 processor which wraps a Speech2Text2 feature extractor and a Speech2Text2 tokenizer into
a single processor.`),Ts=l(),L=s("p"),Wt=s("a"),xs=r("Speech2Text2Processor"),ks=r(" offers all the functionalities of "),Vt=s("a"),bs=r("AutoFeatureExtractor"),ws=r(" and "),Nt=s("a"),Ss=r("Speech2Text2Tokenizer"),ys=r(`.
See the `),tt=s("a"),bo=s("strong"),$s=r("call"),Es=r("()"),zs=r(" and "),Ot=s("a"),Ps=r("decode()"),js=r(" for more information."),Cs=l(),ve=s("div"),_(ot.$$.fragment),qs=l(),R=s("p"),Ms=r(`When used in normal mode, this method forwards all its arguments to AutoFeatureExtractor\u2019s
`),wo=s("code"),Fs=r("__call__()"),As=r(` and returns its output. If used in the context
`),So=s("code"),Ls=r("as_target_processor()"),Ds=r(` this method forwards all its arguments to
Speech2Text2Tokenizer\u2019s `),rt=s("a"),yo=s("strong"),Is=r("call"),Ws=r("()"),Vs=r(`. Please refer to the doctsring of the above two
methods for more information.`),Ns=l(),Z=s("div"),_(at.$$.fragment),Os=l(),$o=s("p"),Bs=r("Instantiate a processor associated with a pretrained model."),Rs=l(),_(Te.$$.fragment),Us=l(),ee=s("div"),_(st.$$.fragment),Hs=l(),nt=s("p"),Js=r(`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Bt=s("a"),Gs=r("from_pretrained()"),Ys=r(" method."),Ks=l(),_(xe.$$.fragment),Qs=l(),ke=s("div"),_(it.$$.fragment),Xs=l(),ct=s("p"),Zs=r("This method forwards all its arguments to Speech2Text2Tokenizer\u2019s "),Rt=s("a"),en=r("batch_decode()"),tn=r(`. Please
refer to the docstring of this method for more information.`),on=l(),be=s("div"),_(lt.$$.fragment),rn=l(),dt=s("p"),an=r("This method forwards all its arguments to Speech2Text2Tokenizer\u2019s "),Ut=s("a"),sn=r("decode()"),nn=r(`. Please refer
to the docstring of this method for more information.`),Zo=l(),ie=s("h2"),we=s("a"),Eo=s("span"),_(pt.$$.fragment),cn=l(),zo=s("span"),ln=r("Speech2Text2ForCausalLM"),er=l(),V=s("div"),_(ht.$$.fragment),dn=l(),U=s("p"),pn=r("The Speech2Text2 Decoder with a language modeling head. Can be used as the decoder part of "),Ht=s("a"),hn=r("EncoderDecoderModel"),mn=r(" and "),Po=s("code"),fn=r("SpeechEncoderDecoder"),un=r(`.
This model inherits from `),Jt=s("a"),gn=r("PreTrainedModel"),_n=r(`. 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.)`),vn=l(),mt=s("p"),Tn=r("This model is also a PyTorch "),ft=s("a"),xn=r("torch.nn.Module"),kn=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bn=l(),Se=s("div"),_(ut.$$.fragment),wn=l(),_(ye.$$.fragment),this.h()},l(t){const p=Ki('[data-svelte="svelte-1phssyn"]',document.head);f=n(p,"META",{name:!0,content:!0}),p.forEach(o),$=d(t),u=n(t,"H1",{class:!0});var gt=i(u);g=n(gt,"A",{id:!0,class:!0,href:!0});var jo=i(g);S=n(jo,"SPAN",{});var Co=i(S);v(h.$$.fragment,Co),Co.forEach(o),jo.forEach(o),w=d(gt),I=n(gt,"SPAN",{});var qo=i(I);A=a(qo,"Speech2Text2"),qo.forEach(o),gt.forEach(o),z=d(t),C=n(t,"H2",{class:!0});var or=i(C);P=n(or,"A",{id:!0,class:!0,href:!0});var $n=i(P);q=n($n,"SPAN",{});var En=i(q);v(G.$$.fragment,En),En.forEach(o),$n.forEach(o),vt=d(or),ce=n(or,"SPAN",{});var zn=i(ce);Er=a(zn,"Overview"),zn.forEach(o),or.forEach(o),Mo=d(t),Y=n(t,"P",{});var Gt=i(Y);zr=a(Gt,"The Speech2Text2 model is used together with "),Tt=n(Gt,"A",{href:!0});var Pn=i(Tt);Pr=a(Pn,"Wav2Vec2"),Pn.forEach(o),jr=a(Gt,` for Speech Translation models proposed in
`),je=n(Gt,"A",{href:!0,rel:!0});var jn=i(je);Cr=a(jn,"Large-Scale Self- and Semi-Supervised Learning for Speech Translation"),jn.forEach(o),qr=a(Gt,` by
Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.`),Gt.forEach(o),Fo=d(t),E=n(t,"P",{});var D=i(E);Mr=a(D,"Speech2Text2 is a "),oo=n(D,"EM",{});var Cn=i(oo);Fr=a(Cn,"decoder-only"),Cn.forEach(o),Ar=a(D," transformer model that can be used with any speech "),ro=n(D,"EM",{});var qn=i(ro);Lr=a(qn,"encoder-only"),qn.forEach(o),Dr=a(D,`, such as
`),xt=n(D,"A",{href:!0});var Mn=i(xt);Ir=a(Mn,"Wav2Vec2"),Mn.forEach(o),Wr=a(D," or "),kt=n(D,"A",{href:!0});var Fn=i(kt);Vr=a(Fn,"HuBERT"),Fn.forEach(o),Nr=a(D,` for Speech-to-Text tasks. Please refer to the
`),bt=n(D,"A",{href:!0});var An=i(bt);Or=a(An,"SpeechEncoderDecoder"),An.forEach(o),Br=a(D," class on how to combine Speech2Text2 with any speech "),ao=n(D,"EM",{});var Ln=i(ao);Rr=a(Ln,"encoder-only"),Ln.forEach(o),Ur=a(D,`
model.`),D.forEach(o),Ao=d(t),le=n(t,"P",{});var rr=i(le);Hr=a(rr,"This model was contributed by "),Ce=n(rr,"A",{href:!0,rel:!0});var Dn=i(Ce);Jr=a(Dn,"Patrick von Platen"),Dn.forEach(o),Gr=a(rr,"."),rr.forEach(o),Lo=d(t),de=n(t,"P",{});var ar=i(de);Yr=a(ar,"The original code can be found "),qe=n(ar,"A",{href:!0,rel:!0});var In=i(qe);Kr=a(In,"here"),In.forEach(o),Qr=a(ar,"."),ar.forEach(o),Do=d(t),wt=n(t,"P",{});var Wn=i(wt);Xr=a(Wn,"Tips:"),Wn.forEach(o),Io=d(t),K=n(t,"UL",{});var Yt=i(K);Me=n(Yt,"LI",{});var sr=i(Me);Zr=a(sr,`Speech2Text2 achieves state-of-the-art results on the CoVoST Speech Translation dataset. For more information, see
the `),Fe=n(sr,"A",{href:!0,rel:!0});var Vn=i(Fe);ea=a(Vn,"official models"),Vn.forEach(o),ta=a(sr," ."),sr.forEach(o),oa=d(Yt),Ae=n(Yt,"LI",{});var nr=i(Ae);ra=a(nr,"Speech2Text2 is always used within the "),St=n(nr,"A",{href:!0});var Nn=i(St);aa=a(Nn,"SpeechEncoderDecoder"),Nn.forEach(o),sa=a(nr," framework."),nr.forEach(o),na=d(Yt),Le=n(Yt,"LI",{});var ir=i(Le);ia=a(ir,"Speech2Text2\u2019s tokenizer is based on "),De=n(ir,"A",{href:!0,rel:!0});var On=i(De);ca=a(On,"fastBPE"),On.forEach(o),la=a(ir,"."),ir.forEach(o),Yt.forEach(o),Wo=d(t),te=n(t,"H2",{class:!0});var cr=i(te);pe=n(cr,"A",{id:!0,class:!0,href:!0});var Bn=i(pe);so=n(Bn,"SPAN",{});var Rn=i(so);v(Ie.$$.fragment,Rn),Rn.forEach(o),Bn.forEach(o),da=d(cr),no=n(cr,"SPAN",{});var Un=i(no);pa=a(Un,"Inference"),Un.forEach(o),cr.forEach(o),Vo=d(t),Q=n(t,"P",{});var Kt=i(Q);ha=a(Kt,"Speech2Text2\u2019s "),yt=n(Kt,"A",{href:!0});var Hn=i(yt);ma=a(Hn,"SpeechEncoderDecoderModel"),Hn.forEach(o),fa=a(Kt,` model accepts raw waveform input values from speech and
makes use of `),$t=n(Kt,"A",{href:!0});var Jn=i($t);ua=a(Jn,"generate()"),Jn.forEach(o),ga=a(Kt,` to translate the input speech
autoregressively to the target language.`),Kt.forEach(o),No=d(t),M=n(t,"P",{});var O=i(M);_a=a(O,"The "),Et=n(O,"A",{href:!0});var Gn=i(Et);va=a(Gn,"Wav2Vec2FeatureExtractor"),Gn.forEach(o),Ta=a(O,` class is responsible for preprocessing the input speech and
`),zt=n(O,"A",{href:!0});var Yn=i(zt);xa=a(Yn,"Speech2Text2Tokenizer"),Yn.forEach(o),ka=a(O,` decodes the generated target tokens to the target string. The
`),Pt=n(O,"A",{href:!0});var Kn=i(Pt);ba=a(Kn,"Speech2Text2Processor"),Kn.forEach(o),wa=a(O," wraps "),jt=n(O,"A",{href:!0});var Qn=i(jt);Sa=a(Qn,"Wav2Vec2FeatureExtractor"),Qn.forEach(o),ya=a(O,` and
`),Ct=n(O,"A",{href:!0});var Xn=i(Ct);$a=a(Xn,"Speech2Text2Tokenizer"),Xn.forEach(o),Ea=a(O,` into a single instance to both extract the input features and decode the
predicted token ids.`),O.forEach(o),Oo=d(t),qt=n(t,"UL",{});var Zn=i(qt);io=n(Zn,"LI",{});var ei=i(io);za=a(ei,"Step-by-step Speech Translation"),ei.forEach(o),Zn.forEach(o),Bo=d(t),v(We.$$.fragment,t),Ro=d(t),Mt=n(t,"UL",{});var ti=i(Mt);Ve=n(ti,"LI",{});var lr=i(Ve);co=n(lr,"P",{});var oi=i(co);Pa=a(oi,"Speech Translation via Pipelines"),oi.forEach(o),ja=d(lr),lo=n(lr,"P",{});var ri=i(lo);Ca=a(ri,"The automatic speech recognition pipeline can also be used to translate speech in just a couple lines of code"),ri.forEach(o),lr.forEach(o),ti.forEach(o),Uo=d(t),v(Ne.$$.fragment,t),Ho=d(t),he=n(t,"P",{});var dr=i(he);qa=a(dr,"See "),Oe=n(dr,"A",{href:!0,rel:!0});var ai=i(Oe);Ma=a(ai,"model hub"),ai.forEach(o),Fa=a(dr," to look for Speech2Text2 checkpoints."),dr.forEach(o),Jo=d(t),oe=n(t,"H2",{class:!0});var pr=i(oe);me=n(pr,"A",{id:!0,class:!0,href:!0});var si=i(me);po=n(si,"SPAN",{});var ni=i(po);v(Be.$$.fragment,ni),ni.forEach(o),si.forEach(o),Aa=d(pr),ho=n(pr,"SPAN",{});var ii=i(ho);La=a(ii,"Speech2Text2Config"),ii.forEach(o),pr.forEach(o),Go=d(t),W=n(t,"DIV",{class:!0});var $e=i(W);v(Re.$$.fragment,$e),Da=d($e),re=n($e,"P",{});var Qt=i(re);Ia=a(Qt,"This is the configuration class to store the configuration of a "),Ft=n(Qt,"A",{href:!0});var ci=i(Ft);Wa=a(ci,"Speech2Text2ForCausalLM"),ci.forEach(o),Va=a(Qt,`. It is used to
instantiate an Speech2Text2 model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a similar configuration to that of the Speech2Text2
`),Ue=n(Qt,"A",{href:!0,rel:!0});var li=i(Ue);Na=a(li,"facebook/s2t-wav2vec2-large-en-de"),li.forEach(o),Oa=a(Qt," architecture."),Qt.forEach(o),Ba=d($e),ae=n($e,"P",{});var Xt=i(ae);Ra=a(Xt,"Configuration objects inherit from "),At=n(Xt,"A",{href:!0});var di=i(At);Ua=a(di,"PretrainedConfig"),di.forEach(o),Ha=a(Xt,` and can be used to control the model outputs. Read the
documentation from `),Lt=n(Xt,"A",{href:!0});var pi=i(Lt);Ja=a(pi,"PretrainedConfig"),pi.forEach(o),Ga=a(Xt," for more information."),Xt.forEach(o),Ya=d($e),v(fe.$$.fragment,$e),$e.forEach(o),Yo=d(t),se=n(t,"H2",{class:!0});var hr=i(se);ue=n(hr,"A",{id:!0,class:!0,href:!0});var hi=i(ue);mo=n(hi,"SPAN",{});var mi=i(mo);v(He.$$.fragment,mi),mi.forEach(o),hi.forEach(o),Ka=d(hr),fo=n(hr,"SPAN",{});var fi=i(fo);Qa=a(fi,"Speech2TextTokenizer"),fi.forEach(o),hr.forEach(o),Ko=d(t),j=n(t,"DIV",{class:!0});var B=i(j);v(Je.$$.fragment,B),Xa=d(B),uo=n(B,"P",{});var ui=i(uo);Za=a(ui,"Constructs a Speech2Text2Tokenizer."),ui.forEach(o),es=d(B),Ge=n(B,"P",{});var mr=i(Ge);ts=a(mr,"This tokenizer inherits from "),Dt=n(mr,"A",{href:!0});var gi=i(Dt);os=a(gi,"PreTrainedTokenizer"),gi.forEach(o),rs=a(mr,` which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.`),mr.forEach(o),as=d(B),ge=n(B,"DIV",{class:!0});var fr=i(ge);v(Ye.$$.fragment,fr),ss=d(fr),go=n(fr,"P",{});var _i=i(go);ns=a(_i,"Convert a list of lists of token ids into a list of strings by calling decode."),_i.forEach(o),fr.forEach(o),is=d(B),X=n(B,"DIV",{class:!0});var Zt=i(X);v(Ke.$$.fragment,Zt),cs=d(Zt),_o=n(Zt,"P",{});var vi=i(_o);ls=a(vi,`Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
tokens and clean up tokenization spaces.`),vi.forEach(o),ds=d(Zt),Qe=n(Zt,"P",{});var ur=i(Qe);ps=a(ur,"Similar to doing "),vo=n(ur,"CODE",{});var Ti=i(vo);hs=a(Ti,"self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))"),Ti.forEach(o),ms=a(ur,"."),ur.forEach(o),Zt.forEach(o),fs=d(B),It=n(B,"DIV",{class:!0});var xi=i(It);v(Xe.$$.fragment,xi),xi.forEach(o),B.forEach(o),Qo=d(t),ne=n(t,"H2",{class:!0});var gr=i(ne);_e=n(gr,"A",{id:!0,class:!0,href:!0});var ki=i(_e);To=n(ki,"SPAN",{});var bi=i(To);v(Ze.$$.fragment,bi),bi.forEach(o),ki.forEach(o),us=d(gr),xo=n(gr,"SPAN",{});var wi=i(xo);gs=a(wi,"Speech2Text2Processor"),wi.forEach(o),gr.forEach(o),Xo=d(t),y=n(t,"DIV",{class:!0});var F=i(y);v(et.$$.fragment,F),_s=d(F),ko=n(F,"P",{});var Si=i(ko);vs=a(Si,`Constructs a Speech2Text2 processor which wraps a Speech2Text2 feature extractor and a Speech2Text2 tokenizer into
a single processor.`),Si.forEach(o),Ts=d(F),L=n(F,"P",{});var H=i(L);Wt=n(H,"A",{href:!0});var yi=i(Wt);xs=a(yi,"Speech2Text2Processor"),yi.forEach(o),ks=a(H," offers all the functionalities of "),Vt=n(H,"A",{href:!0});var $i=i(Vt);bs=a($i,"AutoFeatureExtractor"),$i.forEach(o),ws=a(H," and "),Nt=n(H,"A",{href:!0});var Ei=i(Nt);Ss=a(Ei,"Speech2Text2Tokenizer"),Ei.forEach(o),ys=a(H,`.
See the `),tt=n(H,"A",{href:!0});var Sn=i(tt);bo=n(Sn,"STRONG",{});var zi=i(bo);$s=a(zi,"call"),zi.forEach(o),Es=a(Sn,"()"),Sn.forEach(o),zs=a(H," and "),Ot=n(H,"A",{href:!0});var Pi=i(Ot);Ps=a(Pi,"decode()"),Pi.forEach(o),js=a(H," for more information."),H.forEach(o),Cs=d(F),ve=n(F,"DIV",{class:!0});var _r=i(ve);v(ot.$$.fragment,_r),qs=d(_r),R=n(_r,"P",{});var Ee=i(R);Ms=a(Ee,`When used in normal mode, this method forwards all its arguments to AutoFeatureExtractor\u2019s
`),wo=n(Ee,"CODE",{});var ji=i(wo);Fs=a(ji,"__call__()"),ji.forEach(o),As=a(Ee,` and returns its output. If used in the context
`),So=n(Ee,"CODE",{});var Ci=i(So);Ls=a(Ci,"as_target_processor()"),Ci.forEach(o),Ds=a(Ee,` this method forwards all its arguments to
Speech2Text2Tokenizer\u2019s `),rt=n(Ee,"A",{href:!0});var yn=i(rt);yo=n(yn,"STRONG",{});var qi=i(yo);Is=a(qi,"call"),qi.forEach(o),Ws=a(yn,"()"),yn.forEach(o),Vs=a(Ee,`. Please refer to the doctsring of the above two
methods for more information.`),Ee.forEach(o),_r.forEach(o),Ns=d(F),Z=n(F,"DIV",{class:!0});var eo=i(Z);v(at.$$.fragment,eo),Os=d(eo),$o=n(eo,"P",{});var Mi=i($o);Bs=a(Mi,"Instantiate a processor associated with a pretrained model."),Mi.forEach(o),Rs=d(eo),v(Te.$$.fragment,eo),eo.forEach(o),Us=d(F),ee=n(F,"DIV",{class:!0});var to=i(ee);v(st.$$.fragment,to),Hs=d(to),nt=n(to,"P",{});var vr=i(nt);Js=a(vr,`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Bt=n(vr,"A",{href:!0});var Fi=i(Bt);Gs=a(Fi,"from_pretrained()"),Fi.forEach(o),Ys=a(vr," method."),vr.forEach(o),Ks=d(to),v(xe.$$.fragment,to),to.forEach(o),Qs=d(F),ke=n(F,"DIV",{class:!0});var Tr=i(ke);v(it.$$.fragment,Tr),Xs=d(Tr),ct=n(Tr,"P",{});var xr=i(ct);Zs=a(xr,"This method forwards all its arguments to Speech2Text2Tokenizer\u2019s "),Rt=n(xr,"A",{href:!0});var Ai=i(Rt);en=a(Ai,"batch_decode()"),Ai.forEach(o),tn=a(xr,`. Please
refer to the docstring of this method for more information.`),xr.forEach(o),Tr.forEach(o),on=d(F),be=n(F,"DIV",{class:!0});var kr=i(be);v(lt.$$.fragment,kr),rn=d(kr),dt=n(kr,"P",{});var br=i(dt);an=a(br,"This method forwards all its arguments to Speech2Text2Tokenizer\u2019s "),Ut=n(br,"A",{href:!0});var Li=i(Ut);sn=a(Li,"decode()"),Li.forEach(o),nn=a(br,`. Please refer
to the docstring of this method for more information.`),br.forEach(o),kr.forEach(o),F.forEach(o),Zo=d(t),ie=n(t,"H2",{class:!0});var wr=i(ie);we=n(wr,"A",{id:!0,class:!0,href:!0});var Di=i(we);Eo=n(Di,"SPAN",{});var Ii=i(Eo);v(pt.$$.fragment,Ii),Ii.forEach(o),Di.forEach(o),cn=d(wr),zo=n(wr,"SPAN",{});var Wi=i(zo);ln=a(Wi,"Speech2Text2ForCausalLM"),Wi.forEach(o),wr.forEach(o),er=d(t),V=n(t,"DIV",{class:!0});var ze=i(V);v(ht.$$.fragment,ze),dn=d(ze),U=n(ze,"P",{});var Pe=i(U);pn=a(Pe,"The Speech2Text2 Decoder with a language modeling head. Can be used as the decoder part of "),Ht=n(Pe,"A",{href:!0});var Vi=i(Ht);hn=a(Vi,"EncoderDecoderModel"),Vi.forEach(o),mn=a(Pe," and "),Po=n(Pe,"CODE",{});var Ni=i(Po);fn=a(Ni,"SpeechEncoderDecoder"),Ni.forEach(o),un=a(Pe,`.
This model inherits from `),Jt=n(Pe,"A",{href:!0});var Oi=i(Jt);gn=a(Oi,"PreTrainedModel"),Oi.forEach(o),_n=a(Pe,`. 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.)`),Pe.forEach(o),vn=d(ze),mt=n(ze,"P",{});var Sr=i(mt);Tn=a(Sr,"This model is also a PyTorch "),ft=n(Sr,"A",{href:!0,rel:!0});var Bi=i(ft);xn=a(Bi,"torch.nn.Module"),Bi.forEach(o),kn=a(Sr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Sr.forEach(o),bn=d(ze),Se=n(ze,"DIV",{class:!0});var yr=i(Se);v(ut.$$.fragment,yr),wn=d(yr),v(ye.$$.fragment,yr),yr.forEach(o),ze.forEach(o),this.h()},h(){c(f,"name","hf:doc:metadata"),c(f,"content",JSON.stringify(rc)),c(g,"id","speech2text2"),c(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(g,"href","#speech2text2"),c(u,"class","relative group"),c(P,"id","overview"),c(P,"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(P,"href","#overview"),c(C,"class","relative group"),c(Tt,"href","wav2vec2"),c(je,"href","https://arxiv.org/abs/2104.06678"),c(je,"rel","nofollow"),c(xt,"href","wav2vec2"),c(kt,"href","hubert"),c(bt,"href","speech-encoder-decoder"),c(Ce,"href","https://huggingface.co/patrickvonplaten"),c(Ce,"rel","nofollow"),c(qe,"href","https://github.com/pytorch/fairseq/blob/1f7ef9ed1e1061f8c7f88f8b94c7186834398690/fairseq/models/wav2vec/wav2vec2_asr.py#L266"),c(qe,"rel","nofollow"),c(Fe,"href","https://huggingface.co/models?other=speech2text2"),c(Fe,"rel","nofollow"),c(St,"href","speech-encoder-decoder"),c(De,"href","https://github.com/glample/fastBPE"),c(De,"rel","nofollow"),c(pe,"id","inference"),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","#inference"),c(te,"class","relative group"),c(yt,"href","/docs/transformers/main/en/model_doc/speech-encoder-decoder#transformers.SpeechEncoderDecoderModel"),c($t,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate"),c(Et,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor"),c(zt,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer"),c(Pt,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Processor"),c(jt,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor"),c(Ct,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer"),c(Oe,"href","https://huggingface.co/models?filter=speech2text2"),c(Oe,"rel","nofollow"),c(me,"id","transformers.Speech2Text2Config"),c(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(me,"href","#transformers.Speech2Text2Config"),c(oe,"class","relative group"),c(Ft,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2ForCausalLM"),c(Ue,"href","https://huggingface.co/facebook/s2t-wav2vec2-large-en-de"),c(Ue,"rel","nofollow"),c(At,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(Lt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ue,"id","transformers.Speech2Text2Tokenizer"),c(ue,"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(ue,"href","#transformers.Speech2Text2Tokenizer"),c(se,"class","relative group"),c(Dt,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),c(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(It,"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"),c(_e,"id","transformers.Speech2Text2Processor"),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.Speech2Text2Processor"),c(ne,"class","relative group"),c(Wt,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Processor"),c(Vt,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoFeatureExtractor"),c(Nt,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Tokenizer"),c(tt,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Processor.__call__"),c(Ot,"href","/docs/transformers/main/en/model_doc/speech_to_text_2#transformers.Speech2Text2Processor.decode"),c(rt,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__"),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(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(Bt,"href","/docs/transformers/main/en/model_doc/trocr#transformers.TrOCRProcessor.from_pretrained"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Rt,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),c(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ut,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),c(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(y,"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.Speech2Text2ForCausalLM"),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.Speech2Text2ForCausalLM"),c(ie,"class","relative group"),c(Ht,"href","/docs/transformers/main/en/model_doc/encoder-decoder#transformers.EncoderDecoderModel"),c(Jt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ft,"rel","nofollow"),c(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,f),m(t,$,p),m(t,u,p),e(u,g),e(g,S),T(h,S,null),e(u,w),e(u,I),e(I,A),m(t,z,p),m(t,C,p),e(C,P),e(P,q),T(G,q,null),e(C,vt),e(C,ce),e(ce,Er),m(t,Mo,p),m(t,Y,p),e(Y,zr),e(Y,Tt),e(Tt,Pr),e(Y,jr),e(Y,je),e(je,Cr),e(Y,qr),m(t,Fo,p),m(t,E,p),e(E,Mr),e(E,oo),e(oo,Fr),e(E,Ar),e(E,ro),e(ro,Lr),e(E,Dr),e(E,xt),e(xt,Ir),e(E,Wr),e(E,kt),e(kt,Vr),e(E,Nr),e(E,bt),e(bt,Or),e(E,Br),e(E,ao),e(ao,Rr),e(E,Ur),m(t,Ao,p),m(t,le,p),e(le,Hr),e(le,Ce),e(Ce,Jr),e(le,Gr),m(t,Lo,p),m(t,de,p),e(de,Yr),e(de,qe),e(qe,Kr),e(de,Qr),m(t,Do,p),m(t,wt,p),e(wt,Xr),m(t,Io,p),m(t,K,p),e(K,Me),e(Me,Zr),e(Me,Fe),e(Fe,ea),e(Me,ta),e(K,oa),e(K,Ae),e(Ae,ra),e(Ae,St),e(St,aa),e(Ae,sa),e(K,na),e(K,Le),e(Le,ia),e(Le,De),e(De,ca),e(Le,la),m(t,Wo,p),m(t,te,p),e(te,pe),e(pe,so),T(Ie,so,null),e(te,da),e(te,no),e(no,pa),m(t,Vo,p),m(t,Q,p),e(Q,ha),e(Q,yt),e(yt,ma),e(Q,fa),e(Q,$t),e($t,ua),e(Q,ga),m(t,No,p),m(t,M,p),e(M,_a),e(M,Et),e(Et,va),e(M,Ta),e(M,zt),e(zt,xa),e(M,ka),e(M,Pt),e(Pt,ba),e(M,wa),e(M,jt),e(jt,Sa),e(M,ya),e(M,Ct),e(Ct,$a),e(M,Ea),m(t,Oo,p),m(t,qt,p),e(qt,io),e(io,za),m(t,Bo,p),T(We,t,p),m(t,Ro,p),m(t,Mt,p),e(Mt,Ve),e(Ve,co),e(co,Pa),e(Ve,ja),e(Ve,lo),e(lo,Ca),m(t,Uo,p),T(Ne,t,p),m(t,Ho,p),m(t,he,p),e(he,qa),e(he,Oe),e(Oe,Ma),e(he,Fa),m(t,Jo,p),m(t,oe,p),e(oe,me),e(me,po),T(Be,po,null),e(oe,Aa),e(oe,ho),e(ho,La),m(t,Go,p),m(t,W,p),T(Re,W,null),e(W,Da),e(W,re),e(re,Ia),e(re,Ft),e(Ft,Wa),e(re,Va),e(re,Ue),e(Ue,Na),e(re,Oa),e(W,Ba),e(W,ae),e(ae,Ra),e(ae,At),e(At,Ua),e(ae,Ha),e(ae,Lt),e(Lt,Ja),e(ae,Ga),e(W,Ya),T(fe,W,null),m(t,Yo,p),m(t,se,p),e(se,ue),e(ue,mo),T(He,mo,null),e(se,Ka),e(se,fo),e(fo,Qa),m(t,Ko,p),m(t,j,p),T(Je,j,null),e(j,Xa),e(j,uo),e(uo,Za),e(j,es),e(j,Ge),e(Ge,ts),e(Ge,Dt),e(Dt,os),e(Ge,rs),e(j,as),e(j,ge),T(Ye,ge,null),e(ge,ss),e(ge,go),e(go,ns),e(j,is),e(j,X),T(Ke,X,null),e(X,cs),e(X,_o),e(_o,ls),e(X,ds),e(X,Qe),e(Qe,ps),e(Qe,vo),e(vo,hs),e(Qe,ms),e(j,fs),e(j,It),T(Xe,It,null),m(t,Qo,p),m(t,ne,p),e(ne,_e),e(_e,To),T(Ze,To,null),e(ne,us),e(ne,xo),e(xo,gs),m(t,Xo,p),m(t,y,p),T(et,y,null),e(y,_s),e(y,ko),e(ko,vs),e(y,Ts),e(y,L),e(L,Wt),e(Wt,xs),e(L,ks),e(L,Vt),e(Vt,bs),e(L,ws),e(L,Nt),e(Nt,Ss),e(L,ys),e(L,tt),e(tt,bo),e(bo,$s),e(tt,Es),e(L,zs),e(L,Ot),e(Ot,Ps),e(L,js),e(y,Cs),e(y,ve),T(ot,ve,null),e(ve,qs),e(ve,R),e(R,Ms),e(R,wo),e(wo,Fs),e(R,As),e(R,So),e(So,Ls),e(R,Ds),e(R,rt),e(rt,yo),e(yo,Is),e(rt,Ws),e(R,Vs),e(y,Ns),e(y,Z),T(at,Z,null),e(Z,Os),e(Z,$o),e($o,Bs),e(Z,Rs),T(Te,Z,null),e(y,Us),e(y,ee),T(st,ee,null),e(ee,Hs),e(ee,nt),e(nt,Js),e(nt,Bt),e(Bt,Gs),e(nt,Ys),e(ee,Ks),T(xe,ee,null),e(y,Qs),e(y,ke),T(it,ke,null),e(ke,Xs),e(ke,ct),e(ct,Zs),e(ct,Rt),e(Rt,en),e(ct,tn),e(y,on),e(y,be),T(lt,be,null),e(be,rn),e(be,dt),e(dt,an),e(dt,Ut),e(Ut,sn),e(dt,nn),m(t,Zo,p),m(t,ie,p),e(ie,we),e(we,Eo),T(pt,Eo,null),e(ie,cn),e(ie,zo),e(zo,ln),m(t,er,p),m(t,V,p),T(ht,V,null),e(V,dn),e(V,U),e(U,pn),e(U,Ht),e(Ht,hn),e(U,mn),e(U,Po),e(Po,fn),e(U,un),e(U,Jt),e(Jt,gn),e(U,_n),e(V,vn),e(V,mt),e(mt,Tn),e(mt,ft),e(ft,xn),e(mt,kn),e(V,bn),e(V,Se),T(ut,Se,null),e(Se,wn),T(ye,Se,null),tr=!0},p(t,[p]){const gt={};p&2&&(gt.$$scope={dirty:p,ctx:t}),fe.$set(gt);const jo={};p&2&&(jo.$$scope={dirty:p,ctx:t}),Te.$set(jo);const Co={};p&2&&(Co.$$scope={dirty:p,ctx:t}),xe.$set(Co);const qo={};p&2&&(qo.$$scope={dirty:p,ctx:t}),ye.$set(qo)},i(t){tr||(x(h.$$.fragment,t),x(G.$$.fragment,t),x(Ie.$$.fragment,t),x(We.$$.fragment,t),x(Ne.$$.fragment,t),x(Be.$$.fragment,t),x(Re.$$.fragment,t),x(fe.$$.fragment,t),x(He.$$.fragment,t),x(Je.$$.fragment,t),x(Ye.$$.fragment,t),x(Ke.$$.fragment,t),x(Xe.$$.fragment,t),x(Ze.$$.fragment,t),x(et.$$.fragment,t),x(ot.$$.fragment,t),x(at.$$.fragment,t),x(Te.$$.fragment,t),x(st.$$.fragment,t),x(xe.$$.fragment,t),x(it.$$.fragment,t),x(lt.$$.fragment,t),x(pt.$$.fragment,t),x(ht.$$.fragment,t),x(ut.$$.fragment,t),x(ye.$$.fragment,t),tr=!0)},o(t){k(h.$$.fragment,t),k(G.$$.fragment,t),k(Ie.$$.fragment,t),k(We.$$.fragment,t),k(Ne.$$.fragment,t),k(Be.$$.fragment,t),k(Re.$$.fragment,t),k(fe.$$.fragment,t),k(He.$$.fragment,t),k(Je.$$.fragment,t),k(Ye.$$.fragment,t),k(Ke.$$.fragment,t),k(Xe.$$.fragment,t),k(Ze.$$.fragment,t),k(et.$$.fragment,t),k(ot.$$.fragment,t),k(at.$$.fragment,t),k(Te.$$.fragment,t),k(st.$$.fragment,t),k(xe.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k(pt.$$.fragment,t),k(ht.$$.fragment,t),k(ut.$$.fragment,t),k(ye.$$.fragment,t),tr=!1},d(t){o(f),t&&o($),t&&o(u),b(h),t&&o(z),t&&o(C),b(G),t&&o(Mo),t&&o(Y),t&&o(Fo),t&&o(E),t&&o(Ao),t&&o(le),t&&o(Lo),t&&o(de),t&&o(Do),t&&o(wt),t&&o(Io),t&&o(K),t&&o(Wo),t&&o(te),b(Ie),t&&o(Vo),t&&o(Q),t&&o(No),t&&o(M),t&&o(Oo),t&&o(qt),t&&o(Bo),b(We,t),t&&o(Ro),t&&o(Mt),t&&o(Uo),b(Ne,t),t&&o(Ho),t&&o(he),t&&o(Jo),t&&o(oe),b(Be),t&&o(Go),t&&o(W),b(Re),b(fe),t&&o(Yo),t&&o(se),b(He),t&&o(Ko),t&&o(j),b(Je),b(Ye),b(Ke),b(Xe),t&&o(Qo),t&&o(ne),b(Ze),t&&o(Xo),t&&o(y),b(et),b(ot),b(at),b(Te),b(st),b(xe),b(it),b(lt),t&&o(Zo),t&&o(ie),b(pt),t&&o(er),t&&o(V),b(ht),b(ut),b(ye)}}}const rc={local:"speech2text2",sections:[{local:"overview",title:"Overview"},{local:"inference",title:"Inference"},{local:"transformers.Speech2Text2Config",title:"Speech2Text2Config"},{local:"transformers.Speech2Text2Tokenizer",title:"Speech2TextTokenizer"},{local:"transformers.Speech2Text2Processor",title:"Speech2Text2Processor"},{local:"transformers.Speech2Text2ForCausalLM",title:"Speech2Text2ForCausalLM"}],title:"Speech2Text2"};function ac(J){return Qi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pc extends Ji{constructor(f){super();Gi(this,f,ac,oc,Yi,{})}}export{pc as default,rc as metadata};
