import{S as ST,i as IT,s as NT,e as n,k as d,w,t as a,M as BT,c as r,d as t,m as p,a as i,x as y,h as s,b as c,G as e,g as _,y as k,q as T,o as x,B as $,v as RT,L as Ge}from"../../chunks/vendor-hf-doc-builder.js";import{T as xe}from"../../chunks/Tip-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Me}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as oe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Xe}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as DT}from"../../chunks/PipelineTag-hf-doc-builder.js";function UT(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import Wav2Vec2Config, Wav2Vec2Model

# Initializing a Wav2Vec2 facebook/wav2vec2-base-960h style configuration
configuration = Wav2Vec2Config()

# Initializing a model (with random weights) from the facebook/wav2vec2-base-960h style configuration
model = Wav2Vec2Model(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> Wav2Vec2Config, Wav2Vec2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Wav2Vec2 facebook/wav2vec2-base-960h style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Wav2Vec2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/wav2vec2-base-960h style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2Model(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(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function HT(W){let m,b,f,u,v;return u=new Me({props:{code:`# Let's see how to retrieve time steps for a model
from transformers import AutoTokenizer, AutoFeatureExtractor, AutoModelForCTC
from datasets import load_dataset
import datasets
import torch

# import model, feature extractor, tokenizer
model = AutoModelForCTC.from_pretrained("facebook/wav2vec2-base-960h")
tokenizer = AutoTokenizer.from_pretrained("facebook/wav2vec2-base-960h")
feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h")

# load first sample of English common_voice
dataset = load_dataset("common_voice", "en", split="train", streaming=True)
dataset = dataset.cast_column("audio", datasets.Audio(sampling_rate=16_000))
dataset_iter = iter(dataset)
sample = next(dataset_iter)

# forward sample through model to get greedily predicted transcription ids
input_values = feature_extractor(sample["audio"]["array"], return_tensors="pt").input_values
logits = model(input_values).logits[0]
pred_ids = torch.argmax(logits, axis=-1)

# retrieve word stamps (analogous commands for \`output_char_offsets\`)
outputs = tokenizer.decode(pred_ids, output_word_offsets=True)
# compute \`time_offset\` in seconds as product of downsampling ratio and sampling_rate
time_offset = model.config.inputs_to_logits_ratio / feature_extractor.sampling_rate

word_offsets = [
    {
        "word": d["word"],
        "start_time": round(d["start_offset"] * time_offset, 2),
        "end_time": round(d["end_offset"] * time_offset, 2),
    }
    for d in outputs.word_offsets
]
# compare word offsets with audio \`common_voice_en_100038.mp3\` online on the dataset viewer:
# https://huggingface.co/datasets/common_voice/viewer/en/train
word_offsets[:3]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Let&#x27;s see how to retrieve time steps for a model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoFeatureExtractor, AutoModelForCTC
<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> datasets
<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"># import model, feature extractor, tokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load first sample of English common_voice</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;common_voice&quot;</span>, <span class="hljs-string">&quot;en&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>, streaming=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, datasets.Audio(sampling_rate=<span class="hljs-number">16_000</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset_iter = <span class="hljs-built_in">iter</span>(dataset)
<span class="hljs-meta">&gt;&gt;&gt; </span>sample = <span class="hljs-built_in">next</span>(dataset_iter)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward sample through model to get greedily predicted transcription ids</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = feature_extractor(sample[<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>logits = model(input_values).logits[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>pred_ids = torch.argmax(logits, axis=-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve word stamps (analogous commands for \`output_char_offsets\`)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = tokenizer.decode(pred_ids, output_word_offsets=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute \`time_offset\` in seconds as product of downsampling ratio and sampling_rate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>time_offset = model.config.inputs_to_logits_ratio / feature_extractor.sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>word_offsets = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;word&quot;</span>: d[<span class="hljs-string">&quot;word&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;start_time&quot;</span>: <span class="hljs-built_in">round</span>(d[<span class="hljs-string">&quot;start_offset&quot;</span>] * time_offset, <span class="hljs-number">2</span>),
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;end_time&quot;</span>: <span class="hljs-built_in">round</span>(d[<span class="hljs-string">&quot;end_offset&quot;</span>] * time_offset, <span class="hljs-number">2</span>),
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> d <span class="hljs-keyword">in</span> outputs.word_offsets
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compare word offsets with audio \`common_voice_en_100038.mp3\` online on the dataset viewer:</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># https://huggingface.co/datasets/common_voice/viewer/en/train</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>word_offsets[:<span class="hljs-number">3</span>]
[{<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;WHY&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">1.42</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">1.54</span>}, {<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;DOES&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">1.64</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">1.9</span>}, {<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;MILISANDRA&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">2.26</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">2.9</span>}]`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function XT(W){let m,b,f,u,v,l,h,V;return{c(){m=n("p"),b=a("This class method is simply calling "),f=n("a"),u=a("save_pretrained()"),v=a(` and
`),l=n("a"),h=a("save_pretrained()"),V=a(`. Please refer to the docstrings of the
methods above for more information.`),this.h()},l(M){m=r(M,"P",{});var L=i(m);b=s(L,"This class method is simply calling "),f=r(L,"A",{href:!0});var A=i(f);u=s(A,"save_pretrained()"),A.forEach(t),v=s(L,` and
`),l=r(L,"A",{href:!0});var z=i(l);h=s(z,"save_pretrained()"),z.forEach(t),V=s(L,`. Please refer to the docstrings of the
methods above for more information.`),L.forEach(t),this.h()},h(){c(f,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained"),c(l,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.save_pretrained")},m(M,L){_(M,m,L),e(m,b),e(m,f),e(f,u),e(m,v),e(m,l),e(l,h),e(m,V)},d(M){M&&t(m)}}}function GT(W){let m,b,f,u,v,l,h,V,M,L,A,z,N,E;return{c(){m=n("p"),b=a(`This class method is simply calling Wav2Vec2FeatureExtractor\u2019s
`),f=n("a"),u=a("from_pretrained()"),v=a(`, Wav2Vec2CTCTokenizer\u2019s
`),l=n("a"),h=a("from_pretrained()"),V=a(`, and
`),M=n("code"),L=a("pyctcdecode.BeamSearchDecoderCTC.load_from_hf_hub"),A=a("."),z=d(),N=n("p"),E=a("Please refer to the docstrings of the methods above for more information."),this.h()},l(O){m=r(O,"P",{});var C=i(m);b=s(C,`This class method is simply calling Wav2Vec2FeatureExtractor\u2019s
`),f=r(C,"A",{href:!0});var ce=i(f);u=s(ce,"from_pretrained()"),ce.forEach(t),v=s(C,`, Wav2Vec2CTCTokenizer\u2019s
`),l=r(C,"A",{href:!0});var K=i(l);h=s(K,"from_pretrained()"),K.forEach(t),V=s(C,`, and
`),M=r(C,"CODE",{});var S=i(M);L=s(S,"pyctcdecode.BeamSearchDecoderCTC.load_from_hf_hub"),S.forEach(t),A=s(C,"."),C.forEach(t),z=p(O),N=r(O,"P",{});var de=i(N);E=s(de,"Please refer to the docstrings of the methods above for more information."),de.forEach(t),this.h()},h(){c(f,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),c(l,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.from_pretrained")},m(O,C){_(O,m,C),e(m,b),e(m,f),e(f,u),e(m,v),e(m,l),e(l,h),e(m,V),e(m,M),e(M,L),e(m,A),_(O,z,C),_(O,N,C),e(N,E)},d(O){O&&t(m),O&&t(z),O&&t(N)}}}function KT(W){let m,b,f,u,v,l,h,V,M,L,A,z,N,E,O,C,ce,K,S,de;return{c(){m=n("p"),b=a(`This function makes use of Python\u2019s multiprocessing. Currently, multiprocessing is available only on Unix
systems (see this `),f=n("a"),u=a("issue"),v=a(")."),l=d(),h=n("p"),V=a("If you are decoding multiple batches, consider creating a "),M=n("code"),L=a("Pool"),A=a(" and passing it to "),z=n("code"),N=a("batch_decode"),E=a(`. Otherwise,
`),O=n("code"),C=a("batch_decode"),ce=a(" will be very slow since it will create a fresh "),K=n("code"),S=a("Pool"),de=a(" for each call. See usage example below."),this.h()},l(I){m=r(I,"P",{});var R=i(m);b=s(R,`This function makes use of Python\u2019s multiprocessing. Currently, multiprocessing is available only on Unix
systems (see this `),f=r(R,"A",{href:!0,rel:!0});var Le=i(f);u=s(Le,"issue"),Le.forEach(t),v=s(R,")."),R.forEach(t),l=p(I),h=r(I,"P",{});var X=i(h);V=s(X,"If you are decoding multiple batches, consider creating a "),M=r(X,"CODE",{});var J=i(M);L=s(J,"Pool"),J.forEach(t),A=s(X," and passing it to "),z=r(X,"CODE",{});var Oe=i(z);N=s(Oe,"batch_decode"),Oe.forEach(t),E=s(X,`. Otherwise,
`),O=r(X,"CODE",{});var $e=i(O);C=s($e,"batch_decode"),$e.forEach(t),ce=s(X," will be very slow since it will create a fresh "),K=r(X,"CODE",{});var Z=i(K);S=s(Z,"Pool"),Z.forEach(t),de=s(X," for each call. See usage example below."),X.forEach(t),this.h()},h(){c(f,"href","https://github.com/kensho-technologies/pyctcdecode/issues/65"),c(f,"rel","nofollow")},m(I,R){_(I,m,R),e(m,b),e(m,f),e(f,u),e(m,v),_(I,l,R),_(I,h,R),e(h,V),e(h,M),e(M,L),e(h,A),e(h,z),e(z,N),e(h,E),e(h,O),e(O,C),e(h,ce),e(h,K),e(K,S),e(h,de)},d(I){I&&t(m),I&&t(l),I&&t(h)}}}function JT(W){let m,b,f,u,v;return u=new Me({props:{code:`# Let's see how to retrieve time steps for a model
from transformers import AutoTokenizer, AutoProcessor, AutoModelForCTC
from datasets import load_dataset
import datasets
import torch

# import model, feature extractor, tokenizer
model = AutoModelForCTC.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm")
processor = AutoProcessor.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm")

# load first sample of English common_voice
dataset = load_dataset("common_voice", "en", split="train", streaming=True)
dataset = dataset.cast_column("audio", datasets.Audio(sampling_rate=16_000))
dataset_iter = iter(dataset)
sample = next(dataset_iter)

# forward sample through model to get greedily predicted transcription ids
input_values = processor(sample["audio"]["array"], return_tensors="pt").input_values
with torch.no_grad():
    logits = model(input_values).logits[0].cpu().numpy()

# retrieve word stamps (analogous commands for \`output_char_offsets\`)
outputs = processor.decode(logits, output_word_offsets=True)
# compute \`time_offset\` in seconds as product of downsampling ratio and sampling_rate
time_offset = model.config.inputs_to_logits_ratio / processor.feature_extractor.sampling_rate

word_offsets = [
    {
        "word": d["word"],
        "start_time": round(d["start_offset"] * time_offset, 2),
        "end_time": round(d["end_offset"] * time_offset, 2),
    }
    for d in outputs.word_offsets
]
# compare word offsets with audio \`common_voice_en_100038.mp3\` online on the dataset viewer:
# https://huggingface.co/datasets/common_voice/viewer/en/train
word_offsets[:4]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Let&#x27;s see how to retrieve time steps for a model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoProcessor, AutoModelForCTC
<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> datasets
<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"># import model, feature extractor, tokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCTC.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/wav2vec2-base-100h-with-lm&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/wav2vec2-base-100h-with-lm&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load first sample of English common_voice</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;common_voice&quot;</span>, <span class="hljs-string">&quot;en&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>, streaming=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, datasets.Audio(sampling_rate=<span class="hljs-number">16_000</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset_iter = <span class="hljs-built_in">iter</span>(dataset)
<span class="hljs-meta">&gt;&gt;&gt; </span>sample = <span class="hljs-built_in">next</span>(dataset_iter)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward sample through model to get greedily predicted transcription ids</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(sample[<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-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(input_values).logits[<span class="hljs-number">0</span>].cpu().numpy()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve word stamps (analogous commands for \`output_char_offsets\`)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = processor.decode(logits, output_word_offsets=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute \`time_offset\` in seconds as product of downsampling ratio and sampling_rate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>time_offset = model.config.inputs_to_logits_ratio / processor.feature_extractor.sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>word_offsets = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;word&quot;</span>: d[<span class="hljs-string">&quot;word&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;start_time&quot;</span>: <span class="hljs-built_in">round</span>(d[<span class="hljs-string">&quot;start_offset&quot;</span>] * time_offset, <span class="hljs-number">2</span>),
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;end_time&quot;</span>: <span class="hljs-built_in">round</span>(d[<span class="hljs-string">&quot;end_offset&quot;</span>] * time_offset, <span class="hljs-number">2</span>),
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> d <span class="hljs-keyword">in</span> outputs.word_offsets
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compare word offsets with audio \`common_voice_en_100038.mp3\` online on the dataset viewer:</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># https://huggingface.co/datasets/common_voice/viewer/en/train</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>word_offsets[:<span class="hljs-number">4</span>]
[{<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;WHY&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">1.42</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">1.54</span>}, {<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;DOES&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">1.64</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">1.88</span>}, {<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;A&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">2.12</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">2.14</span>}, {<span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;MILE&#x27;</span>, <span class="hljs-string">&#x27;start_time&#x27;</span>: <span class="hljs-number">2.26</span>, <span class="hljs-string">&#x27;end_time&#x27;</span>: <span class="hljs-number">2.46</span>}]`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function ZT(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function QT(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoProcessor, Wav2Vec2Model
import torch
from datasets import load_dataset

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
model = Wav2Vec2Model.from_pretrained("facebook/wav2vec2-base-960h")

# audio file is decoded on the fly
inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Wav2Vec2Model
<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> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&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>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2Model.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">292</span>, <span class="hljs-number">768</span>]`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function YT(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function ex(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoProcessor, Wav2Vec2ForCTC
from datasets import load_dataset
import torch

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")

# audio file is decoded on the fly
inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
with torch.no_grad():
    logits = model(**inputs).logits
predicted_ids = torch.argmax(logits, dim=-1)

# transcribe speech
transcription = processor.batch_decode(predicted_ids)
transcription[0]

inputs["labels"] = processor(text=dataset[0]["text"], return_tensors="pt").input_ids

# compute loss
loss = model(**inputs).loss
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Wav2Vec2ForCTC
<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>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&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>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2ForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_ids = torch.argmax(logits, dim=-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># transcribe speech</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>transcription = processor.batch_decode(predicted_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcription[<span class="hljs-number">0</span>]
<span class="hljs-string">&#x27;MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = processor(text=dataset[<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).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">53.48</span>`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function tx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function ox(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoFeatureExtractor, Wav2Vec2ForSequenceClassification
from datasets import load_dataset
import torch

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

feature_extractor = AutoFeatureExtractor.from_pretrained("superb/wav2vec2-base-superb-ks")
model = Wav2Vec2ForSequenceClassification.from_pretrained("superb/wav2vec2-base-superb-ks")

# audio file is decoded on the fly
inputs = feature_extractor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_ids = torch.argmax(logits, dim=-1).item()
predicted_label = model.config.id2label[predicted_class_ids]
predicted_label

# compute loss - target_label is e.g. "down"
target_label = model.config.id2label[0]
inputs["labels"] = torch.tensor([model.config.label2id[target_label]])
loss = model(**inputs).loss
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, Wav2Vec2ForSequenceClassification
<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>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&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>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;superb/wav2vec2-base-superb-ks&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;superb/wav2vec2-base-superb-ks&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.argmax(logits, dim=-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = model.config.id2label[predicted_class_ids]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label
<span class="hljs-string">&#x27;_unknown_&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute loss - target_label is e.g. &quot;down&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_label = model.config.id2label[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = torch.tensor([model.config.label2id[target_label]])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">6.54</span>`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function ax(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function sx(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoFeatureExtractor, Wav2Vec2ForAudioFrameClassification
from datasets import load_dataset
import torch

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

feature_extractor = AutoFeatureExtractor.from_pretrained("anton-l/wav2vec2-base-superb-sd")
model = Wav2Vec2ForAudioFrameClassification.from_pretrained("anton-l/wav2vec2-base-superb-sd")

# audio file is decoded on the fly
inputs = feature_extractor(dataset[0]["audio"]["array"], return_tensors="pt", sampling_rate=sampling_rate)
with torch.no_grad():
    logits = model(**inputs).logits

probabilities = torch.sigmoid(logits[0])
# labels is a one-hot array of shape (num_frames, num_speakers)
labels = (probabilities > 0.5).long()
labels[0].tolist()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, Wav2Vec2ForAudioFrameClassification
<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>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&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>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;anton-l/wav2vec2-base-superb-sd&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2ForAudioFrameClassification.from_pretrained(<span class="hljs-string">&quot;anton-l/wav2vec2-base-superb-sd&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(dataset[<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>, sampling_rate=sampling_rate)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>probabilities = torch.sigmoid(logits[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># labels is a one-hot array of shape (num_frames, num_speakers)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = (probabilities &gt; <span class="hljs-number">0.5</span>).long()
<span class="hljs-meta">&gt;&gt;&gt; </span>labels[<span class="hljs-number">0</span>].tolist()
[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>]`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function nx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function rx(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoFeatureExtractor, Wav2Vec2ForXVector
from datasets import load_dataset
import torch

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

feature_extractor = AutoFeatureExtractor.from_pretrained("anton-l/wav2vec2-base-superb-sv")
model = Wav2Vec2ForXVector.from_pretrained("anton-l/wav2vec2-base-superb-sv")

# audio file is decoded on the fly
inputs = feature_extractor(
    [d["array"] for d in dataset[:2]["audio"]], sampling_rate=sampling_rate, return_tensors="pt", padding=True
)
with torch.no_grad():
    embeddings = model(**inputs).embeddings

embeddings = torch.nn.functional.normalize(embeddings, dim=-1).cpu()

# the resulting embeddings can be used for cosine similarity-based retrieval
cosine_sim = torch.nn.CosineSimilarity(dim=-1)
similarity = cosine_sim(embeddings[0], embeddings[1])
threshold = 0.7  # the optimal threshold is dataset-dependent
if similarity < threshold:
    print("Speakers are not the same!")
round(similarity.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, Wav2Vec2ForXVector
<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>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&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>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;anton-l/wav2vec2-base-superb-sv&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2ForXVector.from_pretrained(<span class="hljs-string">&quot;anton-l/wav2vec2-base-superb-sv&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># audio file is decoded on the fly</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(
<span class="hljs-meta">... </span>    [d[<span class="hljs-string">&quot;array&quot;</span>] <span class="hljs-keyword">for</span> d <span class="hljs-keyword">in</span> dataset[:<span class="hljs-number">2</span>][<span class="hljs-string">&quot;audio&quot;</span>]], sampling_rate=sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    embeddings = model(**inputs).embeddings

<span class="hljs-meta">&gt;&gt;&gt; </span>embeddings = torch.nn.functional.normalize(embeddings, dim=-<span class="hljs-number">1</span>).cpu()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the resulting embeddings can be used for cosine similarity-based retrieval</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>cosine_sim = torch.nn.CosineSimilarity(dim=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>similarity = cosine_sim(embeddings[<span class="hljs-number">0</span>], embeddings[<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>threshold = <span class="hljs-number">0.7</span>  <span class="hljs-comment"># the optimal threshold is dataset-dependent</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> similarity &lt; threshold:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Speakers are not the same!&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(similarity.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">0.98</span>`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function ix(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function lx(W){let m,b,f,u,v;return u=new Me({props:{code:`import torch
from transformers import AutoFeatureExtractor, Wav2Vec2ForPreTraining
from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices, _sample_negative_indices
from datasets import load_dataset

feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
model = Wav2Vec2ForPreTraining.from_pretrained("facebook/wav2vec2-base")

ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
input_values = feature_extractor(ds[0]["audio"]["array"], return_tensors="pt").input_values  # Batch size 1

# compute masked indices
batch_size, raw_sequence_length = input_values.shape
sequence_length = model._get_feat_extract_output_lengths(raw_sequence_length).item()
mask_time_indices = _compute_mask_indices(
    shape=(batch_size, sequence_length), mask_prob=0.2, mask_length=2
)
sampled_negative_indices = _sample_negative_indices(
    features_shape=(batch_size, sequence_length),
    num_negatives=model.config.num_negatives,
    mask_time_indices=mask_time_indices,
)
mask_time_indices = torch.tensor(data=mask_time_indices, device=input_values.device, dtype=torch.long)
sampled_negative_indices = torch.tensor(
    data=sampled_negative_indices, device=input_values.device, dtype=torch.long
)

with torch.no_grad():
    outputs = model(input_values, mask_time_indices=mask_time_indices)

# compute cosine similarity between predicted (=projected_states) and target (=projected_quantized_states)
cosine_sim = torch.cosine_similarity(outputs.projected_states, outputs.projected_quantized_states, dim=-1)

# show that cosine similarity is much higher than random
cosine_sim[mask_time_indices.to(torch.bool)].mean() > 0.5

# for contrastive loss training model should be put into train mode
model = model.train()
loss = model(
    input_values, mask_time_indices=mask_time_indices, sampled_negative_indices=sampled_negative_indices
).loss`,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> AutoFeatureExtractor, Wav2Vec2ForPreTraining
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.models.wav2vec2.modeling_wav2vec2 <span class="hljs-keyword">import</span> _compute_mask_indices, _sample_negative_indices
<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 = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Wav2Vec2ForPreTraining.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base&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 = 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-comment"># Batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute masked indices</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size, raw_sequence_length = input_values.shape
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_length = model._get_feat_extract_output_lengths(raw_sequence_length).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_time_indices = _compute_mask_indices(
<span class="hljs-meta">... </span>    shape=(batch_size, sequence_length), mask_prob=<span class="hljs-number">0.2</span>, mask_length=<span class="hljs-number">2</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampled_negative_indices = _sample_negative_indices(
<span class="hljs-meta">... </span>    features_shape=(batch_size, sequence_length),
<span class="hljs-meta">... </span>    num_negatives=model.config.num_negatives,
<span class="hljs-meta">... </span>    mask_time_indices=mask_time_indices,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_time_indices = torch.tensor(data=mask_time_indices, device=input_values.device, dtype=torch.long)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampled_negative_indices = torch.tensor(
<span class="hljs-meta">... </span>    data=sampled_negative_indices, device=input_values.device, dtype=torch.long
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(input_values, mask_time_indices=mask_time_indices)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute cosine similarity between predicted (=projected_states) and target (=projected_quantized_states)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>cosine_sim = torch.cosine_similarity(outputs.projected_states, outputs.projected_quantized_states, dim=-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># show that cosine similarity is much higher than random</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>cosine_sim[mask_time_indices.to(torch.<span class="hljs-built_in">bool</span>)].mean() &gt; <span class="hljs-number">0.5</span>
tensor(<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># for contrastive loss training model should be put into train mode</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = model.train()
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(
<span class="hljs-meta">... </span>    input_values, mask_time_indices=mask_time_indices, sampled_negative_indices=sampled_negative_indices
<span class="hljs-meta">... </span>).loss`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function cx(W){let m,b,f,u,v,l,h,V,M,L,A,z,N,E,O,C,ce,K,S,de,I,R,Le,X,J,Oe,$e,Z,Ke,xt,De,D,Q,tt,ae,Je,$t,je,We,jt,U,Wt,Ve,ot,we,Fe,Ee,Vt,he,at,Y,ye,Ce,B,Ft,ee,Et,st;return{c(){m=n("p"),b=a("TensorFlow models and layers in "),f=n("code"),u=a("transformers"),v=a(" accept two formats as input:"),l=d(),h=n("ul"),V=n("li"),M=a("having all inputs as keyword arguments (like PyTorch models), or"),L=d(),A=n("li"),z=a("having all inputs as a list, tuple or dict in the first positional argument."),N=d(),E=n("p"),O=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),C=n("code"),ce=a("model.fit()"),K=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=n("code"),de=a("model.fit()"),I=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=n("code"),Le=a("fit()"),X=a(" and "),J=n("code"),Oe=a("predict()"),$e=a(`, such as when creating your own layers or models with
the Keras `),Z=n("code"),Ke=a("Functional"),xt=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),De=d(),D=n("ul"),Q=n("li"),tt=a("a single Tensor with "),ae=n("code"),Je=a("input_values"),$t=a(" only and nothing else: "),je=n("code"),We=a("model(input_values)"),jt=d(),U=n("li"),Wt=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Ve=n("code"),ot=a("model([input_values, attention_mask])"),we=a(" or "),Fe=n("code"),Ee=a("model([input_values, attention_mask, token_type_ids])"),Vt=d(),he=n("li"),at=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=n("code"),ye=a('model({"input_values": input_values, "token_type_ids": token_type_ids})'),Ce=d(),B=n("p"),Ft=a(`Note that when creating models and layers with
`),ee=n("a"),Et=a("subclassing"),st=a(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(j){m=r(j,"P",{});var P=i(m);b=s(P,"TensorFlow models and layers in "),f=r(P,"CODE",{});var It=i(f);u=s(It,"transformers"),It.forEach(t),v=s(P," accept two formats as input:"),P.forEach(t),l=p(j),h=r(j,"UL",{});var ue=i(h);V=r(ue,"LI",{});var Nt=i(V);M=s(Nt,"having all inputs as keyword arguments (like PyTorch models), or"),Nt.forEach(t),L=p(ue),A=r(ue,"LI",{});var Se=i(A);z=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),ue.forEach(t),N=p(j),E=r(j,"P",{});var q=i(E);O=s(q,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),C=r(q,"CODE",{});var Yt=i(C);ce=s(Yt,"model.fit()"),Yt.forEach(t),K=s(q,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(q,"CODE",{});var Ze=i(S);de=s(Ze,"model.fit()"),Ze.forEach(t),I=s(q,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(q,"CODE",{});var eo=i(R);Le=s(eo,"fit()"),eo.forEach(t),X=s(q," and "),J=r(q,"CODE",{});var to=i(J);Oe=s(to,"predict()"),to.forEach(t),$e=s(q,`, such as when creating your own layers or models with
the Keras `),Z=r(q,"CODE",{});var oo=i(Z);Ke=s(oo,"Functional"),oo.forEach(t),xt=s(q,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),q.forEach(t),De=p(j),D=r(j,"UL",{});var H=i(D);Q=r(H,"LI",{});var pe=i(Q);tt=s(pe,"a single Tensor with "),ae=r(pe,"CODE",{});var ao=i(ae);Je=s(ao,"input_values"),ao.forEach(t),$t=s(pe," only and nothing else: "),je=r(pe,"CODE",{});var so=i(je);We=s(so,"model(input_values)"),so.forEach(t),pe.forEach(t),jt=p(H),U=r(H,"LI",{});var se=i(U);Wt=s(se,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Ve=r(se,"CODE",{});var no=i(Ve);ot=s(no,"model([input_values, attention_mask])"),no.forEach(t),we=s(se," or "),Fe=r(se,"CODE",{});var ro=i(Fe);Ee=s(ro,"model([input_values, attention_mask, token_type_ids])"),ro.forEach(t),se.forEach(t),Vt=p(H),he=r(H,"LI",{});var Pe=i(he);at=s(Pe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(Pe,"CODE",{});var io=i(Y);ye=s(io,'model({"input_values": input_values, "token_type_ids": token_type_ids})'),io.forEach(t),Pe.forEach(t),H.forEach(t),Ce=p(j),B=r(j,"P",{});var Qe=i(B);Ft=s(Qe,`Note that when creating models and layers with
`),ee=r(Qe,"A",{href:!0,rel:!0});var Bt=i(ee);Et=s(Bt,"subclassing"),Bt.forEach(t),st=s(Qe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Qe.forEach(t),this.h()},h(){c(ee,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),c(ee,"rel","nofollow")},m(j,P){_(j,m,P),e(m,b),e(m,f),e(f,u),e(m,v),_(j,l,P),_(j,h,P),e(h,V),e(V,M),e(h,L),e(h,A),e(A,z),_(j,N,P),_(j,E,P),e(E,O),e(E,C),e(C,ce),e(E,K),e(E,S),e(S,de),e(E,I),e(E,R),e(R,Le),e(E,X),e(E,J),e(J,Oe),e(E,$e),e(E,Z),e(Z,Ke),e(E,xt),_(j,De,P),_(j,D,P),e(D,Q),e(Q,tt),e(Q,ae),e(ae,Je),e(Q,$t),e(Q,je),e(je,We),e(D,jt),e(D,U),e(U,Wt),e(U,Ve),e(Ve,ot),e(U,we),e(U,Fe),e(Fe,Ee),e(D,Vt),e(D,he),e(he,at),e(he,Y),e(Y,ye),_(j,Ce,P),_(j,B,P),e(B,Ft),e(B,ee),e(ee,Et),e(B,st)},d(j){j&&t(m),j&&t(l),j&&t(h),j&&t(N),j&&t(E),j&&t(De),j&&t(D),j&&t(Ce),j&&t(B)}}}function dx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function px(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoProcessor, TFWav2Vec2Model
from datasets import load_dataset
import soundfile as sf

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
model = TFWav2Vec2Model.from_pretrained("facebook/wav2vec2-base-960h")


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)

input_values = processor(ds["speech"][0], return_tensors="tf").input_values  # Batch size 1
hidden_states = model(input_values).last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFWav2Vec2Model
<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>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFWav2Vec2Model.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&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>input_values = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = model(input_values).last_hidden_state`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function mx(W){let m,b,f,u,v,l,h,V,M,L,A,z,N,E,O,C,ce,K,S,de,I,R,Le,X,J,Oe,$e,Z,Ke,xt,De,D,Q,tt,ae,Je,$t,je,We,jt,U,Wt,Ve,ot,we,Fe,Ee,Vt,he,at,Y,ye,Ce,B,Ft,ee,Et,st;return{c(){m=n("p"),b=a("TensorFlow models and layers in "),f=n("code"),u=a("transformers"),v=a(" accept two formats as input:"),l=d(),h=n("ul"),V=n("li"),M=a("having all inputs as keyword arguments (like PyTorch models), or"),L=d(),A=n("li"),z=a("having all inputs as a list, tuple or dict in the first positional argument."),N=d(),E=n("p"),O=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),C=n("code"),ce=a("model.fit()"),K=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=n("code"),de=a("model.fit()"),I=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),R=n("code"),Le=a("fit()"),X=a(" and "),J=n("code"),Oe=a("predict()"),$e=a(`, such as when creating your own layers or models with
the Keras `),Z=n("code"),Ke=a("Functional"),xt=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),De=d(),D=n("ul"),Q=n("li"),tt=a("a single Tensor with "),ae=n("code"),Je=a("input_values"),$t=a(" only and nothing else: "),je=n("code"),We=a("model(input_values)"),jt=d(),U=n("li"),Wt=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Ve=n("code"),ot=a("model([input_values, attention_mask])"),we=a(" or "),Fe=n("code"),Ee=a("model([input_values, attention_mask, token_type_ids])"),Vt=d(),he=n("li"),at=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=n("code"),ye=a('model({"input_values": input_values, "token_type_ids": token_type_ids})'),Ce=d(),B=n("p"),Ft=a(`Note that when creating models and layers with
`),ee=n("a"),Et=a("subclassing"),st=a(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(j){m=r(j,"P",{});var P=i(m);b=s(P,"TensorFlow models and layers in "),f=r(P,"CODE",{});var It=i(f);u=s(It,"transformers"),It.forEach(t),v=s(P," accept two formats as input:"),P.forEach(t),l=p(j),h=r(j,"UL",{});var ue=i(h);V=r(ue,"LI",{});var Nt=i(V);M=s(Nt,"having all inputs as keyword arguments (like PyTorch models), or"),Nt.forEach(t),L=p(ue),A=r(ue,"LI",{});var Se=i(A);z=s(Se,"having all inputs as a list, tuple or dict in the first positional argument."),Se.forEach(t),ue.forEach(t),N=p(j),E=r(j,"P",{});var q=i(E);O=s(q,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),C=r(q,"CODE",{});var Yt=i(C);ce=s(Yt,"model.fit()"),Yt.forEach(t),K=s(q,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(q,"CODE",{});var Ze=i(S);de=s(Ze,"model.fit()"),Ze.forEach(t),I=s(q,` supports! If, however, you want to use the second
format outside of Keras methods like `),R=r(q,"CODE",{});var eo=i(R);Le=s(eo,"fit()"),eo.forEach(t),X=s(q," and "),J=r(q,"CODE",{});var to=i(J);Oe=s(to,"predict()"),to.forEach(t),$e=s(q,`, such as when creating your own layers or models with
the Keras `),Z=r(q,"CODE",{});var oo=i(Z);Ke=s(oo,"Functional"),oo.forEach(t),xt=s(q,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),q.forEach(t),De=p(j),D=r(j,"UL",{});var H=i(D);Q=r(H,"LI",{});var pe=i(Q);tt=s(pe,"a single Tensor with "),ae=r(pe,"CODE",{});var ao=i(ae);Je=s(ao,"input_values"),ao.forEach(t),$t=s(pe," only and nothing else: "),je=r(pe,"CODE",{});var so=i(je);We=s(so,"model(input_values)"),so.forEach(t),pe.forEach(t),jt=p(H),U=r(H,"LI",{});var se=i(U);Wt=s(se,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Ve=r(se,"CODE",{});var no=i(Ve);ot=s(no,"model([input_values, attention_mask])"),no.forEach(t),we=s(se," or "),Fe=r(se,"CODE",{});var ro=i(Fe);Ee=s(ro,"model([input_values, attention_mask, token_type_ids])"),ro.forEach(t),se.forEach(t),Vt=p(H),he=r(H,"LI",{});var Pe=i(he);at=s(Pe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),Y=r(Pe,"CODE",{});var io=i(Y);ye=s(io,'model({"input_values": input_values, "token_type_ids": token_type_ids})'),io.forEach(t),Pe.forEach(t),H.forEach(t),Ce=p(j),B=r(j,"P",{});var Qe=i(B);Ft=s(Qe,`Note that when creating models and layers with
`),ee=r(Qe,"A",{href:!0,rel:!0});var Bt=i(ee);Et=s(Bt,"subclassing"),Bt.forEach(t),st=s(Qe,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Qe.forEach(t),this.h()},h(){c(ee,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),c(ee,"rel","nofollow")},m(j,P){_(j,m,P),e(m,b),e(m,f),e(f,u),e(m,v),_(j,l,P),_(j,h,P),e(h,V),e(V,M),e(h,L),e(h,A),e(A,z),_(j,N,P),_(j,E,P),e(E,O),e(E,C),e(C,ce),e(E,K),e(E,S),e(S,de),e(E,I),e(E,R),e(R,Le),e(E,X),e(E,J),e(J,Oe),e(E,$e),e(E,Z),e(Z,Ke),e(E,xt),_(j,De,P),_(j,D,P),e(D,Q),e(Q,tt),e(Q,ae),e(ae,Je),e(Q,$t),e(Q,je),e(je,We),e(D,jt),e(D,U),e(U,Wt),e(U,Ve),e(Ve,ot),e(U,we),e(U,Fe),e(Fe,Ee),e(D,Vt),e(D,he),e(he,at),e(he,Y),e(Y,ye),_(j,Ce,P),_(j,B,P),e(B,Ft),e(B,ee),e(ee,Et),e(B,st)},d(j){j&&t(m),j&&t(l),j&&t(h),j&&t(N),j&&t(E),j&&t(De),j&&t(D),j&&t(Ce),j&&t(B)}}}function hx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function ux(W){let m,b,f,u,v;return u=new Me({props:{code:`import tensorflow as tf
from transformers import AutoProcessor, TFWav2Vec2ForCTC
from datasets import load_dataset
import soundfile as sf

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
model = TFWav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")


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)

input_values = processor(ds["speech"][0], return_tensors="tf").input_values  # Batch size 1
logits = model(input_values).logits
predicted_ids = tf.argmax(logits, axis=-1)

transcription = processor.decode(predicted_ids[0])

# compute loss
target_transcription = "A MAN SAID TO THE UNIVERSE SIR I EXIST"

# Pass transcription as \`text\` to encode labels
labels = processor(text=transcription, return_tensors="tf").input_ids

loss = model(input_values, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFWav2Vec2ForCTC
<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>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFWav2Vec2ForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base-960h&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>input_values = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(input_values).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_ids = tf.argmax(logits, axis=-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>transcription = processor.decode(predicted_ids[<span class="hljs-number">0</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute loss</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_transcription = <span class="hljs-string">&quot;A MAN SAID TO THE UNIVERSE SIR I EXIST&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Pass transcription as \`text\` to encode labels</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = processor(text=transcription, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(input_values, labels=labels).loss`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function fx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function gx(W){let m,b,f,u,v;return u=new Me({props:{code:`from transformers import AutoProcessor, FlaxWav2Vec2Model
from datasets import load_dataset
import soundfile as sf

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-large-lv60")
model = FlaxWav2Vec2Model.from_pretrained("facebook/wav2vec2-large-lv60")


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)

input_values = processor(
    ds["speech"][0], sampling_rate=16_000, return_tensors="np"
).input_values  # Batch size 1
hidden_states = model(input_values).last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, FlaxWav2Vec2Model
<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>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-lv60&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxWav2Vec2Model.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-lv60&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>input_values = processor(
<span class="hljs-meta">... </span>    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;np&quot;</span>
<span class="hljs-meta">... </span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = model(input_values).last_hidden_state`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function _x(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function vx(W){let m,b,f,u,v;return u=new Me({props:{code:`import jax.numpy as jnp
from transformers import AutoProcessor, FlaxWav2Vec2ForCTC
from datasets import load_dataset
import soundfile as sf

processor = AutoProcessor.from_pretrained("facebook/wav2vec2-large-960h-lv60")
model = FlaxWav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-960h-lv60")


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)

input_values = processor(
    ds["speech"][0], sampling_rate=16_000, return_tensors="np"
).input_values  # Batch size 1
logits = model(input_values).logits
predicted_ids = jnp.argmax(logits, axis=-1)

transcription = processor.decode(predicted_ids[0])
# should give:  "A MAN SAID TO THE UNIVERSE SIR I EXIST"`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax.numpy <span class="hljs-keyword">as</span> jnp
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, FlaxWav2Vec2ForCTC
<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>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-960h-lv60&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxWav2Vec2ForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-960h-lv60&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>input_values = processor(
<span class="hljs-meta">... </span>    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;np&quot;</span>
<span class="hljs-meta">... </span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(input_values).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_ids = jnp.argmax(logits, axis=-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>transcription = processor.decode(predicted_ids[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># should give:  &quot;A MAN SAID TO THE UNIVERSE SIR I EXIST&quot;</span>`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function bx(W){let m,b,f,u,v;return{c(){m=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),u=a("Module"),v=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(h,"CODE",{});var V=i(f);u=s(V,"Module"),V.forEach(t),v=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(l,h){_(l,m,h),e(m,b),e(m,f),e(f,u),e(m,v)},d(l){l&&t(m)}}}function wx(W){let m,b,f,u,v;return u=new Me({props:{code:`import optax
import numpy as np
import jax.numpy as jnp
from transformers import AutoFeatureExtractor, FlaxWav2Vec2ForPreTraining
from transformers.models.wav2vec2.modeling_flax_wav2vec2 import _compute_mask_indices
from datasets import load_dataset
import soundfile as sf

feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-large-lv60")
model = FlaxWav2Vec2ForPreTraining.from_pretrained("facebook/wav2vec2-large-lv60")


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)

input_values = feature_extractor(ds["speech"][0], return_tensors="np").input_values  # Batch size 1

# compute masked indices
batch_size, raw_sequence_length = input_values.shape
sequence_length = model._get_feat_extract_output_lengths(raw_sequence_length)
mask_time_indices = _compute_mask_indices((batch_size, sequence_length), mask_prob=0.2, mask_length=2)

outputs = model(input_values, mask_time_indices=mask_time_indices)

# compute cosine similarity between predicted (=projected_states) and target (=projected_quantized_states)
cosine_sim = optax.cosine_similarity(outputs.projected_states, outputs.projected_quantized_states)

# show that cosine similarity is much higher than random
assert np.asarray(cosine_sim)[mask_time_indices].mean() > 0.5`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> optax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax.numpy <span class="hljs-keyword">as</span> jnp
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, FlaxWav2Vec2ForPreTraining
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.models.wav2vec2.modeling_flax_wav2vec2 <span class="hljs-keyword">import</span> _compute_mask_indices
<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>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-lv60&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxWav2Vec2ForPreTraining.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-large-lv60&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>input_values = feature_extractor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;np&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute masked indices</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size, raw_sequence_length = input_values.shape
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_length = model._get_feat_extract_output_lengths(raw_sequence_length)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_time_indices = _compute_mask_indices((batch_size, sequence_length), mask_prob=<span class="hljs-number">0.2</span>, mask_length=<span class="hljs-number">2</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_values, mask_time_indices=mask_time_indices)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute cosine similarity between predicted (=projected_states) and target (=projected_quantized_states)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>cosine_sim = optax.cosine_similarity(outputs.projected_states, outputs.projected_quantized_states)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># show that cosine similarity is much higher than random</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> np.asarray(cosine_sim)[mask_time_indices].mean() &gt; <span class="hljs-number">0.5</span>`}}),{c(){m=n("p"),b=a("Example:"),f=d(),w(u.$$.fragment)},l(l){m=r(l,"P",{});var h=i(m);b=s(h,"Example:"),h.forEach(t),f=p(l),y(u.$$.fragment,l)},m(l,h){_(l,m,h),e(m,b),_(l,f,h),k(u,l,h),v=!0},p:Ge,i(l){v||(T(u.$$.fragment,l),v=!0)},o(l){x(u.$$.fragment,l),v=!1},d(l){l&&t(m),l&&t(f),$(u,l)}}}function yx(W){let m,b,f,u,v,l,h,V,M,L,A,z,N,E,O,C,ce,K,S,de,I,R,Le,X,J,Oe,$e,Z,Ke,xt,De,D,Q,tt,ae,Je,$t,je,We,jt,U,Wt,Ve,ot,we,Fe,Ee,Vt,he,at,Y,ye,Ce,B,Ft,ee,Et,st,j,P,It,ue,Nt,Se,q,Yt,Ze,eo,to,oo,H,pe,ao,so,se,no,ro,Pe,io,Qe,Bt,ws,np,Ie,ys,bh,ks,wh,yh,kh,Ts,Th,xs,xh,$h,jh,$s,Wh,js,Vh,Fh,Eh,Ws,Ch,Vs,Ph,qh,Ah,Rt,Ei,zh,Mh,Fs,Lh,Oh,Es,Dh,Sh,rp,Ci,Ih,ip,Pi,Cs,Nh,Ps,Bh,Rh,lp,lo,Xo,Hl,qs,Uh,Xl,Hh,cp,Ye,As,Xh,co,Gh,qi,Kh,Jh,zs,Zh,Qh,Yh,po,eu,Ai,tu,ou,zi,au,su,nu,Go,dp,mo,Ko,Gl,Ms,ru,Kl,iu,pp,ne,Ls,lu,Jl,cu,du,Os,pu,Mi,mu,hu,uu,Jo,Ds,fu,Zl,gu,_u,Li,Ss,vu,nt,Is,bu,Ql,wu,yu,Ns,ku,Yl,Tu,xu,$u,Zo,ju,Qo,Bs,Wu,ec,Vu,mp,ho,Yo,tc,Rs,Fu,oc,Eu,hp,et,Us,Cu,ac,Pu,qu,Hs,Au,Oi,zu,Mu,Lu,ea,Xs,Ou,sc,Du,up,uo,ta,nc,Gs,Su,rc,Iu,fp,G,Ks,Nu,ic,Bu,Ru,Ne,Di,Uu,Hu,Si,Xu,Gu,Ii,Ku,Ju,Js,lc,Zu,Qu,Yu,Ni,ef,tf,of,oa,Zs,af,Ct,sf,Qs,cc,nf,rf,lf,dc,cf,df,Ys,pc,pf,mf,hf,uf,aa,en,ff,Pt,gf,Bi,_f,vf,mc,bf,wf,Ri,yf,kf,Tf,Ui,tn,xf,Ut,on,$f,an,jf,Hi,Wf,Vf,Ff,sa,Ef,na,sn,Cf,nn,Pf,Xi,qf,Af,zf,ra,rn,Mf,ln,Lf,Gi,Of,Df,gp,fo,ia,hc,cn,Sf,uc,If,_p,te,dn,Nf,fc,Bf,Rf,la,pn,Uf,qt,Hf,mn,gc,Xf,Gf,Kf,_c,Jf,Zf,hn,vc,Qf,Yf,eg,tg,ca,un,og,At,ag,Ki,sg,ng,bc,rg,ig,Ji,lg,cg,dg,Ht,fn,pg,gn,mg,Zi,hg,ug,fg,da,gg,Qi,_n,_g,rt,vn,vg,wc,bg,wg,pa,yg,bn,kg,Yi,Tg,xg,$g,Xt,wn,jg,yc,Wg,Vg,ma,vp,go,ha,kc,yn,Fg,Tc,Eg,bp,ke,Cg,el,Pg,qg,xc,Ag,zg,tl,Mg,Lg,ol,Og,Dg,$c,Sg,Ig,wp,kn,yp,_o,ua,jc,Tn,Ng,Wc,Bg,kp,vo,xn,Rg,$n,Ug,Vc,Hg,Xg,Tp,bo,jn,Gg,Fc,Kg,xp,wo,Wn,Jg,Vn,Zg,al,Qg,Yg,$p,zt,Fn,e_,En,t_,Ec,o_,a_,s_,fa,Cn,n_,Cc,r_,jp,Mt,Pn,i_,qn,l_,Pc,c_,d_,p_,ga,An,m_,qc,h_,Wp,yo,_a,Ac,zn,u_,zc,f_,Vp,qe,Mn,g_,Ln,__,On,v_,b_,w_,Dn,y_,sl,k_,T_,x_,Sn,$_,In,j_,W_,V_,it,Nn,F_,ko,E_,nl,C_,P_,Mc,q_,A_,z_,va,M_,ba,Fp,To,wa,Lc,Bn,L_,Oc,O_,Ep,Ae,Rn,D_,xo,S_,Dc,I_,N_,Un,B_,R_,U_,Hn,H_,rl,X_,G_,K_,Xn,J_,Gn,Z_,Q_,Y_,lt,Kn,ev,$o,tv,il,ov,av,Sc,sv,nv,rv,ya,iv,ka,Cp,jo,Ta,Ic,Jn,lv,Nc,cv,Pp,fe,Zn,dv,Bc,pv,mv,Qn,hv,Yn,uv,fv,gv,er,_v,ll,vv,bv,wv,tr,yv,or,kv,Tv,xv,ct,ar,$v,Wo,jv,cl,Wv,Vv,Rc,Fv,Ev,Cv,xa,Pv,$a,qp,Vo,ja,Uc,sr,qv,Hc,Av,Ap,ge,nr,zv,Xc,Mv,Lv,rr,Ov,ir,Dv,Sv,Iv,lr,Nv,dl,Bv,Rv,Uv,cr,Hv,dr,Xv,Gv,Kv,dt,pr,Jv,Fo,Zv,pl,Qv,Yv,Gc,e2,t2,o2,Wa,a2,Va,zp,Eo,Fa,Kc,mr,s2,Jc,n2,Mp,_e,hr,r2,Zc,i2,l2,ur,c2,fr,d2,p2,m2,gr,h2,ml,u2,f2,g2,_r,_2,vr,v2,b2,w2,pt,br,y2,Co,k2,hl,T2,x2,Qc,$2,j2,W2,Ea,V2,Ca,Lp,Po,Pa,Yc,wr,F2,ed,E2,Op,ze,yr,C2,qo,P2,td,q2,A2,kr,z2,M2,L2,Tr,O2,ul,D2,S2,I2,xr,N2,$r,B2,R2,U2,mt,jr,H2,Ao,X2,fl,G2,K2,od,J2,Z2,Q2,qa,Y2,Aa,Dp,zo,za,ad,Wr,eb,sd,tb,Sp,ve,Vr,ob,nd,ab,sb,Fr,nb,gl,rb,ib,lb,Er,cb,Cr,db,pb,mb,Ma,hb,ht,Pr,ub,Mo,fb,_l,gb,_b,rd,vb,bb,wb,La,yb,Oa,Ip,Lo,Da,id,qr,kb,ld,Tb,Np,be,Ar,xb,zr,$b,cd,jb,Wb,Vb,Mr,Fb,vl,Eb,Cb,Pb,Lr,qb,Or,Ab,zb,Mb,Sa,Lb,ut,Dr,Ob,Oo,Db,bl,Sb,Ib,dd,Nb,Bb,Rb,Ia,Ub,Na,Bp,Do,Ba,pd,Sr,Hb,md,Xb,Rp,re,Ir,Gb,Nr,Kb,Br,Jb,Zb,Qb,Rr,Yb,wl,ew,tw,ow,Ur,aw,Hr,sw,nw,rw,hd,iw,lw,Lt,ud,Xr,cw,dw,fd,Gr,pw,mw,gd,Kr,hw,uw,_d,Jr,fw,gw,ft,Zr,_w,So,vw,vd,bw,ww,bd,yw,kw,Tw,Ra,xw,Ua,Up,Io,Ha,wd,Qr,$w,yd,jw,Hp,ie,Yr,Ww,No,Vw,kd,Fw,Ew,ei,Cw,Pw,qw,ti,Aw,yl,zw,Mw,Lw,oi,Ow,ai,Dw,Sw,Iw,Td,Nw,Bw,Ot,xd,si,Rw,Uw,$d,ni,Hw,Xw,jd,ri,Gw,Kw,Wd,ii,Jw,Zw,gt,li,Qw,Bo,Yw,Vd,ey,ty,Fd,oy,ay,sy,Xa,ny,Ga,Xp,Ro,Ka,Ed,ci,ry,Cd,iy,Gp,le,di,ly,Uo,cy,Pd,dy,py,pi,my,hy,uy,mi,fy,kl,gy,_y,vy,hi,by,ui,wy,yy,ky,qd,Ty,xy,Dt,Ad,fi,$y,jy,zd,gi,Wy,Vy,Md,_i,Fy,Ey,Ld,vi,Cy,Py,_t,bi,qy,Ho,Ay,Tl,zy,My,Od,Ly,Oy,Dy,Ja,Sy,Za,Kp;return l=new oe({}),E=new oe({}),B=new oe({}),ue=new DT({props:{pipeline:"audio-classification"}}),ws=new DT({props:{pipeline:"automatic-speech-recognition"}}),qs=new oe({}),As=new F({props:{name:"class transformers.Wav2Vec2Config",anchor:"transformers.Wav2Vec2Config",parameters:[{name:"vocab_size",val:" = 32"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout",val:" = 0.1"},{name:"activation_dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.1"},{name:"feat_proj_dropout",val:" = 0.0"},{name:"feat_quantizer_dropout",val:" = 0.0"},{name:"final_dropout",val:" = 0.1"},{name:"layerdrop",val:" = 0.1"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"feat_extract_norm",val:" = 'group'"},{name:"feat_extract_activation",val:" = 'gelu'"},{name:"conv_dim",val:" = (512, 512, 512, 512, 512, 512, 512)"},{name:"conv_stride",val:" = (5, 2, 2, 2, 2, 2, 2)"},{name:"conv_kernel",val:" = (10, 3, 3, 3, 3, 2, 2)"},{name:"conv_bias",val:" = False"},{name:"num_conv_pos_embeddings",val:" = 128"},{name:"num_conv_pos_embedding_groups",val:" = 16"},{name:"do_stable_layer_norm",val:" = False"},{name:"apply_spec_augment",val:" = True"},{name:"mask_time_prob",val:" = 0.05"},{name:"mask_time_length",val:" = 10"},{name:"mask_time_min_masks",val:" = 2"},{name:"mask_feature_prob",val:" = 0.0"},{name:"mask_feature_length",val:" = 10"},{name:"mask_feature_min_masks",val:" = 0"},{name:"num_codevectors_per_group",val:" = 320"},{name:"num_codevector_groups",val:" = 2"},{name:"contrastive_logits_temperature",val:" = 0.1"},{name:"num_negatives",val:" = 100"},{name:"codevector_dim",val:" = 256"},{name:"proj_codevector_dim",val:" = 256"},{name:"diversity_loss_weight",val:" = 0.1"},{name:"ctc_loss_reduction",val:" = 'sum'"},{name:"ctc_zero_infinity",val:" = False"},{name:"use_weighted_layer_sum",val:" = False"},{name:"classifier_proj_size",val:" = 256"},{name:"tdnn_dim",val:" = (512, 512, 512, 512, 1500)"},{name:"tdnn_kernel",val:" = (5, 3, 3, 1, 1)"},{name:"tdnn_dilation",val:" = (1, 2, 3, 1, 1)"},{name:"xvector_output_dim",val:" = 512"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"add_adapter",val:" = False"},{name:"adapter_kernel_size",val:" = 3"},{name:"adapter_stride",val:" = 2"},{name:"num_adapter_layers",val:" = 3"},{name:"output_hidden_size",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Vocabulary size of the Wav2Vec2 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/wav2vec2#transformers.Wav2Vec2Model">Wav2Vec2Model</a> or <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.TFWav2Vec2Model">TFWav2Vec2Model</a>. Vocabulary size of the
model. Defines the different tokens that can be represented by the <em>inputs_ids</em> passed to the forward
method of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Model">Wav2Vec2Model</a>.`,name:"vocab_size"},{anchor:"transformers.Wav2Vec2Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Wav2Vec2Config.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Wav2Vec2Config.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Wav2Vec2Config.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.Wav2Vec2Config.hidden_act",description:`<strong>hidden_act</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 encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.Wav2Vec2Config.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout"},{anchor:"transformers.Wav2Vec2Config.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Wav2Vec2Config.final_dropout",description:`<strong>final_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for the final projection layer of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC">Wav2Vec2ForCTC</a>.`,name:"final_dropout"},{anchor:"transformers.Wav2Vec2Config.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Wav2Vec2Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Wav2Vec2Config.feat_extract_norm",description:`<strong>feat_extract_norm</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;group&quot;</code>) &#x2014;
The norm to be applied to 1D convolutional layers in feature encoder. One of <code>&quot;group&quot;</code> for group
normalization of only the first 1D convolutional layer or <code>&quot;layer&quot;</code> for layer normalization of all 1D
convolutional layers.`,name:"feat_extract_norm"},{anchor:"transformers.Wav2Vec2Config.feat_proj_dropout",description:`<strong>feat_proj_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for output of the feature encoder.`,name:"feat_proj_dropout"},{anchor:"transformers.Wav2Vec2Config.feat_extract_activation",description:"<strong>feat_extract_activation</strong> (<code>str, </code>optional<code>, defaults to </code>&#x201C;gelu&#x201D;<code>) -- The non-linear activation function (function or string) in the 1D convolutional layers of the feature extractor. If string, </code>&#x201C;gelu&#x201D;<code>, </code>&#x201C;relu&#x201D;<code>, </code>&#x201C;selu&#x201D;<code>and</code>&#x201C;gelu_new&#x201D;` are supported.",name:"feat_extract_activation"},{anchor:"transformers.Wav2Vec2Config.feat_quantizer_dropout",description:`<strong>feat_quantizer_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for quantized feature encoder states.`,name:"feat_quantizer_dropout"},{anchor:"transformers.Wav2Vec2Config.conv_dim",description:`<strong>conv_dim</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(512, 512, 512, 512, 512, 512, 512)</code>) &#x2014;
A tuple of integers defining the number of input and output channels of each 1D convolutional layer in the
feature encoder. The length of <em>conv_dim</em> defines the number of 1D convolutional layers.`,name:"conv_dim"},{anchor:"transformers.Wav2Vec2Config.conv_stride",description:`<strong>conv_stride</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(5, 2, 2, 2, 2, 2, 2)</code>) &#x2014;
A tuple of integers defining the stride of each 1D convolutional layer in the feature encoder. The length
of <em>conv_stride</em> defines the number of convolutional layers and has to match the length of <em>conv_dim</em>.`,name:"conv_stride"},{anchor:"transformers.Wav2Vec2Config.conv_kernel",description:`<strong>conv_kernel</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(10, 3, 3, 3, 3, 3, 3)</code>) &#x2014;
A tuple of integers defining the kernel size of each 1D convolutional layer in the feature encoder. The
length of <em>conv_kernel</em> defines the number of convolutional layers and has to match the length of
<em>conv_dim</em>.`,name:"conv_kernel"},{anchor:"transformers.Wav2Vec2Config.conv_bias",description:`<strong>conv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the 1D convolutional layers have a bias.`,name:"conv_bias"},{anchor:"transformers.Wav2Vec2Config.num_conv_pos_embeddings",description:`<strong>num_conv_pos_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of convolutional positional embeddings. Defines the kernel size of 1D convolutional positional
embeddings layer.`,name:"num_conv_pos_embeddings"},{anchor:"transformers.Wav2Vec2Config.num_conv_pos_embedding_groups",description:`<strong>num_conv_pos_embedding_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of groups of 1D convolutional positional embeddings layer.`,name:"num_conv_pos_embedding_groups"},{anchor:"transformers.Wav2Vec2Config.do_stable_layer_norm",description:`<strong>do_stable_layer_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to apply <em>stable</em> layer norm architecture of the Transformer encoder. <code>do_stable_layer_norm is True</code> corresponds to applying layer norm before the attention layer, whereas <code>do_stable_layer_norm is False</code> corresponds to applying layer norm after the attention layer.`,name:"do_stable_layer_norm"},{anchor:"transformers.Wav2Vec2Config.apply_spec_augment",description:`<strong>apply_spec_augment</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply <em>SpecAugment</em> data augmentation to the outputs of the feature encoder. For reference see
<a href="https://arxiv.org/abs/1904.08779" rel="nofollow">SpecAugment: A Simple Data Augmentation Method for Automatic Speech
Recognition</a>.`,name:"apply_spec_augment"},{anchor:"transformers.Wav2Vec2Config.mask_time_prob",description:`<strong>mask_time_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.05) &#x2014;
Percentage (between 0 and 1) of all feature vectors along the time axis which will be masked. The masking
procecure generates &#x201D;mask_time_prob<em>len(time_axis)/mask_time_length&#x201D; independent masks over the axis. If
reasoning from the propability of each feature vector to be chosen as the start of the vector span to be
masked, </em>mask_time_prob<em> should be \`prob_vector_start</em>mask_time_length<code>. Note that overlap may decrease the actual percentage of masked vectors. This is only relevant if </code>apply_spec_augment is True\`.`,name:"mask_time_prob"},{anchor:"transformers.Wav2Vec2Config.mask_time_length",description:`<strong>mask_time_length</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Length of vector span along the time axis.`,name:"mask_time_length"},{anchor:"transformers.Wav2Vec2Config.mask_time_min_masks",description:`<strong>mask_time_min_masks</strong> (<code>int</code>, <em>optional</em>, defaults to 2), &#x2014;
The minimum number of masks of length <code>mask_feature_length</code> generated along the time axis, each time step,
irrespectively of <code>mask_feature_prob</code>. Only relevant if &#x201D;mask_time_prob*len(time_axis)/mask_time_length &lt;
mask_time_min_masks&#x201D;`,name:"mask_time_min_masks"},{anchor:"transformers.Wav2Vec2Config.mask_feature_prob",description:`<strong>mask_feature_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Percentage (between 0 and 1) of all feature vectors along the feature axis which will be masked. The
masking procecure generates &#x201D;mask_feature_prob<em>len(feature_axis)/mask_time_length&#x201D; independent masks over
the axis. If reasoning from the propability of each feature vector to be chosen as the start of the vector
span to be masked, </em>mask_feature_prob<em> should be \`prob_vector_start</em>mask_feature_length<code>. Note that overlap may decrease the actual percentage of masked vectors. This is only relevant if </code>apply_spec_augment is
True\`.`,name:"mask_feature_prob"},{anchor:"transformers.Wav2Vec2Config.mask_feature_length",description:`<strong>mask_feature_length</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Length of vector span along the feature axis.`,name:"mask_feature_length"},{anchor:"transformers.Wav2Vec2Config.mask_feature_min_masks",description:`<strong>mask_feature_min_masks</strong> (<code>int</code>, <em>optional</em>, defaults to 0), &#x2014;
The minimum number of masks of length <code>mask_feature_length</code> generated along the feature axis, each time
step, irrespectively of <code>mask_feature_prob</code>. Only relevant if
&#x201D;mask_feature_prob*len(feature_axis)/mask_feature_length &lt; mask_feature_min_masks&#x201D;`,name:"mask_feature_min_masks"},{anchor:"transformers.Wav2Vec2Config.num_codevectors_per_group",description:`<strong>num_codevectors_per_group</strong> (<code>int</code>, <em>optional</em>, defaults to 320) &#x2014;
Number of entries in each quantization codebook (group).`,name:"num_codevectors_per_group"},{anchor:"transformers.Wav2Vec2Config.num_codevector_groups",description:`<strong>num_codevector_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Number of codevector groups for product codevector quantization.`,name:"num_codevector_groups"},{anchor:"transformers.Wav2Vec2Config.contrastive_logits_temperature",description:`<strong>contrastive_logits_temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The temperature <em>kappa</em> in the contrastive loss.`,name:"contrastive_logits_temperature"},{anchor:"transformers.Wav2Vec2Config.feat_quantizer_dropout",description:`<strong>feat_quantizer_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probabilitiy for the output of the feature encoder that&#x2019;s used by the quantizer.`,name:"feat_quantizer_dropout"},{anchor:"transformers.Wav2Vec2Config.num_negatives",description:`<strong>num_negatives</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
Number of negative samples for the contrastive loss.`,name:"num_negatives"},{anchor:"transformers.Wav2Vec2Config.codevector_dim",description:`<strong>codevector_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimensionality of the quantized feature vectors.`,name:"codevector_dim"},{anchor:"transformers.Wav2Vec2Config.proj_codevector_dim",description:`<strong>proj_codevector_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimensionality of the final projection of both the quantized and the transformer features.`,name:"proj_codevector_dim"},{anchor:"transformers.Wav2Vec2Config.diversity_loss_weight",description:`<strong>diversity_loss_weight</strong> (<code>int</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The weight of the codebook diversity loss component.`,name:"diversity_loss_weight"},{anchor:"transformers.Wav2Vec2Config.ctc_loss_reduction",description:`<strong>ctc_loss_reduction</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;sum&quot;</code>) &#x2014;
Specifies the reduction to apply to the output of <code>torch.nn.CTCLoss</code>. Only relevant when training an
instance of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC">Wav2Vec2ForCTC</a>.`,name:"ctc_loss_reduction"},{anchor:"transformers.Wav2Vec2Config.ctc_zero_infinity",description:`<strong>ctc_zero_infinity</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to zero infinite losses and the associated gradients of <code>torch.nn.CTCLoss</code>. Infinite losses mainly
occur when the inputs are too short to be aligned to the targets. Only relevant when training an instance
of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC">Wav2Vec2ForCTC</a>.`,name:"ctc_zero_infinity"},{anchor:"transformers.Wav2Vec2Config.use_weighted_layer_sum",description:`<strong>use_weighted_layer_sum</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a weighted average of layer outputs with learned weights. Only relevant when using an
instance of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForSequenceClassification">Wav2Vec2ForSequenceClassification</a>.`,name:"use_weighted_layer_sum"},{anchor:"transformers.Wav2Vec2Config.classifier_proj_size",description:`<strong>classifier_proj_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimensionality of the projection before token mean-pooling for classification.`,name:"classifier_proj_size"},{anchor:"transformers.Wav2Vec2Config.tdnn_dim",description:`<strong>tdnn_dim</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(512, 512, 512, 512, 1500)</code>) &#x2014;
A tuple of integers defining the number of output channels of each 1D convolutional layer in the <em>TDNN</em>
module of the <em>XVector</em> model. The length of <em>tdnn_dim</em> defines the number of <em>TDNN</em> layers.`,name:"tdnn_dim"},{anchor:"transformers.Wav2Vec2Config.tdnn_kernel",description:`<strong>tdnn_kernel</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(5, 3, 3, 1, 1)</code>) &#x2014;
A tuple of integers defining the kernel size of each 1D convolutional layer in the <em>TDNN</em> module of the
<em>XVector</em> model. The length of <em>tdnn_kernel</em> has to match the length of <em>tdnn_dim</em>.`,name:"tdnn_kernel"},{anchor:"transformers.Wav2Vec2Config.tdnn_dilation",description:`<strong>tdnn_dilation</strong> (<code>Tuple[int]</code> or <code>List[int]</code>, <em>optional</em>, defaults to <code>(1, 2, 3, 1, 1)</code>) &#x2014;
A tuple of integers defining the dilation factor of each 1D convolutional layer in <em>TDNN</em> module of the
<em>XVector</em> model. The length of <em>tdnn_dilation</em> has to match the length of <em>tdnn_dim</em>.`,name:"tdnn_dilation"},{anchor:"transformers.Wav2Vec2Config.xvector_output_dim",description:`<strong>xvector_output_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the <em>XVector</em> embedding vectors.`,name:"xvector_output_dim"},{anchor:"transformers.Wav2Vec2Config.add_adapter",description:`<strong>add_adapter</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether a convolutional network should be stacked on top of the Wav2Vec2 Encoder. Can be very useful for
warm-starting Wav2Vec2 for SpeechEncoderDecoder models.`,name:"add_adapter"},{anchor:"transformers.Wav2Vec2Config.adapter_kernel_size",description:`<strong>adapter_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Kernel size of the convolutional layers in the adapter network. Only relevant if <code>add_adapter is True</code>.`,name:"adapter_kernel_size"},{anchor:"transformers.Wav2Vec2Config.adapter_stride",description:`<strong>adapter_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Stride of the convolutional layers in the adapter network. Only relevant if <code>add_adapter is True</code>.`,name:"adapter_stride"},{anchor:"transformers.Wav2Vec2Config.num_adapter_layers",description:`<strong>num_adapter_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Number of convolutional layers that should be used in the adapter network. Only relevant if <code>add_adapter is True</code>.`,name:"num_adapter_layers"},{anchor:"transformers.Wav2Vec2Config.output_hidden_size",description:`<strong>output_hidden_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Dimensionality of the encoder output layer. If not defined, this defaults to <em>hidden-size</em>. Only relevant
if <code>add_adapter is True</code>.`,name:"output_hidden_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/configuration_wav2vec2.py#L32"}}),Go=new Xe({props:{anchor:"transformers.Wav2Vec2Config.example",$$slots:{default:[UT]},$$scope:{ctx:W}}}),Ms=new oe({}),Ls=new F({props:{name:"class transformers.Wav2Vec2CTCTokenizer",anchor:"transformers.Wav2Vec2CTCTokenizer",parameters:[{name:"vocab_file",val:""},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"word_delimiter_token",val:" = '|'"},{name:"replace_word_delimiter_char",val:" = ' '"},{name:"do_lower_case",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2CTCTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.`,name:"pad_token"},{anchor:"transformers.Wav2Vec2CTCTokenizer.word_delimiter_token",description:`<strong>word_delimiter_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;|&quot;</code>) &#x2014;
The token used for defining the end of a word.`,name:"word_delimiter_token"},{anchor:"transformers.Wav2Vec2CTCTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to accept lowercase input and lowercase the output when decoding.</p>
<p>**kwargs &#x2014;
Additional keyword arguments passed along to <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>`,name:"do_lower_case"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/tokenization_wav2vec2.py#L127"}}),Ds=new F({props:{name:"__call__",anchor:"transformers.Wav2Vec2CTCTokenizer.__call__",parameters:[{name:"text",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]] = None"},{name:"text_pair",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"text_target",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]]] = None"},{name:"text_pair_target",val:": typing.Union[str, typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.tokenization_utils_base.TruncationStrategy] = None"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"stride",val:": int = 0"},{name:"is_split_into_words",val:": bool = False"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.text",description:`<strong>text</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
<code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.text_pair",description:`<strong>text_pair</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
<code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text_pair"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.text_target",description:`<strong>text_target</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The sequence or batch of sequences to be encoded as target texts. Each sequence can be a string or a
list of strings (pretokenized string). If the sequences are provided as list of strings (pretokenized),
you must set <code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text_target"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.text_pair_target",description:`<strong>text_pair_target</strong> (<code>str</code>, <code>List[str]</code>, <code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The sequence or batch of sequences to be encoded as target texts. Each sequence can be a string or a
list of strings (pretokenized string). If the sequences are provided as list of strings (pretokenized),
you must set <code>is_split_into_words=True</code> (to lift the ambiguity with a batch of sequences).`,name:"text_pair_target"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.tokenization_utils_base.TruncationStrategy">TruncationStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or
to the maximum acceptable input length for the model if that argument is not provided. This will
truncate token by token, removing a token from the longest sequence in the pair if a pair of
sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_first&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>&apos;only_second&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code> or to the
maximum acceptable input length for the model if that argument is not provided. This will only
truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If set to a number along with <code>max_length</code>, the overflowing tokens returned when
<code>return_overflowing_tokens=True</code> will contain some tokens from the end of the truncated sequence
returned to provide some overlap between truncated and overflowing sequences. The value of this
argument defines the number of overlapping tokens.`,name:"stride"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.is_split_into_words",description:`<strong>is_split_into_words</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the input is already pre-tokenized (e.g., split into words). If set to <code>True</code>, the
tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace)
which it will tokenize. This is useful for NER or token classification.`,name:"is_split_into_words"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return token type IDs. If left to the default, will return the token type IDs according to
the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"return_token_type_ids"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific tokenizer&#x2019;s default, defined by the <code>return_outputs</code> attribute.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_overflowing_tokens",description:`<strong>return_overflowing_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
of pairs) is provided with <code>truncation_strategy = longest_first</code> or <code>True</code>, an error is raised instead
of returning overflowing tokens.`,name:"return_overflowing_tokens"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_special_tokens_mask",description:`<strong>return_special_tokens_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return special tokens mask information.`,name:"return_special_tokens_mask"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_offsets_mapping",description:`<strong>return_offsets_mapping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return <code>(char_start, char_end)</code> for each token.</p>
<p>This is only available on fast tokenizers inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>, if using
Python&#x2019;s tokenizer, this method will raise <code>NotImplementedError</code>.`,name:"return_offsets_mapping"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.return_length",description:`<strong>return_length</strong>  (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the lengths of the encoded inputs.`,name:"return_length"},{anchor:"transformers.Wav2Vec2CTCTokenizer.__call__.verbose",description:`<strong>verbose</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to print more information and warnings.
**kwargs &#x2014; passed to the <code>self.tokenize()</code> method`,name:"verbose"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L2453",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a> with the following fields:</p>
<ul>
<li>
<p><strong>input_ids</strong> \u2014 List of token ids to be fed to a model.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a></p>
</li>
<li>
<p><strong>token_type_ids</strong> \u2014 List of token type ids to be fed to a model (when <code>return_token_type_ids=True</code> or
if <em>\u201Ctoken_type_ids\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a></p>
</li>
<li>
<p><strong>attention_mask</strong> \u2014 List of indices specifying which tokens should be attended to by the model (when
<code>return_attention_mask=True</code> or if <em>\u201Cattention_mask\u201D</em> is in <code>self.model_input_names</code>).</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
</li>
<li>
<p><strong>overflowing_tokens</strong> \u2014 List of overflowing tokens sequences (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>num_truncated_tokens</strong> \u2014 Number of tokens truncated (when a <code>max_length</code> is specified and
<code>return_overflowing_tokens=True</code>).</p>
</li>
<li>
<p><strong>special_tokens_mask</strong> \u2014 List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
regular sequence tokens (when <code>add_special_tokens=True</code> and <code>return_special_tokens_mask=True</code>).</p>
</li>
<li>
<p><strong>length</strong> \u2014 The length of the inputs (when <code>return_length=True</code>)</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),Ss=new F({props:{name:"save_vocabulary",anchor:"transformers.Wav2Vec2CTCTokenizer.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/wav2vec2/tokenization_wav2vec2.py#L595"}}),Is=new F({props:{name:"decode",anchor:"transformers.Wav2Vec2CTCTokenizer.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:"output_char_offsets",val:": bool = False"},{name:"output_word_offsets",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.decode.output_char_offsets",description:`<strong>output_char_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output character offsets. Character offsets can be used in combination with the
sampling rate and model downsampling rate to compute the time-stamps of transcribed characters.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the example below to better understand how to make use of <code>output_char_offsets</code>.</p>

					</div>`,name:"output_char_offsets"},{anchor:"transformers.Wav2Vec2CTCTokenizer.decode.output_word_offsets",description:`<strong>output_word_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output word offsets. Word offsets can be used in combination with the sampling rate
and model downsampling rate to compute the time-stamps of transcribed words.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the example below to better understand how to make use of <code>output_word_offsets</code>.</p>

					</div>`,name:"output_word_offsets"},{anchor:"transformers.Wav2Vec2CTCTokenizer.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/models/wav2vec2/tokenization_wav2vec2.py#L490",returnDescription:`
<p>The list of decoded
sentences. Will be a <code>Wav2Vec2CTCTokenizerOutput</code> when
<code>output_char_offsets == True</code> or <code>output_word_offsets == True</code>.</p>
`,returnType:`
<p><code>str</code> or <code>Wav2Vec2CTCTokenizerOutput</code></p>
`}}),Zo=new Xe({props:{anchor:"transformers.Wav2Vec2CTCTokenizer.decode.example",$$slots:{default:[HT]},$$scope:{ctx:W}}}),Bs=new F({props:{name:"batch_decode",anchor:"transformers.Wav2Vec2CTCTokenizer.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:"output_char_offsets",val:": bool = False"},{name:"output_word_offsets",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.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.Wav2Vec2CTCTokenizer.batch_decode.output_char_offsets",description:`<strong>output_char_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output character offsets. Character offsets can be used in combination with the
sampling rate and model downsampling rate to compute the time-stamps of transcribed characters.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the Example of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.decode">decode()</a> to better understand how to make
use of <code>output_char_offsets</code>. <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.batch_decode">batch_decode()</a> works the same way with batched
output.</p>

					</div>`,name:"output_char_offsets"},{anchor:"transformers.Wav2Vec2CTCTokenizer.batch_decode.output_word_offsets",description:`<strong>output_word_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output word offsets. Word offsets can be used in combination with the sampling rate
and model downsampling rate to compute the time-stamps of transcribed words.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the Example of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.decode">decode()</a> to better understand how to make
use of <code>output_word_offsets</code>. <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.batch_decode">batch_decode()</a> works the same way with batched
output.</p>

					</div>`,name:"output_word_offsets"},{anchor:"transformers.Wav2Vec2CTCTokenizer.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/models/wav2vec2/tokenization_wav2vec2.py#L420",returnDescription:`
<p>The list of decoded
sentences. Will be a <code>Wav2Vec2CTCTokenizerOutput</code> when
<code>output_char_offsets == True</code> or <code>output_word_offsets == True</code>.</p>
`,returnType:`
<p><code>List[str]</code> or <code>Wav2Vec2CTCTokenizerOutput</code></p>
`}}),Rs=new oe({}),Us=new F({props:{name:"class transformers.Wav2Vec2FeatureExtractor",anchor:"transformers.Wav2Vec2FeatureExtractor",parameters:[{name:"feature_size",val:" = 1"},{name:"sampling_rate",val:" = 16000"},{name:"padding_value",val:" = 0.0"},{name:"return_attention_mask",val:" = False"},{name:"do_normalize",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2FeatureExtractor.feature_size",description:`<strong>feature_size</strong> (<code>int</code>, defaults to 1) &#x2014;
The feature dimension of the extracted features.`,name:"feature_size"},{anchor:"transformers.Wav2Vec2FeatureExtractor.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, defaults to 16000) &#x2014;
The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.Wav2Vec2FeatureExtractor.padding_value",description:`<strong>padding_value</strong> (<code>float</code>, defaults to 0.0) &#x2014;
The value that is used to fill the padding values.`,name:"padding_value"},{anchor:"transformers.Wav2Vec2FeatureExtractor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly
improve the performance for some models, <em>e.g.</em>,
<a href="https://huggingface.co/models?search=lv60" rel="nofollow">wav2vec2-lv60</a>.`,name:"do_normalize"},{anchor:"transformers.Wav2Vec2FeatureExtractor.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor.__call__"><strong>call</strong>()</a> should return <code>attention_mask</code>.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Wav2Vec2 models that have set <code>config.feat_extract_norm == &quot;group&quot;</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, have <strong>not</strong> been trained using
<code>attention_mask</code>. For such models, <code>input_values</code> should simply be padded with 0 and no <code>attention_mask</code>
should be passed.</p>
<p>For Wav2Vec2 models that have set <code>config.feat_extract_norm == &quot;layer&quot;</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self" rel="nofollow">wav2vec2-lv60</a>, <code>attention_mask</code> should be
passed for batched inference.</p>

					</div>`,name:"return_attention_mask"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/feature_extraction_wav2vec2.py#L31"}}),Xs=new F({props:{name:"__call__",anchor:"transformers.Wav2Vec2FeatureExtractor.__call__",parameters:[{name:"raw_speech",val:": typing.Union[numpy.ndarray, typing.List[float], typing.List[numpy.ndarray], typing.List[typing.List[float]]]"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"truncation",val:": bool = False"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"sampling_rate",val:": typing.Optional[int] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.raw_speech",description:`<strong>raw_speech</strong> (<code>np.ndarray</code>, <code>List[float]</code>, <code>List[np.ndarray]</code>, <code>List[List[float]]</code>) &#x2014;
The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float
values, a list of numpy arrays or a list of list of float values.`,name:"raw_speech"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Select a strategy to pad the returned sequences (according to the model&#x2019;s padding side and padding
index) among:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum length of the returned list and optionally padding length (see above).`,name:"max_length"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>) &#x2014;
Activates truncation to cut input sequences longer than <em>max_length</em> to <em>max_length</em>.`,name:"truncation"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value.</p>
<p>This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
<code>&gt;= 7.5</code> (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.`,name:"pad_to_multiple_of"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific feature_extractor&#x2019;s default.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Wav2Vec2 models that have set <code>config.feat_extract_norm == &quot;group&quot;</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, have <strong>not</strong> been trained using
<code>attention_mask</code>. For such models, <code>input_values</code> should simply be padded with 0 and no
<code>attention_mask</code> should be passed.</p>
<p>For Wav2Vec2 models that have set <code>config.feat_extract_norm == &quot;layer&quot;</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self" rel="nofollow">wav2vec2-lv60</a>, <code>attention_mask</code> should
be passed for batched inference.</p>

					</div>`,name:"return_attention_mask"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The sampling rate at which the <code>raw_speech</code> input was sampled. It is strongly recommended to pass
<code>sampling_rate</code> at the forward call to prevent silent errors.`,name:"sampling_rate"},{anchor:"transformers.Wav2Vec2FeatureExtractor.__call__.padding_value",description:"<strong>padding_value</strong> (<code>float</code>, defaults to 0.0) &#x2014;",name:"padding_value"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/feature_extraction_wav2vec2.py#L102"}}),Gs=new oe({}),Ks=new F({props:{name:"class transformers.Wav2Vec2Processor",anchor:"transformers.Wav2Vec2Processor",parameters:[{name:"feature_extractor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2Processor.feature_extractor",description:`<strong>feature_extractor</strong> (<code>Wav2Vec2FeatureExtractor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor">Wav2Vec2FeatureExtractor</a>. The feature extractor is a required input.`,name:"feature_extractor"},{anchor:"transformers.Wav2Vec2Processor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>) &#x2014;
An instance of <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L26"}}),Zs=new F({props:{name:"__call__",anchor:"transformers.Wav2Vec2Processor.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L67"}}),en=new F({props:{name:"pad",anchor:"transformers.Wav2Vec2Processor.pad",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L105"}}),tn=new F({props:{name:"from_pretrained",anchor:"transformers.Wav2Vec2Processor.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L48"}}),on=new F({props:{name:"save_pretrained",anchor:"transformers.Wav2Vec2Processor.save_pretrained",parameters:[{name:"save_directory",val:""},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2Processor.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.Wav2Vec2Processor.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"}}),sa=new xe({props:{$$slots:{default:[XT]},$$scope:{ctx:W}}}),sn=new F({props:{name:"batch_decode",anchor:"transformers.Wav2Vec2Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L135"}}),rn=new F({props:{name:"decode",anchor:"transformers.Wav2Vec2Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/processing_wav2vec2.py#L142"}}),cn=new oe({}),dn=new F({props:{name:"class transformers.Wav2Vec2ProcessorWithLM",anchor:"transformers.Wav2Vec2ProcessorWithLM",parameters:[{name:"feature_extractor",val:": FeatureExtractionMixin"},{name:"tokenizer",val:": PreTrainedTokenizerBase"},{name:"decoder",val:": BeamSearchDecoderCTC"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ProcessorWithLM.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor">Wav2Vec2FeatureExtractor</a>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor">Wav2Vec2FeatureExtractor</a>. The feature extractor is a required input.`,name:"feature_extractor"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer">Wav2Vec2CTCTokenizer</a>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer">Wav2Vec2CTCTokenizer</a>. The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decoder",description:`<strong>decoder</strong> (<code>pyctcdecode.BeamSearchDecoderCTC</code>) &#x2014;
An instance of <code>pyctcdecode.BeamSearchDecoderCTC</code>. The decoder is a required input.`,name:"decoder"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L67"}}),pn=new F({props:{name:"__call__",anchor:"transformers.Wav2Vec2ProcessorWithLM.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L214"}}),un=new F({props:{name:"pad",anchor:"transformers.Wav2Vec2ProcessorWithLM.pad",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L253"}}),fn=new F({props:{name:"from_pretrained",anchor:"transformers.Wav2Vec2ProcessorWithLM.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2ProcessorWithLM.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.SequenceFeatureExtractor">SequenceFeatureExtractor</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a></li>
</ul>`,name:"pretrained_model_name_or_path"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L112"}}),da=new xe({props:{$$slots:{default:[GT]},$$scope:{ctx:W}}}),_n=new F({props:{name:"save_pretrained",anchor:"transformers.Wav2Vec2ProcessorWithLM.save_pretrained",parameters:[{name:"save_directory",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L108"}}),vn=new F({props:{name:"batch_decode",anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode",parameters:[{name:"logits",val:": ndarray"},{name:"pool",val:": typing.Union[<bound method BaseContext.Pool of <multiprocessing.context.DefaultContext object at 0x7f9fbafeafa0>>, NoneType] = None"},{name:"num_processes",val:": typing.Optional[int] = None"},{name:"beam_width",val:": typing.Optional[int] = None"},{name:"beam_prune_logp",val:": typing.Optional[float] = None"},{name:"token_min_logp",val:": typing.Optional[float] = None"},{name:"hotwords",val:": typing.Optional[typing.Iterable[str]] = None"},{name:"hotword_weight",val:": typing.Optional[float] = None"},{name:"alpha",val:": typing.Optional[float] = None"},{name:"beta",val:": typing.Optional[float] = None"},{name:"unk_score_offset",val:": typing.Optional[float] = None"},{name:"lm_score_boundary",val:": typing.Optional[bool] = None"},{name:"output_word_offsets",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.logits",description:`<strong>logits</strong> (<code>np.ndarray</code>) &#x2014;
The logits output vector of the model representing the log probabilities for each token.`,name:"logits"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.pool",description:`<strong>pool</strong> (<code>multiprocessing.Pool</code>, <em>optional</em>) &#x2014;
An optional user-managed pool. If not set, one will be automatically created and closed. The pool
should be instantiated <em>after</em> <code>Wav2Vec2ProcessorWithLM</code>. Otherwise, the LM won&#x2019;t be available to the
pool&#x2019;s sub-processes.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Currently, only pools created with a &#x2018;fork&#x2019; context can be used. If a &#x2018;spawn&#x2019; pool is passed, it will
be ignored and sequential decoding will be used instead.</p>

					</div>`,name:"pool"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.num_processes",description:`<strong>num_processes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If <code>pool</code> is not set, number of processes on which the function should be parallelized over. Defaults
to the number of available CPUs.`,name:"num_processes"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.beam_width",description:`<strong>beam_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of beams at each step in decoding. Defaults to pyctcdecode&#x2019;s DEFAULT_BEAM_WIDTH.`,name:"beam_width"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.beam_prune_logp",description:`<strong>beam_prune_logp</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Beams that are much worse than best beam will be pruned Defaults to pyctcdecode&#x2019;s DEFAULT_PRUNE_LOGP.`,name:"beam_prune_logp"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.token_min_logp",description:`<strong>token_min_logp</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Tokens below this logp are skipped unless they are argmax of frame Defaults to pyctcdecode&#x2019;s
DEFAULT_MIN_TOKEN_LOGP.`,name:"token_min_logp"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.hotwords",description:`<strong>hotwords</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of words with extra importance, can be OOV for LM`,name:"hotwords"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.hotword_weight",description:`<strong>hotword_weight</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Weight factor for hotword importance Defaults to pyctcdecode&#x2019;s DEFAULT_HOTWORD_WEIGHT.`,name:"hotword_weight"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.alpha",description:`<strong>alpha</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Weight for language model during shallow fusion`,name:"alpha"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.beta",description:`<strong>beta</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Weight for length score adjustment of during scoring`,name:"beta"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.unk_score_offset",description:`<strong>unk_score_offset</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Amount of log score offset for unknown tokens`,name:"unk_score_offset"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.lm_score_boundary",description:`<strong>lm_score_boundary</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to have kenlm respect boundaries when scoring`,name:"lm_score_boundary"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.batch_decode.output_word_offsets",description:`<strong>output_word_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output word offsets. Word offsets can be used in combination with the sampling rate
and model downsampling rate to compute the time-stamps of transcribed words.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the Example of <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM.decode">decode()</a> to better understand how to
make use of <code>output_word_offsets</code>. <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM.batch_decode">batch_decode()</a> works the same way with
batched output.</p>

					</div>`,name:"output_word_offsets"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L284",returnDescription:`
<p><code>~models.wav2vec2.Wav2Vec2DecoderWithLMOutput</code>.</p>
`}}),pa=new xe({props:{$$slots:{default:[KT]},$$scope:{ctx:W}}}),wn=new F({props:{name:"decode",anchor:"transformers.Wav2Vec2ProcessorWithLM.decode",parameters:[{name:"logits",val:": ndarray"},{name:"beam_width",val:": typing.Optional[int] = None"},{name:"beam_prune_logp",val:": typing.Optional[float] = None"},{name:"token_min_logp",val:": typing.Optional[float] = None"},{name:"hotwords",val:": typing.Optional[typing.Iterable[str]] = None"},{name:"hotword_weight",val:": typing.Optional[float] = None"},{name:"alpha",val:": typing.Optional[float] = None"},{name:"beta",val:": typing.Optional[float] = None"},{name:"unk_score_offset",val:": typing.Optional[float] = None"},{name:"lm_score_boundary",val:": typing.Optional[bool] = None"},{name:"output_word_offsets",val:": bool = False"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.logits",description:`<strong>logits</strong> (<code>np.ndarray</code>) &#x2014;
The logits output vector of the model representing the log probabilities for each token.`,name:"logits"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.beam_width",description:`<strong>beam_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum number of beams at each step in decoding. Defaults to pyctcdecode&#x2019;s DEFAULT_BEAM_WIDTH.`,name:"beam_width"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.beam_prune_logp",description:`<strong>beam_prune_logp</strong> (<code>int</code>, <em>optional</em>) &#x2014;
A threshold to prune beams with log-probs less than best_beam_logp + beam_prune_logp. The value should
be &lt;= 0. Defaults to pyctcdecode&#x2019;s DEFAULT_PRUNE_LOGP.`,name:"beam_prune_logp"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.token_min_logp",description:`<strong>token_min_logp</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Tokens with log-probs below token_min_logp are skipped unless they are have the maximum log-prob for an
utterance. Defaults to pyctcdecode&#x2019;s DEFAULT_MIN_TOKEN_LOGP.`,name:"token_min_logp"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.hotwords",description:`<strong>hotwords</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
List of words with extra importance which can be missing from the LM&#x2019;s vocabulary, e.g. [&#x201C;huggingface&#x201D;]`,name:"hotwords"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.hotword_weight",description:`<strong>hotword_weight</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Weight multiplier that boosts hotword scores. Defaults to pyctcdecode&#x2019;s DEFAULT_HOTWORD_WEIGHT.`,name:"hotword_weight"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.alpha",description:`<strong>alpha</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Weight for language model during shallow fusion`,name:"alpha"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.beta",description:`<strong>beta</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Weight for length score adjustment of during scoring`,name:"beta"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.unk_score_offset",description:`<strong>unk_score_offset</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Amount of log score offset for unknown tokens`,name:"unk_score_offset"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.lm_score_boundary",description:`<strong>lm_score_boundary</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to have kenlm respect boundaries when scoring`,name:"lm_score_boundary"},{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.output_word_offsets",description:`<strong>output_word_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to output word offsets. Word offsets can be used in combination with the sampling rate
and model downsampling rate to compute the time-stamps of transcribed words.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Please take a look at the example below to better understand how to make use of <code>output_word_offsets</code>.</p>

					</div>`,name:"output_word_offsets"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L440",returnDescription:`
<p><code>~models.wav2vec2.Wav2Vec2DecoderWithLMOutput</code>.</p>
`}}),ma=new Xe({props:{anchor:"transformers.Wav2Vec2ProcessorWithLM.decode.example",$$slots:{default:[JT]},$$scope:{ctx:W}}}),yn=new oe({}),kn=new Me({props:{code:`# Let's see how to use a user-managed pool for batch decoding multiple audios
from multiprocessing import get_context
from transformers import AutoTokenizer, AutoProcessor, AutoModelForCTC
from datasets import load_dataset
import datasets
import torch

# import model, feature extractor, tokenizer
model = AutoModelForCTC.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm").to("cuda")
processor = AutoProcessor.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm")

# load example dataset
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
dataset = dataset.cast_column("audio", datasets.Audio(sampling_rate=16_000))


def map_to_array(batch):
    batch["speech"] = batch["audio"]["array"]
    return batch


# prepare speech data for batch inference
dataset = dataset.map(map_to_array, remove_columns=["audio"])


def map_to_pred(batch, pool):
    inputs = processor(batch["speech"], sampling_rate=16_000, padding=True, return_tensors="pt")
    inputs = {k: v.to("cuda") for k, v in inputs.items()}

    with torch.no_grad():
        logits = model(**inputs).logits

    transcription = processor.batch_decode(logits.cpu().numpy(), pool).text
    batch["transcription"] = transcription
    return batch


# note: pool should be instantiated *after* \`Wav2Vec2ProcessorWithLM\`.
#       otherwise, the LM won't be available to the pool's sub-processes
# select number of processes and batch_size based on number of CPU cores available and on dataset size
with get_context("fork").Pool(processes=2) as pool:
    result = dataset.map(
        map_to_pred, batched=True, batch_size=2, fn_kwargs={"pool": pool}, remove_columns=["speech"]
    )

result["transcription"][:2]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Let&#x27;s see how to use a user-managed pool for batch decoding multiple audios</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> multiprocessing <span class="hljs-keyword">import</span> get_context
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoProcessor, AutoModelForCTC
<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> datasets
<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"># import model, feature extractor, tokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCTC.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/wav2vec2-base-100h-with-lm&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/wav2vec2-base-100h-with-lm&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load example dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = 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>dataset = dataset.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, datasets.Audio(sampling_rate=<span class="hljs-number">16_000</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>    batch[<span class="hljs-string">&quot;speech&quot;</span>] = batch[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> batch


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare speech data for batch inference</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.<span class="hljs-built_in">map</span>(map_to_array, remove_columns=[<span class="hljs-string">&quot;audio&quot;</span>])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">map_to_pred</span>(<span class="hljs-params">batch, pool</span>):
<span class="hljs-meta">... </span>    inputs = processor(batch[<span class="hljs-string">&quot;speech&quot;</span>], sampling_rate=<span class="hljs-number">16_000</span>, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">... </span>    inputs = {k: v.to(<span class="hljs-string">&quot;cuda&quot;</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> inputs.items()}

<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>        logits = model(**inputs).logits

<span class="hljs-meta">... </span>    transcription = processor.batch_decode(logits.cpu().numpy(), pool).text
<span class="hljs-meta">... </span>    batch[<span class="hljs-string">&quot;transcription&quot;</span>] = transcription
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> batch


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># note: pool should be instantiated *after* \`Wav2Vec2ProcessorWithLM\`.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment">#       otherwise, the LM won&#x27;t be available to the pool&#x27;s sub-processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># select number of processes and batch_size based on number of CPU cores available and on dataset size</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> get_context(<span class="hljs-string">&quot;fork&quot;</span>).Pool(processes=<span class="hljs-number">2</span>) <span class="hljs-keyword">as</span> pool:
<span class="hljs-meta">... </span>    result = dataset.<span class="hljs-built_in">map</span>(
<span class="hljs-meta">... </span>        map_to_pred, batched=<span class="hljs-literal">True</span>, batch_size=<span class="hljs-number">2</span>, fn_kwargs={<span class="hljs-string">&quot;pool&quot;</span>: pool}, remove_columns=[<span class="hljs-string">&quot;speech&quot;</span>]
<span class="hljs-meta">... </span>    )

<span class="hljs-meta">&gt;&gt;&gt; </span>result[<span class="hljs-string">&quot;transcription&quot;</span>][:<span class="hljs-number">2</span>]
[<span class="hljs-string">&#x27;MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL&#x27;</span>, <span class="hljs-string">&quot;NOR IS MISTER COULTER&#x27;S MANNER LESS INTERESTING THAN HIS MATTER&quot;</span>]`}}),Tn=new oe({}),xn=new F({props:{name:"class transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput",anchor:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput",parameters:[{name:"text",val:": typing.Union[typing.List[str], str]"},{name:"logit_score",val:": typing.Union[typing.List[float], float] = None"},{name:"lm_score",val:": typing.Union[typing.List[float], float] = None"},{name:"word_offsets",val:": typing.Union[typing.List[typing.List[typing.Dict[str, typing.Union[str, int]]]], typing.List[typing.Dict[str, typing.Union[str, int]]]] = None"}],parametersDescription:[{anchor:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput.text",description:`<strong>text</strong> (list of <code>str</code> or <code>str</code>) &#x2014;
Decoded logits in text from. Usually the speech transcription.`,name:"text"},{anchor:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput.logit_score",description:`<strong>logit_score</strong> (list of <code>float</code> or <code>float</code>) &#x2014;
Total logit score of the beam associated with produced text.`,name:"logit_score"},{anchor:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput.lm_score",description:`<strong>lm_score</strong> (list of <code>float</code>) &#x2014;
Fused lm_score of the beam associated with produced text.`,name:"lm_score"},{anchor:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput.word_offsets",description:`<strong>word_offsets</strong> (list of <code>List[Dict[str, Union[int, str]]]</code> or <code>List[Dict[str, Union[int, str]]]</code>) &#x2014;
Offsets of the decoded words. In combination with sampling rate and model downsampling rate word offsets
can be used to compute time stamps for each word.`,name:"word_offsets"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py#L45"}}),jn=new F({props:{name:"class transformers.modeling_outputs.Wav2Vec2BaseModelOutput",anchor:"transformers.modeling_outputs.Wav2Vec2BaseModelOutput",parameters:[{name:"last_hidden_state",val:": FloatTensor = None"},{name:"extract_features",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.modeling_outputs.Wav2Vec2BaseModelOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the model.`,name:"last_hidden_state"},{anchor:"transformers.modeling_outputs.Wav2Vec2BaseModelOutput.extract_features",description:`<strong>extract_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, conv_dim[-1])</code>) &#x2014;
Sequence of extracted feature vectors of the last convolutional layer of the model.`,name:"extract_features"},{anchor:"transformers.modeling_outputs.Wav2Vec2BaseModelOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</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 model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.modeling_outputs.Wav2Vec2BaseModelOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_outputs.py#L1236"}}),Wn=new F({props:{name:"class transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput",anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"projected_states",val:": FloatTensor = None"},{name:"projected_quantized_states",val:": FloatTensor = None"},{name:"codevector_perplexity",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"contrastive_loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"diversity_loss",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.loss",description:`<strong>loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) &#x2014;
Total loss as the sum of the contrastive loss (L_m) and the diversity loss (L_d) as stated in the <a href="https://arxiv.org/pdf/2006.11477.pdf" rel="nofollow">official
paper</a> . (classification) loss.`,name:"loss"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.projected_states",description:`<strong>projected_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) &#x2014;
Hidden-states of the model projected to <em>config.proj_codevector_dim</em> that can be used to predict the masked
projected quantized states.`,name:"projected_states"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.projected_quantized_states",description:`<strong>projected_quantized_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) &#x2014;
Quantized extracted feature vectors projected to <em>config.proj_codevector_dim</em> representing the positive
target vectors for contrastive loss.`,name:"projected_quantized_states"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</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 model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.contrastive_loss",description:`<strong>contrastive_loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) &#x2014;
The contrastive loss (L_m) as stated in the <a href="https://arxiv.org/pdf/2006.11477.pdf" rel="nofollow">official paper</a> .`,name:"contrastive_loss"},{anchor:"transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput.diversity_loss",description:`<strong>diversity_loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) &#x2014;
The diversity loss (L_d) as stated in the <a href="https://arxiv.org/pdf/2006.11477.pdf" rel="nofollow">official paper</a> .`,name:"diversity_loss"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L92"}}),Fn=new F({props:{name:"class transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput",anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput",parameters:[{name:"last_hidden_state",val:": ndarray = None"},{name:"extract_features",val:": ndarray = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[jax._src.numpy.ndarray.ndarray]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[jax._src.numpy.ndarray.ndarray]] = None"}],parametersDescription:[{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput.extract_features",description:`<strong>extract_features</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, last_conv_dim)</code>) &#x2014;
Sequence of extracted feature vectors of the last convolutional layer of the model with <code>last_conv_dim</code>
being the dimension of the last convolutional layer.`,name:"extract_features"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput.hidden_states",description:`<strong>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>) &#x2014;
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 model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput.attentions",description:`<strong>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>) &#x2014;
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 after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_flax_wav2vec2.py#L46"}}),Cn=new F({props:{name:"replace",anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/flax/struct.py#L108"}}),Pn=new F({props:{name:"class transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput",anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput",parameters:[{name:"projected_states",val:": ndarray = None"},{name:"projected_quantized_states",val:": ndarray = None"},{name:"codevector_perplexity",val:": ndarray = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[jax._src.numpy.ndarray.ndarray]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[jax._src.numpy.ndarray.ndarray]] = None"}],parametersDescription:[{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.loss",description:`<strong>loss</strong> (<em>optional</em>, returned when model is in train mode, <code>jnp.ndarray</code> of shape <code>(1,)</code>) &#x2014;
Total loss as the sum of the contrastive loss (L_m) and the diversity loss (L_d) as stated in the <a href="https://arxiv.org/pdf/2006.11477.pdf" rel="nofollow">official
paper</a> . (classification) loss.`,name:"loss"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.projected_states",description:`<strong>projected_states</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) &#x2014;
Hidden-states of the model projected to <em>config.proj_codevector_dim</em> that can be used to predict the masked
projected quantized states.`,name:"projected_states"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.projected_quantized_states",description:`<strong>projected_quantized_states</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) &#x2014;
Quantized extracted feature vectors projected to <em>config.proj_codevector_dim</em> representing the positive
target vectors for contrastive loss.`,name:"projected_quantized_states"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.hidden_states",description:`<strong>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>) &#x2014;
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 model at the output of each layer plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.attentions",description:`<strong>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>) &#x2014;
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 after the attention softmax, used to compute the weighted average in the self-attention
heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_flax_wav2vec2.py#L76"}}),An=new F({props:{name:"replace",anchor:"transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/flax/struct.py#L108"}}),zn=new oe({}),Mn=new F({props:{name:"class transformers.Wav2Vec2Model",anchor:"transformers.Wav2Vec2Model",parameters:[{name:"config",val:": Wav2Vec2Config"}],parametersDescription:[{anchor:"transformers.Wav2Vec2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L1192"}}),Nn=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2Model.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"mask_time_indices",val:": typing.Optional[torch.FloatTensor] = 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.Wav2Vec2Model.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2Model.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2Model.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.Wav2Vec2Model.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.Wav2Vec2Model.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/wav2vec2/modeling_wav2vec2.py#L1278",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.modeling_outputs.Wav2Vec2BaseModelOutput"
>transformers.modeling_outputs.Wav2Vec2BaseModelOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>extract_features</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, conv_dim[-1])</code>) \u2014 Sequence of extracted feature vectors of the last convolutional layer of the model.</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 + 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 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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.modeling_outputs.Wav2Vec2BaseModelOutput"
>transformers.modeling_outputs.Wav2Vec2BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),va=new xe({props:{$$slots:{default:[ZT]},$$scope:{ctx:W}}}),ba=new Xe({props:{anchor:"transformers.Wav2Vec2Model.forward.example",$$slots:{default:[QT]},$$scope:{ctx:W}}}),Bn=new oe({}),Rn=new F({props:{name:"class transformers.Wav2Vec2ForCTC",anchor:"transformers.Wav2Vec2ForCTC",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L1612"}}),Kn=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2ForCTC.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = 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:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForCTC.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2ForCTC.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2ForCTC.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.Wav2Vec2ForCTC.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.Wav2Vec2ForCTC.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Wav2Vec2ForCTC.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_length)</code>, <em>optional</em>) &#x2014;
Labels for connectionist temporal classification. Note that <code>target_length</code> has to be smaller or equal to
the sequence length of the output logits. Indices are selected in <code>[-100, 0, ..., config.vocab_size - 1]</code>.
All labels set to <code>-100</code> are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L1653",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ya=new xe({props:{$$slots:{default:[YT]},$$scope:{ctx:W}}}),ka=new Xe({props:{anchor:"transformers.Wav2Vec2ForCTC.forward.example",$$slots:{default:[ex]},$$scope:{ctx:W}}}),Jn=new oe({}),Zn=new F({props:{name:"class transformers.Wav2Vec2ForSequenceClassification",anchor:"transformers.Wav2Vec2ForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L1741"}}),ar=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2ForSequenceClassification.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = 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:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForSequenceClassification.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2ForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2ForSequenceClassification.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.Wav2Vec2ForSequenceClassification.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.Wav2Vec2ForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Wav2Vec2ForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L1786",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</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 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xa=new xe({props:{$$slots:{default:[tx]},$$scope:{ctx:W}}}),$a=new Xe({props:{anchor:"transformers.Wav2Vec2ForSequenceClassification.forward.example",$$slots:{default:[ox]},$$scope:{ctx:W}}}),sr=new oe({}),nr=new F({props:{name:"class transformers.Wav2Vec2ForAudioFrameClassification",anchor:"transformers.Wav2Vec2ForAudioFrameClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForAudioFrameClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L1863"}}),pr=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2ForAudioFrameClassification.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.Wav2Vec2ForAudioFrameClassification.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2ForAudioFrameClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2ForAudioFrameClassification.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.Wav2Vec2ForAudioFrameClassification.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.Wav2Vec2ForAudioFrameClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Wav2Vec2ForAudioFrameClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L1907",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</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 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Wa=new xe({props:{$$slots:{default:[ax]},$$scope:{ctx:W}}}),Va=new Xe({props:{anchor:"transformers.Wav2Vec2ForAudioFrameClassification.forward.example",$$slots:{default:[sx]},$$scope:{ctx:W}}}),mr=new oe({}),hr=new F({props:{name:"class transformers.Wav2Vec2ForXVector",anchor:"transformers.Wav2Vec2ForXVector",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForXVector.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L2024"}}),br=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2ForXVector.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = 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:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForXVector.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2ForXVector.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2ForXVector.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.Wav2Vec2ForXVector.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.Wav2Vec2ForXVector.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Wav2Vec2ForXVector.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L2086",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.XVectorOutput"
>transformers.modeling_outputs.XVectorOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</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 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.xvector_output_dim)</code>) \u2014 Classification hidden states before AMSoftmax.</p>
</li>
<li>
<p><strong>embeddings</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.xvector_output_dim)</code>) \u2014 Utterance embeddings used for vector similarity-based retrieval.</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 + 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 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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.XVectorOutput"
>transformers.modeling_outputs.XVectorOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ea=new xe({props:{$$slots:{default:[nx]},$$scope:{ctx:W}}}),Ca=new Xe({props:{anchor:"transformers.Wav2Vec2ForXVector.forward.example",$$slots:{default:[rx]},$$scope:{ctx:W}}}),wr=new oe({}),yr=new F({props:{name:"class transformers.Wav2Vec2ForPreTraining",anchor:"transformers.Wav2Vec2ForPreTraining",parameters:[{name:"config",val:": Wav2Vec2Config"}],parametersDescription:[{anchor:"transformers.Wav2Vec2ForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_wav2vec2.py#L1340"}}),jr=new F({props:{name:"forward",anchor:"transformers.Wav2Vec2ForPreTraining.forward",parameters:[{name:"input_values",val:": typing.Optional[torch.Tensor]"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"mask_time_indices",val:": typing.Optional[torch.BoolTensor] = None"},{name:"sampled_negative_indices",val:": typing.Optional[torch.BoolTensor] = 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.Wav2Vec2ForPreTraining.forward.input_values",description:`<strong>input_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>torch.FloatTensor</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.Wav2Vec2ForPreTraining.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and 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></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.Wav2Vec2ForPreTraining.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.Wav2Vec2ForPreTraining.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.Wav2Vec2ForPreTraining.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Wav2Vec2ForPreTraining.forward.mask_time_indices",description:`<strong>mask_time_indices</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict
masked extracted features in <em>config.proj_codevector_dim</em> space.`,name:"mask_time_indices"},{anchor:"transformers.Wav2Vec2ForPreTraining.forward.sampled_negative_indices",description:`<strong>sampled_negative_indices</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length, num_negatives)</code>, <em>optional</em>) &#x2014;
Indices indicating which quantized target vectors are used as negative sampled vectors in contrastive loss.
Required input for pre-training.`,name:"sampled_negative_indices"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L1401",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput"
>transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput</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/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) \u2014 Total loss as the sum of the contrastive loss (L_m) and the diversity loss (L_d) as stated in the <a
  href="https://arxiv.org/pdf/2006.11477.pdf"
  rel="nofollow"
>official
paper</a> . (classification) loss.</p>
</li>
<li>
<p><strong>projected_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) \u2014 Hidden-states of the model projected to <em>config.proj_codevector_dim</em> that can be used to predict the masked
projected quantized states.</p>
</li>
<li>
<p><strong>projected_quantized_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) \u2014 Quantized extracted feature vectors projected to <em>config.proj_codevector_dim</em> representing the positive
target vectors for contrastive loss.</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 + 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 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>contrastive_loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) \u2014 The contrastive loss (L_m) as stated in the <a
  href="https://arxiv.org/pdf/2006.11477.pdf"
  rel="nofollow"
>official paper</a> .</p>
</li>
<li>
<p><strong>diversity_loss</strong> (<em>optional</em>, returned when <code>sample_negative_indices</code> are passed, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) \u2014 The diversity loss (L_d) as stated in the <a
  href="https://arxiv.org/pdf/2006.11477.pdf"
  rel="nofollow"
>official paper</a> .</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput"
>transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),qa=new xe({props:{$$slots:{default:[ix]},$$scope:{ctx:W}}}),Aa=new Xe({props:{anchor:"transformers.Wav2Vec2ForPreTraining.forward.example",$$slots:{default:[lx]},$$scope:{ctx:W}}}),Wr=new oe({}),Vr=new F({props:{name:"class transformers.TFWav2Vec2Model",anchor:"transformers.TFWav2Vec2Model",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFWav2Vec2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_tf_wav2vec2.py#L1464"}}),Ma=new xe({props:{$$slots:{default:[cx]},$$scope:{ctx:W}}}),Pr=new F({props:{name:"call",anchor:"transformers.TFWav2Vec2Model.call",parameters:[{name:"input_values",val:": Tensor"},{name:"attention_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"position_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFWav2Vec2Model.call.input_values",description:`<strong>input_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> <code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_values"},{anchor:"transformers.TFWav2Vec2Model.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</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.TFWav2Vec2Model.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFWav2Vec2Model.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFWav2Vec2Model.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFWav2Vec2Model.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_values</code> you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>input_values</code> indices into associated vectors
than the model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFWav2Vec2Model.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFWav2Vec2Model.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFWav2Vec2Model.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFWav2Vec2Model.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py#L1470",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.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>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),La=new xe({props:{$$slots:{default:[dx]},$$scope:{ctx:W}}}),Oa=new Xe({props:{anchor:"transformers.TFWav2Vec2Model.call.example",$$slots:{default:[px]},$$scope:{ctx:W}}}),qr=new oe({}),Ar=new F({props:{name:"class transformers.TFWav2Vec2ForCTC",anchor:"transformers.TFWav2Vec2ForCTC",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFWav2Vec2ForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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/wav2vec2/modeling_tf_wav2vec2.py#L1567"}}),Sa=new xe({props:{$$slots:{default:[mx]},$$scope:{ctx:W}}}),Dr=new F({props:{name:"call",anchor:"transformers.TFWav2Vec2ForCTC.call",parameters:[{name:"input_values",val:": Tensor"},{name:"attention_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"position_ids",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFWav2Vec2ForCTC.call.input_values",description:`<strong>input_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> <code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_values"},{anchor:"transformers.TFWav2Vec2ForCTC.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</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.TFWav2Vec2ForCTC.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFWav2Vec2ForCTC.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFWav2Vec2ForCTC.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFWav2Vec2ForCTC.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_values</code> you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>input_values</code> indices into associated vectors
than the model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFWav2Vec2ForCTC.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFWav2Vec2ForCTC.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFWav2Vec2ForCTC.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFWav2Vec2ForCTC.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFWav2Vec2ForCTC.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_values</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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py#L1594",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config"
>Wav2Vec2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</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(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ia=new xe({props:{$$slots:{default:[hx]},$$scope:{ctx:W}}}),Na=new Xe({props:{anchor:"transformers.TFWav2Vec2ForCTC.call.example",$$slots:{default:[ux]},$$scope:{ctx:W}}}),Sr=new oe({}),Ir=new F({props:{name:"class transformers.FlaxWav2Vec2Model",anchor:"transformers.FlaxWav2Vec2Model",parameters:[{name:"config",val:": Wav2Vec2Config"},{name:"input_shape",val:": typing.Tuple = (1, 1024)"},{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.FlaxWav2Vec2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxWav2Vec2Model.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/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_flax_wav2vec2.py#L1058"}}),Zr=new F({props:{name:"__call__",anchor:"transformers.FlaxWav2Vec2Model.__call__",parameters:[{name:"input_values",val:""},{name:"attention_mask",val:" = None"},{name:"mask_time_indices",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"freeze_feature_encoder",val:": bool = False"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxWav2Vec2Model.__call__.input_values",description:`<strong>input_values</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>jnp.ndarray</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.FlaxWav2Vec2Model.__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 convolution and 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> .. warning:: <code>attention_mask</code> should only be passed
if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor
has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.`,name:"attention_mask"},{anchor:"transformers.FlaxWav2Vec2Model.__call__.mask_time_indices",description:`<strong>mask_time_indices</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict
masked extracted features in <em>config.proj_codevector_dim</em> space.`,name:"mask_time_indices"},{anchor:"transformers.FlaxWav2Vec2Model.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxWav2Vec2Model.__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.FlaxWav2Vec2Model.__call__.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/wav2vec2/modeling_flax_wav2vec2.py#L890",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput"
>transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput</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 (<code>&lt;class 'transformers.models.wav2vec2.configuration_wav2vec2.Wav2Vec2Config'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>extract_features</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, last_conv_dim)</code>) \u2014 Sequence of extracted feature vectors of the last convolutional layer of the model with <code>last_conv_dim</code>
being the dimension of the last convolutional layer.</p>
</li>
<li>
<p><strong>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 model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>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 after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput"
>transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ra=new xe({props:{$$slots:{default:[fx]},$$scope:{ctx:W}}}),Ua=new Xe({props:{anchor:"transformers.FlaxWav2Vec2Model.__call__.example",$$slots:{default:[gx]},$$scope:{ctx:W}}}),Qr=new oe({}),Yr=new F({props:{name:"class transformers.FlaxWav2Vec2ForCTC",anchor:"transformers.FlaxWav2Vec2ForCTC",parameters:[{name:"config",val:": Wav2Vec2Config"},{name:"input_shape",val:": typing.Tuple = (1, 1024)"},{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.FlaxWav2Vec2ForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxWav2Vec2ForCTC.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/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_flax_wav2vec2.py#L1176"}}),li=new F({props:{name:"__call__",anchor:"transformers.FlaxWav2Vec2ForCTC.__call__",parameters:[{name:"input_values",val:""},{name:"attention_mask",val:" = None"},{name:"mask_time_indices",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"freeze_feature_encoder",val:": bool = False"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxWav2Vec2ForCTC.__call__.input_values",description:`<strong>input_values</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>jnp.ndarray</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.FlaxWav2Vec2ForCTC.__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 convolution and 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> .. warning:: <code>attention_mask</code> should only be passed
if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor
has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.`,name:"attention_mask"},{anchor:"transformers.FlaxWav2Vec2ForCTC.__call__.mask_time_indices",description:`<strong>mask_time_indices</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict
masked extracted features in <em>config.proj_codevector_dim</em> space.`,name:"mask_time_indices"},{anchor:"transformers.FlaxWav2Vec2ForCTC.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxWav2Vec2ForCTC.__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.FlaxWav2Vec2ForCTC.__call__.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/wav2vec2/modeling_flax_wav2vec2.py#L890",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</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 (<code>&lt;class 'transformers.models.wav2vec2.configuration_wav2vec2.Wav2Vec2Config'&gt;</code>) 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>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 model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>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 after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput"
>transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xa=new xe({props:{$$slots:{default:[_x]},$$scope:{ctx:W}}}),Ga=new Xe({props:{anchor:"transformers.FlaxWav2Vec2ForCTC.__call__.example",$$slots:{default:[vx]},$$scope:{ctx:W}}}),ci=new oe({}),di=new F({props:{name:"class transformers.FlaxWav2Vec2ForPreTraining",anchor:"transformers.FlaxWav2Vec2ForPreTraining",parameters:[{name:"config",val:": Wav2Vec2Config"},{name:"input_shape",val:": typing.Tuple = (1, 1024)"},{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.FlaxWav2Vec2ForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Config">Wav2Vec2Config</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxWav2Vec2ForPreTraining.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/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2/modeling_flax_wav2vec2.py#L1322"}}),bi=new F({props:{name:"__call__",anchor:"transformers.FlaxWav2Vec2ForPreTraining.__call__",parameters:[{name:"input_values",val:""},{name:"attention_mask",val:" = None"},{name:"mask_time_indices",val:" = None"},{name:"gumbel_temperature",val:": int = 1"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"gumbel_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"freeze_feature_encoder",val:": bool = False"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__call__.input_values",description:`<strong>input_values</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Float values of input raw speech waveform. 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>input_values</code>, the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a> should be used for padding and
conversion into a tensor of type <code>jnp.ndarray</code>. See <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__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 convolution and 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> .. warning:: <code>attention_mask</code> should only be passed
if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor
has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/wav2vec2-base-960h" rel="nofollow">wav2vec2-base</a>, <code>attention_mask</code> should <strong>not</strong> be
passed to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should
simply be padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly
different results depending on whether <code>input_values</code> is padded or not.`,name:"attention_mask"},{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__call__.mask_time_indices",description:`<strong>mask_time_indices</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict
masked extracted features in <em>config.proj_codevector_dim</em> space.`,name:"mask_time_indices"},{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__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.FlaxWav2Vec2ForPreTraining.__call__.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/wav2vec2/modeling_flax_wav2vec2.py#L1325",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput"
>transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput</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 (<code>&lt;class 'transformers.models.wav2vec2.configuration_wav2vec2.Wav2Vec2Config'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<em>optional</em>, returned when model is in train mode, <code>jnp.ndarray</code> of shape <code>(1,)</code>) \u2014 Total loss as the sum of the contrastive loss (L_m) and the diversity loss (L_d) as stated in the <a
  href="https://arxiv.org/pdf/2006.11477.pdf"
  rel="nofollow"
>official
paper</a> . (classification) loss.</p>
</li>
<li>
<p><strong>projected_states</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) \u2014 Hidden-states of the model projected to <em>config.proj_codevector_dim</em> that can be used to predict the masked
projected quantized states.</p>
</li>
<li>
<p><strong>projected_quantized_states</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.proj_codevector_dim)</code>) \u2014 Quantized extracted feature vectors projected to <em>config.proj_codevector_dim</em> representing the positive
target vectors for contrastive loss.</p>
</li>
<li>
<p><strong>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 model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>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 after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput"
>transformers.models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ja=new xe({props:{$$slots:{default:[bx]},$$scope:{ctx:W}}}),Za=new Xe({props:{anchor:"transformers.FlaxWav2Vec2ForPreTraining.__call__.example",$$slots:{default:[wx]},$$scope:{ctx:W}}}),{c(){m=n("meta"),b=d(),f=n("h1"),u=n("a"),v=n("span"),w(l.$$.fragment),h=d(),V=n("span"),M=a("Wav2Vec2"),L=d(),A=n("h2"),z=n("a"),N=n("span"),w(E.$$.fragment),O=d(),C=n("span"),ce=a("Overview"),K=d(),S=n("p"),de=a("The Wav2Vec2 model was proposed in "),I=n("a"),R=a("wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations"),Le=a(" by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli."),X=d(),J=n("p"),Oe=a("The abstract from the paper is the following:"),$e=d(),Z=n("p"),Ke=n("em"),xt=a(`We show for the first time that learning powerful representations from speech audio alone followed by fine-tuning on
transcribed speech can outperform the best semi-supervised methods while being conceptually simpler. wav2vec 2.0 masks
the speech input in the latent space and solves a contrastive task defined over a quantization of the latent
representations which are jointly learned. Experiments using all labeled data of Librispeech achieve 1.8/3.3 WER on the
clean/other test sets. When lowering the amount of labeled data to one hour, wav2vec 2.0 outperforms the previous state
of the art on the 100 hour subset while using 100 times less labeled data. Using just ten minutes of labeled data and
pre-training on 53k hours of unlabeled data still achieves 4.8/8.2 WER. This demonstrates the feasibility of speech
recognition with limited amounts of labeled data.`),De=d(),D=n("p"),Q=a("Tips:"),tt=d(),ae=n("ul"),Je=n("li"),$t=a("Wav2Vec2 is a speech model that accepts a float array corresponding to the raw waveform of the speech signal."),je=d(),We=n("li"),jt=a(`Wav2Vec2 model was trained using connectionist temporal classification (CTC) so the model output has to be decoded
using `),U=n("a"),Wt=a("Wav2Vec2CTCTokenizer"),Ve=a("."),ot=d(),we=n("p"),Fe=a("This model was contributed by "),Ee=n("a"),Vt=a("patrickvonplaten"),he=a("."),at=d(),Y=n("h2"),ye=n("a"),Ce=n("span"),w(B.$$.fragment),Ft=d(),ee=n("span"),Et=a("Resources"),st=d(),j=n("p"),P=a("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Wav2Vec2. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),It=d(),w(ue.$$.fragment),Nt=d(),Se=n("ul"),q=n("li"),Yt=a("A notebook on how to "),Ze=n("a"),eo=a("leverage a pretrained Wav2Vec2 model for emotion classification"),to=a(". \u{1F30E}"),oo=d(),H=n("li"),pe=n("a"),ao=a("Wav2Vec2ForCTC"),so=a(" is supported by this "),se=n("a"),no=a("example script"),ro=a(" and "),Pe=n("a"),io=a("notebook"),Qe=a("."),Bt=d(),w(ws.$$.fragment),np=d(),Ie=n("ul"),ys=n("li"),bh=a("A blog post on "),ks=n("a"),wh=a("boosting Wav2Vec2 with n-grams in \u{1F917} Transformers"),yh=a("."),kh=d(),Ts=n("li"),Th=a("A blog post on how to "),xs=n("a"),xh=a("finetune Wav2Vec2 for English ASR with \u{1F917} Transformers"),$h=a("."),jh=d(),$s=n("li"),Wh=a("A blog post on "),js=n("a"),Vh=a("finetuning XLS-R for Multi-Lingual ASR with \u{1F917} Transformers"),Fh=a("."),Eh=d(),Ws=n("li"),Ch=a("A notebook on how to "),Vs=n("a"),Ph=a("create YouTube captions from any video by transcribing audio with Wav2Vec2"),qh=a(". \u{1F30E}"),Ah=d(),Rt=n("li"),Ei=n("a"),zh=a("Wav2Vec2ForCTC"),Mh=a(" is supported by a notebook on "),Fs=n("a"),Lh=a("how to finetune a speech recognition model in English"),Oh=a(", and "),Es=n("a"),Dh=a("how to finetune a speech recognition model in any language"),Sh=a("."),rp=d(),Ci=n("p"),Ih=a("\u{1F680} Deploy"),ip=d(),Pi=n("ul"),Cs=n("li"),Nh=a("A blog post on how to deploy Wav2Vec2 for "),Ps=n("a"),Bh=a("Automatic Speech Recogntion with Hugging Face\u2019s Transformers & Amazon SageMaker"),Rh=a("."),lp=d(),lo=n("h2"),Xo=n("a"),Hl=n("span"),w(qs.$$.fragment),Uh=d(),Xl=n("span"),Hh=a("Wav2Vec2Config"),cp=d(),Ye=n("div"),w(As.$$.fragment),Xh=d(),co=n("p"),Gh=a("This is the configuration class to store the configuration of a "),qi=n("a"),Kh=a("Wav2Vec2Model"),Jh=a(`. It is used to instantiate an
Wav2Vec2 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 Wav2Vec2
`),zs=n("a"),Zh=a("facebook/wav2vec2-base-960h"),Qh=a(" architecture."),Yh=d(),po=n("p"),eu=a("Configuration objects inherit from "),Ai=n("a"),tu=a("PretrainedConfig"),ou=a(` and can be used to control the model outputs. Read the
documentation from `),zi=n("a"),au=a("PretrainedConfig"),su=a(" for more information."),nu=d(),w(Go.$$.fragment),dp=d(),mo=n("h2"),Ko=n("a"),Gl=n("span"),w(Ms.$$.fragment),ru=d(),Kl=n("span"),iu=a("Wav2Vec2CTCTokenizer"),pp=d(),ne=n("div"),w(Ls.$$.fragment),lu=d(),Jl=n("p"),cu=a("Constructs a Wav2Vec2CTC tokenizer."),du=d(),Os=n("p"),pu=a("This tokenizer inherits from "),Mi=n("a"),mu=a("PreTrainedTokenizer"),hu=a(` which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.`),uu=d(),Jo=n("div"),w(Ds.$$.fragment),fu=d(),Zl=n("p"),gu=a(`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences.`),_u=d(),Li=n("div"),w(Ss.$$.fragment),vu=d(),nt=n("div"),w(Is.$$.fragment),bu=d(),Ql=n("p"),wu=a(`Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
tokens and clean up tokenization spaces.`),yu=d(),Ns=n("p"),ku=a("Similar to doing "),Yl=n("code"),Tu=a("self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))"),xu=a("."),$u=d(),w(Zo.$$.fragment),ju=d(),Qo=n("div"),w(Bs.$$.fragment),Wu=d(),ec=n("p"),Vu=a("Convert a list of lists of token ids into a list of strings by calling decode."),mp=d(),ho=n("h2"),Yo=n("a"),tc=n("span"),w(Rs.$$.fragment),Fu=d(),oc=n("span"),Eu=a("Wav2Vec2FeatureExtractor"),hp=d(),et=n("div"),w(Us.$$.fragment),Cu=d(),ac=n("p"),Pu=a("Constructs a Wav2Vec2 feature extractor."),qu=d(),Hs=n("p"),Au=a("This feature extractor inherits from "),Oi=n("a"),zu=a("SequenceFeatureExtractor"),Mu=a(` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),Lu=d(),ea=n("div"),w(Xs.$$.fragment),Ou=d(),sc=n("p"),Du=a("Main method to featurize and prepare for the model one or several sequence(s)."),up=d(),uo=n("h2"),ta=n("a"),nc=n("span"),w(Gs.$$.fragment),Su=d(),rc=n("span"),Iu=a("Wav2Vec2Processor"),fp=d(),G=n("div"),w(Ks.$$.fragment),Nu=d(),ic=n("p"),Bu=a(`Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor and a Wav2Vec2 CTC tokenizer into a single
processor.`),Ru=d(),Ne=n("p"),Di=n("a"),Uu=a("Wav2Vec2Processor"),Hu=a(" offers all the functionalities of "),Si=n("a"),Xu=a("Wav2Vec2FeatureExtractor"),Gu=a(" and "),Ii=n("a"),Ku=a("PreTrainedTokenizer"),Ju=a(`.
See the docstring of `),Js=n("a"),lc=n("strong"),Zu=a("call"),Qu=a("()"),Yu=a(" and "),Ni=n("a"),ef=a("decode()"),tf=a(" for more information."),of=d(),oa=n("div"),w(Zs.$$.fragment),af=d(),Ct=n("p"),sf=a(`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Qs=n("a"),cc=n("strong"),nf=a("call"),rf=a("()"),lf=a(` and returns its output. If used in the context
`),dc=n("code"),cf=a("as_target_processor()"),df=a(` this method forwards all its arguments to PreTrainedTokenizer\u2019s
`),Ys=n("a"),pc=n("strong"),pf=a("call"),mf=a("()"),hf=a(". Please refer to the docstring of the above two methods for more information."),uf=d(),aa=n("div"),w(en.$$.fragment),ff=d(),Pt=n("p"),gf=a(`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Bi=n("a"),_f=a("pad()"),vf=a(` and returns its output. If used in the context
`),mc=n("code"),bf=a("as_target_processor()"),wf=a(` this method forwards all its arguments to PreTrainedTokenizer\u2019s
`),Ri=n("a"),yf=a("pad()"),kf=a(". Please refer to the docstring of the above two methods for more information."),Tf=d(),Ui=n("div"),w(tn.$$.fragment),xf=d(),Ut=n("div"),w(on.$$.fragment),$f=d(),an=n("p"),jf=a(`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Hi=n("a"),Wf=a("from_pretrained()"),Vf=a(" method."),Ff=d(),w(sa.$$.fragment),Ef=d(),na=n("div"),w(sn.$$.fragment),Cf=d(),nn=n("p"),Pf=a("This method forwards all its arguments to PreTrainedTokenizer\u2019s "),Xi=n("a"),qf=a("batch_decode()"),Af=a(`. Please
refer to the docstring of this method for more information.`),zf=d(),ra=n("div"),w(rn.$$.fragment),Mf=d(),ln=n("p"),Lf=a("This method forwards all its arguments to PreTrainedTokenizer\u2019s "),Gi=n("a"),Of=a("decode()"),Df=a(`. Please refer
to the docstring of this method for more information.`),gp=d(),fo=n("h2"),ia=n("a"),hc=n("span"),w(cn.$$.fragment),Sf=d(),uc=n("span"),If=a("Wav2Vec2ProcessorWithLM"),_p=d(),te=n("div"),w(dn.$$.fragment),Nf=d(),fc=n("p"),Bf=a(`Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor, a Wav2Vec2 CTC tokenizer and a decoder
with language model support into a single processor for language model boosted speech recognition decoding.`),Rf=d(),la=n("div"),w(pn.$$.fragment),Uf=d(),qt=n("p"),Hf=a(`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),mn=n("a"),gc=n("strong"),Xf=a("call"),Gf=a("()"),Kf=a(` and returns its output. If used in the context
`),_c=n("code"),Jf=a("as_target_processor()"),Zf=a(` this method forwards all its arguments to
Wav2Vec2CTCTokenizer\u2019s `),hn=n("a"),vc=n("strong"),Qf=a("call"),Yf=a("()"),eg=a(`. Please refer to the docstring of the above two
methods for more information.`),tg=d(),ca=n("div"),w(un.$$.fragment),og=d(),At=n("p"),ag=a(`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Ki=n("a"),sg=a("pad()"),ng=a(` and returns its output. If used in the context
`),bc=n("code"),rg=a("as_target_processor()"),ig=a(` this method forwards all its arguments to
Wav2Vec2CTCTokenizer\u2019s `),Ji=n("a"),lg=a("pad()"),cg=a(`. Please refer to the docstring of the above two methods
for more information.`),dg=d(),Ht=n("div"),w(fn.$$.fragment),pg=d(),gn=n("p"),mg=a("Instantiate a "),Zi=n("a"),hg=a("Wav2Vec2ProcessorWithLM"),ug=a(" from a pretrained Wav2Vec2 processor."),fg=d(),w(da.$$.fragment),gg=d(),Qi=n("div"),w(_n.$$.fragment),_g=d(),rt=n("div"),w(vn.$$.fragment),vg=d(),wc=n("p"),bg=a("Batch decode output logits to audio transcription with language model support."),wg=d(),w(pa.$$.fragment),yg=d(),bn=n("p"),kg=a(`Example:
See `),Yi=n("a"),Tg=a("Decoding multiple audios"),xg=a("."),$g=d(),Xt=n("div"),w(wn.$$.fragment),jg=d(),yc=n("p"),Wg=a("Decode output logits to audio transcription with language model support."),Vg=d(),w(ma.$$.fragment),vp=d(),go=n("h3"),ha=n("a"),kc=n("span"),w(yn.$$.fragment),Fg=d(),Tc=n("span"),Eg=a("Decoding multiple audios"),bp=d(),ke=n("p"),Cg=a("If you are planning to decode multiple batches of audios, you should consider using "),el=n("a"),Pg=a("batch_decode()"),qg=a(" and passing an instantiated "),xc=n("code"),Ag=a("multiprocessing.Pool"),zg=a(`.
Otherwise, `),tl=n("a"),Mg=a("batch_decode()"),Lg=a(" performance will be slower than calling "),ol=n("a"),Og=a("decode()"),Dg=a(" for each audio individually, as it internally instantiates a new "),$c=n("code"),Sg=a("Pool"),Ig=a(" for every call. See the example below:"),wp=d(),w(kn.$$.fragment),yp=d(),_o=n("h2"),ua=n("a"),jc=n("span"),w(Tn.$$.fragment),Ng=d(),Wc=n("span"),Bg=a("Wav2Vec2 specific outputs"),kp=d(),vo=n("div"),w(xn.$$.fragment),Rg=d(),$n=n("p"),Ug=a("Output type of "),Vc=n("code"),Hg=a("Wav2Vec2DecoderWithLM"),Xg=a(", with transcription."),Tp=d(),bo=n("div"),w(jn.$$.fragment),Gg=d(),Fc=n("p"),Kg=a("Base class for models that have been trained with the Wav2Vec2 loss objective."),xp=d(),wo=n("div"),w(Wn.$$.fragment),Jg=d(),Vn=n("p"),Zg=a("Output type of "),al=n("a"),Qg=a("Wav2Vec2ForPreTraining"),Yg=a(", with potential hidden states and attentions."),$p=d(),zt=n("div"),w(Fn.$$.fragment),e_=d(),En=n("p"),t_=a("Output type of "),Ec=n("code"),o_=a("FlaxWav2Vec2BaseModelOutput"),a_=a(", with potential hidden states and attentions."),s_=d(),fa=n("div"),w(Cn.$$.fragment),n_=d(),Cc=n("p"),r_=a("\u201CReturns a new object replacing the specified fields with new values."),jp=d(),Mt=n("div"),w(Pn.$$.fragment),i_=d(),qn=n("p"),l_=a("Output type of "),Pc=n("code"),c_=a("FlaxWav2Vec2ForPreTrainingOutput"),d_=a(", with potential hidden states and attentions."),p_=d(),ga=n("div"),w(An.$$.fragment),m_=d(),qc=n("p"),h_=a("\u201CReturns a new object replacing the specified fields with new values."),Wp=d(),yo=n("h2"),_a=n("a"),Ac=n("span"),w(zn.$$.fragment),u_=d(),zc=n("span"),f_=a("Wav2Vec2Model"),Vp=d(),qe=n("div"),w(Mn.$$.fragment),g_=d(),Ln=n("p"),__=a(`The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
Wav2Vec2 was proposed in `),On=n("a"),v_=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),b_=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),w_=d(),Dn=n("p"),y_=a("This model inherits from "),sl=n("a"),k_=a("PreTrainedModel"),T_=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),x_=d(),Sn=n("p"),$_=a("This model is a PyTorch "),In=n("a"),j_=a("torch.nn.Module"),W_=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),V_=d(),it=n("div"),w(Nn.$$.fragment),F_=d(),ko=n("p"),E_=a("The "),nl=n("a"),C_=a("Wav2Vec2Model"),P_=a(" forward method, overrides the "),Mc=n("code"),q_=a("__call__"),A_=a(" special method."),z_=d(),w(va.$$.fragment),M_=d(),w(ba.$$.fragment),Fp=d(),To=n("h2"),wa=n("a"),Lc=n("span"),w(Bn.$$.fragment),L_=d(),Oc=n("span"),O_=a("Wav2Vec2ForCTC"),Ep=d(),Ae=n("div"),w(Rn.$$.fragment),D_=d(),xo=n("p"),S_=a("Wav2Vec2 Model with a "),Dc=n("code"),I_=a("language modeling"),N_=a(` head on top for Connectionist Temporal Classification (CTC).
Wav2Vec2 was proposed in `),Un=n("a"),B_=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),R_=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),U_=d(),Hn=n("p"),H_=a("This model inherits from "),rl=n("a"),X_=a("PreTrainedModel"),G_=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),K_=d(),Xn=n("p"),J_=a("This model is a PyTorch "),Gn=n("a"),Z_=a("torch.nn.Module"),Q_=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Y_=d(),lt=n("div"),w(Kn.$$.fragment),ev=d(),$o=n("p"),tv=a("The "),il=n("a"),ov=a("Wav2Vec2ForCTC"),av=a(" forward method, overrides the "),Sc=n("code"),sv=a("__call__"),nv=a(" special method."),rv=d(),w(ya.$$.fragment),iv=d(),w(ka.$$.fragment),Cp=d(),jo=n("h2"),Ta=n("a"),Ic=n("span"),w(Jn.$$.fragment),lv=d(),Nc=n("span"),cv=a("Wav2Vec2ForSequenceClassification"),Pp=d(),fe=n("div"),w(Zn.$$.fragment),dv=d(),Bc=n("p"),pv=a(`Wav2Vec2 Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),mv=d(),Qn=n("p"),hv=a("Wav2Vec2 was proposed in "),Yn=n("a"),uv=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),fv=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),gv=d(),er=n("p"),_v=a("This model inherits from "),ll=n("a"),vv=a("PreTrainedModel"),bv=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),wv=d(),tr=n("p"),yv=a("This model is a PyTorch "),or=n("a"),kv=a("torch.nn.Module"),Tv=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xv=d(),ct=n("div"),w(ar.$$.fragment),$v=d(),Wo=n("p"),jv=a("The "),cl=n("a"),Wv=a("Wav2Vec2ForSequenceClassification"),Vv=a(" forward method, overrides the "),Rc=n("code"),Fv=a("__call__"),Ev=a(" special method."),Cv=d(),w(xa.$$.fragment),Pv=d(),w($a.$$.fragment),qp=d(),Vo=n("h2"),ja=n("a"),Uc=n("span"),w(sr.$$.fragment),qv=d(),Hc=n("span"),Av=a("Wav2Vec2ForAudioFrameClassification"),Ap=d(),ge=n("div"),w(nr.$$.fragment),zv=d(),Xc=n("p"),Mv=a("Wav2Vec2 Model with a frame classification head on top for tasks like Speaker Diarization."),Lv=d(),rr=n("p"),Ov=a("Wav2Vec2 was proposed in "),ir=n("a"),Dv=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),Sv=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Iv=d(),lr=n("p"),Nv=a("This model inherits from "),dl=n("a"),Bv=a("PreTrainedModel"),Rv=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Uv=d(),cr=n("p"),Hv=a("This model is a PyTorch "),dr=n("a"),Xv=a("torch.nn.Module"),Gv=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Kv=d(),dt=n("div"),w(pr.$$.fragment),Jv=d(),Fo=n("p"),Zv=a("The "),pl=n("a"),Qv=a("Wav2Vec2ForAudioFrameClassification"),Yv=a(" forward method, overrides the "),Gc=n("code"),e2=a("__call__"),t2=a(" special method."),o2=d(),w(Wa.$$.fragment),a2=d(),w(Va.$$.fragment),zp=d(),Eo=n("h2"),Fa=n("a"),Kc=n("span"),w(mr.$$.fragment),s2=d(),Jc=n("span"),n2=a("Wav2Vec2ForXVector"),Mp=d(),_e=n("div"),w(hr.$$.fragment),r2=d(),Zc=n("p"),i2=a("Wav2Vec2 Model with an XVector feature extraction head on top for tasks like Speaker Verification."),l2=d(),ur=n("p"),c2=a("Wav2Vec2 was proposed in "),fr=n("a"),d2=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),p2=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),m2=d(),gr=n("p"),h2=a("This model inherits from "),ml=n("a"),u2=a("PreTrainedModel"),f2=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),g2=d(),_r=n("p"),_2=a("This model is a PyTorch "),vr=n("a"),v2=a("torch.nn.Module"),b2=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),w2=d(),pt=n("div"),w(br.$$.fragment),y2=d(),Co=n("p"),k2=a("The "),hl=n("a"),T2=a("Wav2Vec2ForXVector"),x2=a(" forward method, overrides the "),Qc=n("code"),$2=a("__call__"),j2=a(" special method."),W2=d(),w(Ea.$$.fragment),V2=d(),w(Ca.$$.fragment),Lp=d(),Po=n("h2"),Pa=n("a"),Yc=n("span"),w(wr.$$.fragment),F2=d(),ed=n("span"),E2=a("Wav2Vec2ForPreTraining"),Op=d(),ze=n("div"),w(yr.$$.fragment),C2=d(),qo=n("p"),P2=a("Wav2Vec2 Model with a quantizer and "),td=n("code"),q2=a("VQ"),A2=a(` head on top.
Wav2Vec2 was proposed in `),kr=n("a"),z2=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),M2=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),L2=d(),Tr=n("p"),O2=a("This model inherits from "),ul=n("a"),D2=a("PreTrainedModel"),S2=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),I2=d(),xr=n("p"),N2=a("This model is a PyTorch "),$r=n("a"),B2=a("torch.nn.Module"),R2=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),U2=d(),mt=n("div"),w(jr.$$.fragment),H2=d(),Ao=n("p"),X2=a("The "),fl=n("a"),G2=a("Wav2Vec2ForPreTraining"),K2=a(" forward method, overrides the "),od=n("code"),J2=a("__call__"),Z2=a(" special method."),Q2=d(),w(qa.$$.fragment),Y2=d(),w(Aa.$$.fragment),Dp=d(),zo=n("h2"),za=n("a"),ad=n("span"),w(Wr.$$.fragment),eb=d(),sd=n("span"),tb=a("TFWav2Vec2Model"),Sp=d(),ve=n("div"),w(Vr.$$.fragment),ob=d(),nd=n("p"),ab=a("The bare TFWav2Vec2 Model transformer outputing raw hidden-states without any specific head on top."),sb=d(),Fr=n("p"),nb=a("This model inherits from "),gl=n("a"),rb=a("TFPreTrainedModel"),ib=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),lb=d(),Er=n("p"),cb=a("This model is also a "),Cr=n("a"),db=a("tf.keras.Model"),pb=a(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),mb=d(),w(Ma.$$.fragment),hb=d(),ht=n("div"),w(Pr.$$.fragment),ub=d(),Mo=n("p"),fb=a("The "),_l=n("a"),gb=a("TFWav2Vec2Model"),_b=a(" forward method, overrides the "),rd=n("code"),vb=a("__call__"),bb=a(" special method."),wb=d(),w(La.$$.fragment),yb=d(),w(Oa.$$.fragment),Ip=d(),Lo=n("h2"),Da=n("a"),id=n("span"),w(qr.$$.fragment),kb=d(),ld=n("span"),Tb=a("TFWav2Vec2ForCTC"),Np=d(),be=n("div"),w(Ar.$$.fragment),xb=d(),zr=n("p"),$b=a("TFWav2Vec2 Model with a "),cd=n("code"),jb=a("language modeling"),Wb=a(" head on top for Connectionist Temporal Classification (CTC)."),Vb=d(),Mr=n("p"),Fb=a("This model inherits from "),vl=n("a"),Eb=a("TFPreTrainedModel"),Cb=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Pb=d(),Lr=n("p"),qb=a("This model is also a "),Or=n("a"),Ab=a("tf.keras.Model"),zb=a(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Mb=d(),w(Sa.$$.fragment),Lb=d(),ut=n("div"),w(Dr.$$.fragment),Ob=d(),Oo=n("p"),Db=a("The "),bl=n("a"),Sb=a("TFWav2Vec2ForCTC"),Ib=a(" forward method, overrides the "),dd=n("code"),Nb=a("__call__"),Bb=a(" special method."),Rb=d(),w(Ia.$$.fragment),Ub=d(),w(Na.$$.fragment),Bp=d(),Do=n("h2"),Ba=n("a"),pd=n("span"),w(Sr.$$.fragment),Hb=d(),md=n("span"),Xb=a("FlaxWav2Vec2Model"),Rp=d(),re=n("div"),w(Ir.$$.fragment),Gb=d(),Nr=n("p"),Kb=a(`The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
Wav2Vec2 was proposed in `),Br=n("a"),Jb=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),Zb=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Qb=d(),Rr=n("p"),Yb=a("This model inherits from "),wl=n("a"),ew=a("FlaxPreTrainedModel"),tw=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ow=d(),Ur=n("p"),aw=a(`This model is also a Flax Linen
`),Hr=n("a"),sw=a("flax.nn.Module"),nw=a(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),rw=d(),hd=n("p"),iw=a("Finally, this model supports inherent JAX features such as:"),lw=d(),Lt=n("ul"),ud=n("li"),Xr=n("a"),cw=a("Just-In-Time (JIT) compilation"),dw=d(),fd=n("li"),Gr=n("a"),pw=a("Automatic Differentiation"),mw=d(),gd=n("li"),Kr=n("a"),hw=a("Vectorization"),uw=d(),_d=n("li"),Jr=n("a"),fw=a("Parallelization"),gw=d(),ft=n("div"),w(Zr.$$.fragment),_w=d(),So=n("p"),vw=a("The "),vd=n("code"),bw=a("FlaxWav2Vec2PreTrainedModel"),ww=a(" forward method, overrides the "),bd=n("code"),yw=a("__call__"),kw=a(" special method."),Tw=d(),w(Ra.$$.fragment),xw=d(),w(Ua.$$.fragment),Up=d(),Io=n("h2"),Ha=n("a"),wd=n("span"),w(Qr.$$.fragment),$w=d(),yd=n("span"),jw=a("FlaxWav2Vec2ForCTC"),Hp=d(),ie=n("div"),w(Yr.$$.fragment),Ww=d(),No=n("p"),Vw=a("Wav2Vec2 Model with a "),kd=n("code"),Fw=a("language modeling"),Ew=a(` head on top for Connectionist Temporal Classification (CTC).
Wav2Vec2 was proposed in `),ei=n("a"),Cw=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),Pw=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),qw=d(),ti=n("p"),Aw=a("This model inherits from "),yl=n("a"),zw=a("FlaxPreTrainedModel"),Mw=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Lw=d(),oi=n("p"),Ow=a(`This model is also a Flax Linen
`),ai=n("a"),Dw=a("flax.nn.Module"),Sw=a(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Iw=d(),Td=n("p"),Nw=a("Finally, this model supports inherent JAX features such as:"),Bw=d(),Ot=n("ul"),xd=n("li"),si=n("a"),Rw=a("Just-In-Time (JIT) compilation"),Uw=d(),$d=n("li"),ni=n("a"),Hw=a("Automatic Differentiation"),Xw=d(),jd=n("li"),ri=n("a"),Gw=a("Vectorization"),Kw=d(),Wd=n("li"),ii=n("a"),Jw=a("Parallelization"),Zw=d(),gt=n("div"),w(li.$$.fragment),Qw=d(),Bo=n("p"),Yw=a("The "),Vd=n("code"),ey=a("FlaxWav2Vec2PreTrainedModel"),ty=a(" forward method, overrides the "),Fd=n("code"),oy=a("__call__"),ay=a(" special method."),sy=d(),w(Xa.$$.fragment),ny=d(),w(Ga.$$.fragment),Xp=d(),Ro=n("h2"),Ka=n("a"),Ed=n("span"),w(ci.$$.fragment),ry=d(),Cd=n("span"),iy=a("FlaxWav2Vec2ForPreTraining"),Gp=d(),le=n("div"),w(di.$$.fragment),ly=d(),Uo=n("p"),cy=a("Wav2Vec2 Model with a quantizer and "),Pd=n("code"),dy=a("VQ"),py=a(` head on top.
Wav2Vec2 was proposed in `),pi=n("a"),my=a(`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),hy=a(` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),uy=d(),mi=n("p"),fy=a("This model inherits from "),kl=n("a"),gy=a("FlaxPreTrainedModel"),_y=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vy=d(),hi=n("p"),by=a(`This model is also a Flax Linen
`),ui=n("a"),wy=a("flax.nn.Module"),yy=a(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),ky=d(),qd=n("p"),Ty=a("Finally, this model supports inherent JAX features such as:"),xy=d(),Dt=n("ul"),Ad=n("li"),fi=n("a"),$y=a("Just-In-Time (JIT) compilation"),jy=d(),zd=n("li"),gi=n("a"),Wy=a("Automatic Differentiation"),Vy=d(),Md=n("li"),_i=n("a"),Fy=a("Vectorization"),Ey=d(),Ld=n("li"),vi=n("a"),Cy=a("Parallelization"),Py=d(),_t=n("div"),w(bi.$$.fragment),qy=d(),Ho=n("p"),Ay=a("The "),Tl=n("a"),zy=a("FlaxWav2Vec2ForPreTraining"),My=a(" forward method, overrides the "),Od=n("code"),Ly=a("__call__"),Oy=a(" special method."),Dy=d(),w(Ja.$$.fragment),Sy=d(),w(Za.$$.fragment),this.h()},l(o){const g=BT('[data-svelte="svelte-1phssyn"]',document.head);m=r(g,"META",{name:!0,content:!0}),g.forEach(t),b=p(o),f=r(o,"H1",{class:!0});var wi=i(f);u=r(wi,"A",{id:!0,class:!0,href:!0});var Dd=i(u);v=r(Dd,"SPAN",{});var Sd=i(v);y(l.$$.fragment,Sd),Sd.forEach(t),Dd.forEach(t),h=p(wi),V=r(wi,"SPAN",{});var Id=i(V);M=s(Id,"Wav2Vec2"),Id.forEach(t),wi.forEach(t),L=p(o),A=r(o,"H2",{class:!0});var yi=i(A);z=r(yi,"A",{id:!0,class:!0,href:!0});var Nd=i(z);N=r(Nd,"SPAN",{});var Bd=i(N);y(E.$$.fragment,Bd),Bd.forEach(t),Nd.forEach(t),O=p(yi),C=r(yi,"SPAN",{});var Rd=i(C);ce=s(Rd,"Overview"),Rd.forEach(t),yi.forEach(t),K=p(o),S=r(o,"P",{});var ki=i(S);de=s(ki,"The Wav2Vec2 model was proposed in "),I=r(ki,"A",{href:!0,rel:!0});var Ud=i(I);R=s(Ud,"wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations"),Ud.forEach(t),Le=s(ki," by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli."),ki.forEach(t),X=p(o),J=r(o,"P",{});var Hd=i(J);Oe=s(Hd,"The abstract from the paper is the following:"),Hd.forEach(t),$e=p(o),Z=r(o,"P",{});var Xd=i(Z);Ke=r(Xd,"EM",{});var Gd=i(Ke);xt=s(Gd,`We show for the first time that learning powerful representations from speech audio alone followed by fine-tuning on
transcribed speech can outperform the best semi-supervised methods while being conceptually simpler. wav2vec 2.0 masks
the speech input in the latent space and solves a contrastive task defined over a quantization of the latent
representations which are jointly learned. Experiments using all labeled data of Librispeech achieve 1.8/3.3 WER on the
clean/other test sets. When lowering the amount of labeled data to one hour, wav2vec 2.0 outperforms the previous state
of the art on the 100 hour subset while using 100 times less labeled data. Using just ten minutes of labeled data and
pre-training on 53k hours of unlabeled data still achieves 4.8/8.2 WER. This demonstrates the feasibility of speech
recognition with limited amounts of labeled data.`),Gd.forEach(t),Xd.forEach(t),De=p(o),D=r(o,"P",{});var Kd=i(D);Q=s(Kd,"Tips:"),Kd.forEach(t),tt=p(o),ae=r(o,"UL",{});var Ti=i(ae);Je=r(Ti,"LI",{});var Jd=i(Je);$t=s(Jd,"Wav2Vec2 is a speech model that accepts a float array corresponding to the raw waveform of the speech signal."),Jd.forEach(t),je=p(Ti),We=r(Ti,"LI",{});var xi=i(We);jt=s(xi,`Wav2Vec2 model was trained using connectionist temporal classification (CTC) so the model output has to be decoded
using `),U=r(xi,"A",{href:!0});var Zd=i(U);Wt=s(Zd,"Wav2Vec2CTCTokenizer"),Zd.forEach(t),Ve=s(xi,"."),xi.forEach(t),Ti.forEach(t),ot=p(o),we=r(o,"P",{});var $i=i(we);Fe=s($i,"This model was contributed by "),Ee=r($i,"A",{href:!0,rel:!0});var Qd=i(Ee);Vt=s(Qd,"patrickvonplaten"),Qd.forEach(t),he=s($i,"."),$i.forEach(t),at=p(o),Y=r(o,"H2",{class:!0});var ji=i(Y);ye=r(ji,"A",{id:!0,class:!0,href:!0});var Yd=i(ye);Ce=r(Yd,"SPAN",{});var ep=i(Ce);y(B.$$.fragment,ep),ep.forEach(t),Yd.forEach(t),Ft=p(ji),ee=r(ji,"SPAN",{});var tp=i(ee);Et=s(tp,"Resources"),tp.forEach(t),ji.forEach(t),st=p(o),j=r(o,"P",{});var op=i(j);P=s(op,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Wav2Vec2. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),op.forEach(t),It=p(o),y(ue.$$.fragment,o),Nt=p(o),Se=r(o,"UL",{});var Wi=i(Se);q=r(Wi,"LI",{});var Vi=i(q);Yt=s(Vi,"A notebook on how to "),Ze=r(Vi,"A",{href:!0,rel:!0});var ap=i(Ze);eo=s(ap,"leverage a pretrained Wav2Vec2 model for emotion classification"),ap.forEach(t),to=s(Vi,". \u{1F30E}"),Vi.forEach(t),oo=p(Wi),H=r(Wi,"LI",{});var Gt=i(H);pe=r(Gt,"A",{href:!0});var sp=i(pe);ao=s(sp,"Wav2Vec2ForCTC"),sp.forEach(t),so=s(Gt," is supported by this "),se=r(Gt,"A",{href:!0,rel:!0});var Hy=i(se);no=s(Hy,"example script"),Hy.forEach(t),ro=s(Gt," and "),Pe=r(Gt,"A",{href:!0,rel:!0});var Xy=i(Pe);io=s(Xy,"notebook"),Xy.forEach(t),Qe=s(Gt,"."),Gt.forEach(t),Wi.forEach(t),Bt=p(o),y(ws.$$.fragment,o),np=p(o),Ie=r(o,"UL",{});var Kt=i(Ie);ys=r(Kt,"LI",{});var Jp=i(ys);bh=s(Jp,"A blog post on "),ks=r(Jp,"A",{href:!0,rel:!0});var Gy=i(ks);wh=s(Gy,"boosting Wav2Vec2 with n-grams in \u{1F917} Transformers"),Gy.forEach(t),yh=s(Jp,"."),Jp.forEach(t),kh=p(Kt),Ts=r(Kt,"LI",{});var Zp=i(Ts);Th=s(Zp,"A blog post on how to "),xs=r(Zp,"A",{href:!0,rel:!0});var Ky=i(xs);xh=s(Ky,"finetune Wav2Vec2 for English ASR with \u{1F917} Transformers"),Ky.forEach(t),$h=s(Zp,"."),Zp.forEach(t),jh=p(Kt),$s=r(Kt,"LI",{});var Qp=i($s);Wh=s(Qp,"A blog post on "),js=r(Qp,"A",{href:!0,rel:!0});var Jy=i(js);Vh=s(Jy,"finetuning XLS-R for Multi-Lingual ASR with \u{1F917} Transformers"),Jy.forEach(t),Fh=s(Qp,"."),Qp.forEach(t),Eh=p(Kt),Ws=r(Kt,"LI",{});var Yp=i(Ws);Ch=s(Yp,"A notebook on how to "),Vs=r(Yp,"A",{href:!0,rel:!0});var Zy=i(Vs);Ph=s(Zy,"create YouTube captions from any video by transcribing audio with Wav2Vec2"),Zy.forEach(t),qh=s(Yp,". \u{1F30E}"),Yp.forEach(t),Ah=p(Kt),Rt=r(Kt,"LI",{});var Fi=i(Rt);Ei=r(Fi,"A",{href:!0});var Qy=i(Ei);zh=s(Qy,"Wav2Vec2ForCTC"),Qy.forEach(t),Mh=s(Fi," is supported by a notebook on "),Fs=r(Fi,"A",{href:!0,rel:!0});var Yy=i(Fs);Lh=s(Yy,"how to finetune a speech recognition model in English"),Yy.forEach(t),Oh=s(Fi,", and "),Es=r(Fi,"A",{href:!0,rel:!0});var ek=i(Es);Dh=s(ek,"how to finetune a speech recognition model in any language"),ek.forEach(t),Sh=s(Fi,"."),Fi.forEach(t),Kt.forEach(t),rp=p(o),Ci=r(o,"P",{});var tk=i(Ci);Ih=s(tk,"\u{1F680} Deploy"),tk.forEach(t),ip=p(o),Pi=r(o,"UL",{});var ok=i(Pi);Cs=r(ok,"LI",{});var em=i(Cs);Nh=s(em,"A blog post on how to deploy Wav2Vec2 for "),Ps=r(em,"A",{href:!0,rel:!0});var ak=i(Ps);Bh=s(ak,"Automatic Speech Recogntion with Hugging Face\u2019s Transformers & Amazon SageMaker"),ak.forEach(t),Rh=s(em,"."),em.forEach(t),ok.forEach(t),lp=p(o),lo=r(o,"H2",{class:!0});var tm=i(lo);Xo=r(tm,"A",{id:!0,class:!0,href:!0});var sk=i(Xo);Hl=r(sk,"SPAN",{});var nk=i(Hl);y(qs.$$.fragment,nk),nk.forEach(t),sk.forEach(t),Uh=p(tm),Xl=r(tm,"SPAN",{});var rk=i(Xl);Hh=s(rk,"Wav2Vec2Config"),rk.forEach(t),tm.forEach(t),cp=p(o),Ye=r(o,"DIV",{class:!0});var Qa=i(Ye);y(As.$$.fragment,Qa),Xh=p(Qa),co=r(Qa,"P",{});var xl=i(co);Gh=s(xl,"This is the configuration class to store the configuration of a "),qi=r(xl,"A",{href:!0});var ik=i(qi);Kh=s(ik,"Wav2Vec2Model"),ik.forEach(t),Jh=s(xl,`. It is used to instantiate an
Wav2Vec2 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 Wav2Vec2
`),zs=r(xl,"A",{href:!0,rel:!0});var lk=i(zs);Zh=s(lk,"facebook/wav2vec2-base-960h"),lk.forEach(t),Qh=s(xl," architecture."),xl.forEach(t),Yh=p(Qa),po=r(Qa,"P",{});var $l=i(po);eu=s($l,"Configuration objects inherit from "),Ai=r($l,"A",{href:!0});var ck=i(Ai);tu=s(ck,"PretrainedConfig"),ck.forEach(t),ou=s($l,` and can be used to control the model outputs. Read the
documentation from `),zi=r($l,"A",{href:!0});var dk=i(zi);au=s(dk,"PretrainedConfig"),dk.forEach(t),su=s($l," for more information."),$l.forEach(t),nu=p(Qa),y(Go.$$.fragment,Qa),Qa.forEach(t),dp=p(o),mo=r(o,"H2",{class:!0});var om=i(mo);Ko=r(om,"A",{id:!0,class:!0,href:!0});var pk=i(Ko);Gl=r(pk,"SPAN",{});var mk=i(Gl);y(Ms.$$.fragment,mk),mk.forEach(t),pk.forEach(t),ru=p(om),Kl=r(om,"SPAN",{});var hk=i(Kl);iu=s(hk,"Wav2Vec2CTCTokenizer"),hk.forEach(t),om.forEach(t),pp=p(o),ne=r(o,"DIV",{class:!0});var Be=i(ne);y(Ls.$$.fragment,Be),lu=p(Be),Jl=r(Be,"P",{});var uk=i(Jl);cu=s(uk,"Constructs a Wav2Vec2CTC tokenizer."),uk.forEach(t),du=p(Be),Os=r(Be,"P",{});var am=i(Os);pu=s(am,"This tokenizer inherits from "),Mi=r(am,"A",{href:!0});var fk=i(Mi);mu=s(fk,"PreTrainedTokenizer"),fk.forEach(t),hu=s(am,` which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.`),am.forEach(t),uu=p(Be),Jo=r(Be,"DIV",{class:!0});var sm=i(Jo);y(Ds.$$.fragment,sm),fu=p(sm),Zl=r(sm,"P",{});var gk=i(Zl);gu=s(gk,`Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of
sequences.`),gk.forEach(t),sm.forEach(t),_u=p(Be),Li=r(Be,"DIV",{class:!0});var _k=i(Li);y(Ss.$$.fragment,_k),_k.forEach(t),vu=p(Be),nt=r(Be,"DIV",{class:!0});var Ya=i(nt);y(Is.$$.fragment,Ya),bu=p(Ya),Ql=r(Ya,"P",{});var vk=i(Ql);wu=s(vk,`Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
tokens and clean up tokenization spaces.`),vk.forEach(t),yu=p(Ya),Ns=r(Ya,"P",{});var nm=i(Ns);ku=s(nm,"Similar to doing "),Yl=r(nm,"CODE",{});var bk=i(Yl);Tu=s(bk,"self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))"),bk.forEach(t),xu=s(nm,"."),nm.forEach(t),$u=p(Ya),y(Zo.$$.fragment,Ya),Ya.forEach(t),ju=p(Be),Qo=r(Be,"DIV",{class:!0});var rm=i(Qo);y(Bs.$$.fragment,rm),Wu=p(rm),ec=r(rm,"P",{});var wk=i(ec);Vu=s(wk,"Convert a list of lists of token ids into a list of strings by calling decode."),wk.forEach(t),rm.forEach(t),Be.forEach(t),mp=p(o),ho=r(o,"H2",{class:!0});var im=i(ho);Yo=r(im,"A",{id:!0,class:!0,href:!0});var yk=i(Yo);tc=r(yk,"SPAN",{});var kk=i(tc);y(Rs.$$.fragment,kk),kk.forEach(t),yk.forEach(t),Fu=p(im),oc=r(im,"SPAN",{});var Tk=i(oc);Eu=s(Tk,"Wav2Vec2FeatureExtractor"),Tk.forEach(t),im.forEach(t),hp=p(o),et=r(o,"DIV",{class:!0});var es=i(et);y(Us.$$.fragment,es),Cu=p(es),ac=r(es,"P",{});var xk=i(ac);Pu=s(xk,"Constructs a Wav2Vec2 feature extractor."),xk.forEach(t),qu=p(es),Hs=r(es,"P",{});var lm=i(Hs);Au=s(lm,"This feature extractor inherits from "),Oi=r(lm,"A",{href:!0});var $k=i(Oi);zu=s($k,"SequenceFeatureExtractor"),$k.forEach(t),Mu=s(lm,` which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.`),lm.forEach(t),Lu=p(es),ea=r(es,"DIV",{class:!0});var cm=i(ea);y(Xs.$$.fragment,cm),Ou=p(cm),sc=r(cm,"P",{});var jk=i(sc);Du=s(jk,"Main method to featurize and prepare for the model one or several sequence(s)."),jk.forEach(t),cm.forEach(t),es.forEach(t),up=p(o),uo=r(o,"H2",{class:!0});var dm=i(uo);ta=r(dm,"A",{id:!0,class:!0,href:!0});var Wk=i(ta);nc=r(Wk,"SPAN",{});var Vk=i(nc);y(Gs.$$.fragment,Vk),Vk.forEach(t),Wk.forEach(t),Su=p(dm),rc=r(dm,"SPAN",{});var Fk=i(rc);Iu=s(Fk,"Wav2Vec2Processor"),Fk.forEach(t),dm.forEach(t),fp=p(o),G=r(o,"DIV",{class:!0});var me=i(G);y(Ks.$$.fragment,me),Nu=p(me),ic=r(me,"P",{});var Ek=i(ic);Bu=s(Ek,`Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor and a Wav2Vec2 CTC tokenizer into a single
processor.`),Ek.forEach(t),Ru=p(me),Ne=r(me,"P",{});var St=i(Ne);Di=r(St,"A",{href:!0});var Ck=i(Di);Uu=s(Ck,"Wav2Vec2Processor"),Ck.forEach(t),Hu=s(St," offers all the functionalities of "),Si=r(St,"A",{href:!0});var Pk=i(Si);Xu=s(Pk,"Wav2Vec2FeatureExtractor"),Pk.forEach(t),Gu=s(St," and "),Ii=r(St,"A",{href:!0});var qk=i(Ii);Ku=s(qk,"PreTrainedTokenizer"),qk.forEach(t),Ju=s(St,`.
See the docstring of `),Js=r(St,"A",{href:!0});var Iy=i(Js);lc=r(Iy,"STRONG",{});var Ak=i(lc);Zu=s(Ak,"call"),Ak.forEach(t),Qu=s(Iy,"()"),Iy.forEach(t),Yu=s(St," and "),Ni=r(St,"A",{href:!0});var zk=i(Ni);ef=s(zk,"decode()"),zk.forEach(t),tf=s(St," for more information."),St.forEach(t),of=p(me),oa=r(me,"DIV",{class:!0});var pm=i(oa);y(Zs.$$.fragment,pm),af=p(pm),Ct=r(pm,"P",{});var ts=i(Ct);sf=s(ts,`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Qs=r(ts,"A",{href:!0});var Ny=i(Qs);cc=r(Ny,"STRONG",{});var Mk=i(cc);nf=s(Mk,"call"),Mk.forEach(t),rf=s(Ny,"()"),Ny.forEach(t),lf=s(ts,` and returns its output. If used in the context
`),dc=r(ts,"CODE",{});var Lk=i(dc);cf=s(Lk,"as_target_processor()"),Lk.forEach(t),df=s(ts,` this method forwards all its arguments to PreTrainedTokenizer\u2019s
`),Ys=r(ts,"A",{href:!0});var By=i(Ys);pc=r(By,"STRONG",{});var Ok=i(pc);pf=s(Ok,"call"),Ok.forEach(t),mf=s(By,"()"),By.forEach(t),hf=s(ts,". Please refer to the docstring of the above two methods for more information."),ts.forEach(t),pm.forEach(t),uf=p(me),aa=r(me,"DIV",{class:!0});var mm=i(aa);y(en.$$.fragment,mm),ff=p(mm),Pt=r(mm,"P",{});var os=i(Pt);gf=s(os,`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Bi=r(os,"A",{href:!0});var Dk=i(Bi);_f=s(Dk,"pad()"),Dk.forEach(t),vf=s(os,` and returns its output. If used in the context
`),mc=r(os,"CODE",{});var Sk=i(mc);bf=s(Sk,"as_target_processor()"),Sk.forEach(t),wf=s(os,` this method forwards all its arguments to PreTrainedTokenizer\u2019s
`),Ri=r(os,"A",{href:!0});var Ik=i(Ri);yf=s(Ik,"pad()"),Ik.forEach(t),kf=s(os,". Please refer to the docstring of the above two methods for more information."),os.forEach(t),mm.forEach(t),Tf=p(me),Ui=r(me,"DIV",{class:!0});var Nk=i(Ui);y(tn.$$.fragment,Nk),Nk.forEach(t),xf=p(me),Ut=r(me,"DIV",{class:!0});var jl=i(Ut);y(on.$$.fragment,jl),$f=p(jl),an=r(jl,"P",{});var hm=i(an);jf=s(hm,`Saves the attributes of this processor (feature extractor, tokenizer\u2026) in the specified directory so that it
can be reloaded using the `),Hi=r(hm,"A",{href:!0});var Bk=i(Hi);Wf=s(Bk,"from_pretrained()"),Bk.forEach(t),Vf=s(hm," method."),hm.forEach(t),Ff=p(jl),y(sa.$$.fragment,jl),jl.forEach(t),Ef=p(me),na=r(me,"DIV",{class:!0});var um=i(na);y(sn.$$.fragment,um),Cf=p(um),nn=r(um,"P",{});var fm=i(nn);Pf=s(fm,"This method forwards all its arguments to PreTrainedTokenizer\u2019s "),Xi=r(fm,"A",{href:!0});var Rk=i(Xi);qf=s(Rk,"batch_decode()"),Rk.forEach(t),Af=s(fm,`. Please
refer to the docstring of this method for more information.`),fm.forEach(t),um.forEach(t),zf=p(me),ra=r(me,"DIV",{class:!0});var gm=i(ra);y(rn.$$.fragment,gm),Mf=p(gm),ln=r(gm,"P",{});var _m=i(ln);Lf=s(_m,"This method forwards all its arguments to PreTrainedTokenizer\u2019s "),Gi=r(_m,"A",{href:!0});var Uk=i(Gi);Of=s(Uk,"decode()"),Uk.forEach(t),Df=s(_m,`. Please refer
to the docstring of this method for more information.`),_m.forEach(t),gm.forEach(t),me.forEach(t),gp=p(o),fo=r(o,"H2",{class:!0});var vm=i(fo);ia=r(vm,"A",{id:!0,class:!0,href:!0});var Hk=i(ia);hc=r(Hk,"SPAN",{});var Xk=i(hc);y(cn.$$.fragment,Xk),Xk.forEach(t),Hk.forEach(t),Sf=p(vm),uc=r(vm,"SPAN",{});var Gk=i(uc);If=s(Gk,"Wav2Vec2ProcessorWithLM"),Gk.forEach(t),vm.forEach(t),_p=p(o),te=r(o,"DIV",{class:!0});var Te=i(te);y(dn.$$.fragment,Te),Nf=p(Te),fc=r(Te,"P",{});var Kk=i(fc);Bf=s(Kk,`Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor, a Wav2Vec2 CTC tokenizer and a decoder
with language model support into a single processor for language model boosted speech recognition decoding.`),Kk.forEach(t),Rf=p(Te),la=r(Te,"DIV",{class:!0});var bm=i(la);y(pn.$$.fragment,bm),Uf=p(bm),qt=r(bm,"P",{});var as=i(qt);Hf=s(as,`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),mn=r(as,"A",{href:!0});var Ry=i(mn);gc=r(Ry,"STRONG",{});var Jk=i(gc);Xf=s(Jk,"call"),Jk.forEach(t),Gf=s(Ry,"()"),Ry.forEach(t),Kf=s(as,` and returns its output. If used in the context
`),_c=r(as,"CODE",{});var Zk=i(_c);Jf=s(Zk,"as_target_processor()"),Zk.forEach(t),Zf=s(as,` this method forwards all its arguments to
Wav2Vec2CTCTokenizer\u2019s `),hn=r(as,"A",{href:!0});var Uy=i(hn);vc=r(Uy,"STRONG",{});var Qk=i(vc);Qf=s(Qk,"call"),Qk.forEach(t),Yf=s(Uy,"()"),Uy.forEach(t),eg=s(as,`. Please refer to the docstring of the above two
methods for more information.`),as.forEach(t),bm.forEach(t),tg=p(Te),ca=r(Te,"DIV",{class:!0});var wm=i(ca);y(un.$$.fragment,wm),og=p(wm),At=r(wm,"P",{});var ss=i(At);ag=s(ss,`When used in normal mode, this method forwards all its arguments to Wav2Vec2FeatureExtractor\u2019s
`),Ki=r(ss,"A",{href:!0});var Yk=i(Ki);sg=s(Yk,"pad()"),Yk.forEach(t),ng=s(ss,` and returns its output. If used in the context
`),bc=r(ss,"CODE",{});var e0=i(bc);rg=s(e0,"as_target_processor()"),e0.forEach(t),ig=s(ss,` this method forwards all its arguments to
Wav2Vec2CTCTokenizer\u2019s `),Ji=r(ss,"A",{href:!0});var t0=i(Ji);lg=s(t0,"pad()"),t0.forEach(t),cg=s(ss,`. Please refer to the docstring of the above two methods
for more information.`),ss.forEach(t),wm.forEach(t),dg=p(Te),Ht=r(Te,"DIV",{class:!0});var Wl=i(Ht);y(fn.$$.fragment,Wl),pg=p(Wl),gn=r(Wl,"P",{});var ym=i(gn);mg=s(ym,"Instantiate a "),Zi=r(ym,"A",{href:!0});var o0=i(Zi);hg=s(o0,"Wav2Vec2ProcessorWithLM"),o0.forEach(t),ug=s(ym," from a pretrained Wav2Vec2 processor."),ym.forEach(t),fg=p(Wl),y(da.$$.fragment,Wl),Wl.forEach(t),gg=p(Te),Qi=r(Te,"DIV",{class:!0});var a0=i(Qi);y(_n.$$.fragment,a0),a0.forEach(t),_g=p(Te),rt=r(Te,"DIV",{class:!0});var ns=i(rt);y(vn.$$.fragment,ns),vg=p(ns),wc=r(ns,"P",{});var s0=i(wc);bg=s(s0,"Batch decode output logits to audio transcription with language model support."),s0.forEach(t),wg=p(ns),y(pa.$$.fragment,ns),yg=p(ns),bn=r(ns,"P",{});var km=i(bn);kg=s(km,`Example:
See `),Yi=r(km,"A",{href:!0});var n0=i(Yi);Tg=s(n0,"Decoding multiple audios"),n0.forEach(t),xg=s(km,"."),km.forEach(t),ns.forEach(t),$g=p(Te),Xt=r(Te,"DIV",{class:!0});var Vl=i(Xt);y(wn.$$.fragment,Vl),jg=p(Vl),yc=r(Vl,"P",{});var r0=i(yc);Wg=s(r0,"Decode output logits to audio transcription with language model support."),r0.forEach(t),Vg=p(Vl),y(ma.$$.fragment,Vl),Vl.forEach(t),Te.forEach(t),vp=p(o),go=r(o,"H3",{class:!0});var Tm=i(go);ha=r(Tm,"A",{id:!0,class:!0,href:!0});var i0=i(ha);kc=r(i0,"SPAN",{});var l0=i(kc);y(yn.$$.fragment,l0),l0.forEach(t),i0.forEach(t),Fg=p(Tm),Tc=r(Tm,"SPAN",{});var c0=i(Tc);Eg=s(c0,"Decoding multiple audios"),c0.forEach(t),Tm.forEach(t),bp=p(o),ke=r(o,"P",{});var vt=i(ke);Cg=s(vt,"If you are planning to decode multiple batches of audios, you should consider using "),el=r(vt,"A",{href:!0});var d0=i(el);Pg=s(d0,"batch_decode()"),d0.forEach(t),qg=s(vt," and passing an instantiated "),xc=r(vt,"CODE",{});var p0=i(xc);Ag=s(p0,"multiprocessing.Pool"),p0.forEach(t),zg=s(vt,`.
Otherwise, `),tl=r(vt,"A",{href:!0});var m0=i(tl);Mg=s(m0,"batch_decode()"),m0.forEach(t),Lg=s(vt," performance will be slower than calling "),ol=r(vt,"A",{href:!0});var h0=i(ol);Og=s(h0,"decode()"),h0.forEach(t),Dg=s(vt," for each audio individually, as it internally instantiates a new "),$c=r(vt,"CODE",{});var u0=i($c);Sg=s(u0,"Pool"),u0.forEach(t),Ig=s(vt," for every call. See the example below:"),vt.forEach(t),wp=p(o),y(kn.$$.fragment,o),yp=p(o),_o=r(o,"H2",{class:!0});var xm=i(_o);ua=r(xm,"A",{id:!0,class:!0,href:!0});var f0=i(ua);jc=r(f0,"SPAN",{});var g0=i(jc);y(Tn.$$.fragment,g0),g0.forEach(t),f0.forEach(t),Ng=p(xm),Wc=r(xm,"SPAN",{});var _0=i(Wc);Bg=s(_0,"Wav2Vec2 specific outputs"),_0.forEach(t),xm.forEach(t),kp=p(o),vo=r(o,"DIV",{class:!0});var $m=i(vo);y(xn.$$.fragment,$m),Rg=p($m),$n=r($m,"P",{});var jm=i($n);Ug=s(jm,"Output type of "),Vc=r(jm,"CODE",{});var v0=i(Vc);Hg=s(v0,"Wav2Vec2DecoderWithLM"),v0.forEach(t),Xg=s(jm,", with transcription."),jm.forEach(t),$m.forEach(t),Tp=p(o),bo=r(o,"DIV",{class:!0});var Wm=i(bo);y(jn.$$.fragment,Wm),Gg=p(Wm),Fc=r(Wm,"P",{});var b0=i(Fc);Kg=s(b0,"Base class for models that have been trained with the Wav2Vec2 loss objective."),b0.forEach(t),Wm.forEach(t),xp=p(o),wo=r(o,"DIV",{class:!0});var Vm=i(wo);y(Wn.$$.fragment,Vm),Jg=p(Vm),Vn=r(Vm,"P",{});var Fm=i(Vn);Zg=s(Fm,"Output type of "),al=r(Fm,"A",{href:!0});var w0=i(al);Qg=s(w0,"Wav2Vec2ForPreTraining"),w0.forEach(t),Yg=s(Fm,", with potential hidden states and attentions."),Fm.forEach(t),Vm.forEach(t),$p=p(o),zt=r(o,"DIV",{class:!0});var Fl=i(zt);y(Fn.$$.fragment,Fl),e_=p(Fl),En=r(Fl,"P",{});var Em=i(En);t_=s(Em,"Output type of "),Ec=r(Em,"CODE",{});var y0=i(Ec);o_=s(y0,"FlaxWav2Vec2BaseModelOutput"),y0.forEach(t),a_=s(Em,", with potential hidden states and attentions."),Em.forEach(t),s_=p(Fl),fa=r(Fl,"DIV",{class:!0});var Cm=i(fa);y(Cn.$$.fragment,Cm),n_=p(Cm),Cc=r(Cm,"P",{});var k0=i(Cc);r_=s(k0,"\u201CReturns a new object replacing the specified fields with new values."),k0.forEach(t),Cm.forEach(t),Fl.forEach(t),jp=p(o),Mt=r(o,"DIV",{class:!0});var El=i(Mt);y(Pn.$$.fragment,El),i_=p(El),qn=r(El,"P",{});var Pm=i(qn);l_=s(Pm,"Output type of "),Pc=r(Pm,"CODE",{});var T0=i(Pc);c_=s(T0,"FlaxWav2Vec2ForPreTrainingOutput"),T0.forEach(t),d_=s(Pm,", with potential hidden states and attentions."),Pm.forEach(t),p_=p(El),ga=r(El,"DIV",{class:!0});var qm=i(ga);y(An.$$.fragment,qm),m_=p(qm),qc=r(qm,"P",{});var x0=i(qc);h_=s(x0,"\u201CReturns a new object replacing the specified fields with new values."),x0.forEach(t),qm.forEach(t),El.forEach(t),Wp=p(o),yo=r(o,"H2",{class:!0});var Am=i(yo);_a=r(Am,"A",{id:!0,class:!0,href:!0});var $0=i(_a);Ac=r($0,"SPAN",{});var j0=i(Ac);y(zn.$$.fragment,j0),j0.forEach(t),$0.forEach(t),u_=p(Am),zc=r(Am,"SPAN",{});var W0=i(zc);f_=s(W0,"Wav2Vec2Model"),W0.forEach(t),Am.forEach(t),Vp=p(o),qe=r(o,"DIV",{class:!0});var Jt=i(qe);y(Mn.$$.fragment,Jt),g_=p(Jt),Ln=r(Jt,"P",{});var zm=i(Ln);__=s(zm,`The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
Wav2Vec2 was proposed in `),On=r(zm,"A",{href:!0,rel:!0});var V0=i(On);v_=s(V0,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),V0.forEach(t),b_=s(zm,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),zm.forEach(t),w_=p(Jt),Dn=r(Jt,"P",{});var Mm=i(Dn);y_=s(Mm,"This model inherits from "),sl=r(Mm,"A",{href:!0});var F0=i(sl);k_=s(F0,"PreTrainedModel"),F0.forEach(t),T_=s(Mm,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Mm.forEach(t),x_=p(Jt),Sn=r(Jt,"P",{});var Lm=i(Sn);$_=s(Lm,"This model is a PyTorch "),In=r(Lm,"A",{href:!0,rel:!0});var E0=i(In);j_=s(E0,"torch.nn.Module"),E0.forEach(t),W_=s(Lm,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Lm.forEach(t),V_=p(Jt),it=r(Jt,"DIV",{class:!0});var rs=i(it);y(Nn.$$.fragment,rs),F_=p(rs),ko=r(rs,"P",{});var Cl=i(ko);E_=s(Cl,"The "),nl=r(Cl,"A",{href:!0});var C0=i(nl);C_=s(C0,"Wav2Vec2Model"),C0.forEach(t),P_=s(Cl," forward method, overrides the "),Mc=r(Cl,"CODE",{});var P0=i(Mc);q_=s(P0,"__call__"),P0.forEach(t),A_=s(Cl," special method."),Cl.forEach(t),z_=p(rs),y(va.$$.fragment,rs),M_=p(rs),y(ba.$$.fragment,rs),rs.forEach(t),Jt.forEach(t),Fp=p(o),To=r(o,"H2",{class:!0});var Om=i(To);wa=r(Om,"A",{id:!0,class:!0,href:!0});var q0=i(wa);Lc=r(q0,"SPAN",{});var A0=i(Lc);y(Bn.$$.fragment,A0),A0.forEach(t),q0.forEach(t),L_=p(Om),Oc=r(Om,"SPAN",{});var z0=i(Oc);O_=s(z0,"Wav2Vec2ForCTC"),z0.forEach(t),Om.forEach(t),Ep=p(o),Ae=r(o,"DIV",{class:!0});var Zt=i(Ae);y(Rn.$$.fragment,Zt),D_=p(Zt),xo=r(Zt,"P",{});var Pl=i(xo);S_=s(Pl,"Wav2Vec2 Model with a "),Dc=r(Pl,"CODE",{});var M0=i(Dc);I_=s(M0,"language modeling"),M0.forEach(t),N_=s(Pl,` head on top for Connectionist Temporal Classification (CTC).
Wav2Vec2 was proposed in `),Un=r(Pl,"A",{href:!0,rel:!0});var L0=i(Un);B_=s(L0,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),L0.forEach(t),R_=s(Pl,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Pl.forEach(t),U_=p(Zt),Hn=r(Zt,"P",{});var Dm=i(Hn);H_=s(Dm,"This model inherits from "),rl=r(Dm,"A",{href:!0});var O0=i(rl);X_=s(O0,"PreTrainedModel"),O0.forEach(t),G_=s(Dm,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Dm.forEach(t),K_=p(Zt),Xn=r(Zt,"P",{});var Sm=i(Xn);J_=s(Sm,"This model is a PyTorch "),Gn=r(Sm,"A",{href:!0,rel:!0});var D0=i(Gn);Z_=s(D0,"torch.nn.Module"),D0.forEach(t),Q_=s(Sm,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Sm.forEach(t),Y_=p(Zt),lt=r(Zt,"DIV",{class:!0});var is=i(lt);y(Kn.$$.fragment,is),ev=p(is),$o=r(is,"P",{});var ql=i($o);tv=s(ql,"The "),il=r(ql,"A",{href:!0});var S0=i(il);ov=s(S0,"Wav2Vec2ForCTC"),S0.forEach(t),av=s(ql," forward method, overrides the "),Sc=r(ql,"CODE",{});var I0=i(Sc);sv=s(I0,"__call__"),I0.forEach(t),nv=s(ql," special method."),ql.forEach(t),rv=p(is),y(ya.$$.fragment,is),iv=p(is),y(ka.$$.fragment,is),is.forEach(t),Zt.forEach(t),Cp=p(o),jo=r(o,"H2",{class:!0});var Im=i(jo);Ta=r(Im,"A",{id:!0,class:!0,href:!0});var N0=i(Ta);Ic=r(N0,"SPAN",{});var B0=i(Ic);y(Jn.$$.fragment,B0),B0.forEach(t),N0.forEach(t),lv=p(Im),Nc=r(Im,"SPAN",{});var R0=i(Nc);cv=s(R0,"Wav2Vec2ForSequenceClassification"),R0.forEach(t),Im.forEach(t),Pp=p(o),fe=r(o,"DIV",{class:!0});var bt=i(fe);y(Zn.$$.fragment,bt),dv=p(bt),Bc=r(bt,"P",{});var U0=i(Bc);pv=s(U0,`Wav2Vec2 Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),U0.forEach(t),mv=p(bt),Qn=r(bt,"P",{});var Nm=i(Qn);hv=s(Nm,"Wav2Vec2 was proposed in "),Yn=r(Nm,"A",{href:!0,rel:!0});var H0=i(Yn);uv=s(H0,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),H0.forEach(t),fv=s(Nm,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Nm.forEach(t),gv=p(bt),er=r(bt,"P",{});var Bm=i(er);_v=s(Bm,"This model inherits from "),ll=r(Bm,"A",{href:!0});var X0=i(ll);vv=s(X0,"PreTrainedModel"),X0.forEach(t),bv=s(Bm,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Bm.forEach(t),wv=p(bt),tr=r(bt,"P",{});var Rm=i(tr);yv=s(Rm,"This model is a PyTorch "),or=r(Rm,"A",{href:!0,rel:!0});var G0=i(or);kv=s(G0,"torch.nn.Module"),G0.forEach(t),Tv=s(Rm,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rm.forEach(t),xv=p(bt),ct=r(bt,"DIV",{class:!0});var ls=i(ct);y(ar.$$.fragment,ls),$v=p(ls),Wo=r(ls,"P",{});var Al=i(Wo);jv=s(Al,"The "),cl=r(Al,"A",{href:!0});var K0=i(cl);Wv=s(K0,"Wav2Vec2ForSequenceClassification"),K0.forEach(t),Vv=s(Al," forward method, overrides the "),Rc=r(Al,"CODE",{});var J0=i(Rc);Fv=s(J0,"__call__"),J0.forEach(t),Ev=s(Al," special method."),Al.forEach(t),Cv=p(ls),y(xa.$$.fragment,ls),Pv=p(ls),y($a.$$.fragment,ls),ls.forEach(t),bt.forEach(t),qp=p(o),Vo=r(o,"H2",{class:!0});var Um=i(Vo);ja=r(Um,"A",{id:!0,class:!0,href:!0});var Z0=i(ja);Uc=r(Z0,"SPAN",{});var Q0=i(Uc);y(sr.$$.fragment,Q0),Q0.forEach(t),Z0.forEach(t),qv=p(Um),Hc=r(Um,"SPAN",{});var Y0=i(Hc);Av=s(Y0,"Wav2Vec2ForAudioFrameClassification"),Y0.forEach(t),Um.forEach(t),Ap=p(o),ge=r(o,"DIV",{class:!0});var wt=i(ge);y(nr.$$.fragment,wt),zv=p(wt),Xc=r(wt,"P",{});var e1=i(Xc);Mv=s(e1,"Wav2Vec2 Model with a frame classification head on top for tasks like Speaker Diarization."),e1.forEach(t),Lv=p(wt),rr=r(wt,"P",{});var Hm=i(rr);Ov=s(Hm,"Wav2Vec2 was proposed in "),ir=r(Hm,"A",{href:!0,rel:!0});var t1=i(ir);Dv=s(t1,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),t1.forEach(t),Sv=s(Hm,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Hm.forEach(t),Iv=p(wt),lr=r(wt,"P",{});var Xm=i(lr);Nv=s(Xm,"This model inherits from "),dl=r(Xm,"A",{href:!0});var o1=i(dl);Bv=s(o1,"PreTrainedModel"),o1.forEach(t),Rv=s(Xm,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Xm.forEach(t),Uv=p(wt),cr=r(wt,"P",{});var Gm=i(cr);Hv=s(Gm,"This model is a PyTorch "),dr=r(Gm,"A",{href:!0,rel:!0});var a1=i(dr);Xv=s(a1,"torch.nn.Module"),a1.forEach(t),Gv=s(Gm,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Gm.forEach(t),Kv=p(wt),dt=r(wt,"DIV",{class:!0});var cs=i(dt);y(pr.$$.fragment,cs),Jv=p(cs),Fo=r(cs,"P",{});var zl=i(Fo);Zv=s(zl,"The "),pl=r(zl,"A",{href:!0});var s1=i(pl);Qv=s(s1,"Wav2Vec2ForAudioFrameClassification"),s1.forEach(t),Yv=s(zl," forward method, overrides the "),Gc=r(zl,"CODE",{});var n1=i(Gc);e2=s(n1,"__call__"),n1.forEach(t),t2=s(zl," special method."),zl.forEach(t),o2=p(cs),y(Wa.$$.fragment,cs),a2=p(cs),y(Va.$$.fragment,cs),cs.forEach(t),wt.forEach(t),zp=p(o),Eo=r(o,"H2",{class:!0});var Km=i(Eo);Fa=r(Km,"A",{id:!0,class:!0,href:!0});var r1=i(Fa);Kc=r(r1,"SPAN",{});var i1=i(Kc);y(mr.$$.fragment,i1),i1.forEach(t),r1.forEach(t),s2=p(Km),Jc=r(Km,"SPAN",{});var l1=i(Jc);n2=s(l1,"Wav2Vec2ForXVector"),l1.forEach(t),Km.forEach(t),Mp=p(o),_e=r(o,"DIV",{class:!0});var yt=i(_e);y(hr.$$.fragment,yt),r2=p(yt),Zc=r(yt,"P",{});var c1=i(Zc);i2=s(c1,"Wav2Vec2 Model with an XVector feature extraction head on top for tasks like Speaker Verification."),c1.forEach(t),l2=p(yt),ur=r(yt,"P",{});var Jm=i(ur);c2=s(Jm,"Wav2Vec2 was proposed in "),fr=r(Jm,"A",{href:!0,rel:!0});var d1=i(fr);d2=s(d1,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),d1.forEach(t),p2=s(Jm,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Jm.forEach(t),m2=p(yt),gr=r(yt,"P",{});var Zm=i(gr);h2=s(Zm,"This model inherits from "),ml=r(Zm,"A",{href:!0});var p1=i(ml);u2=s(p1,"PreTrainedModel"),p1.forEach(t),f2=s(Zm,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Zm.forEach(t),g2=p(yt),_r=r(yt,"P",{});var Qm=i(_r);_2=s(Qm,"This model is a PyTorch "),vr=r(Qm,"A",{href:!0,rel:!0});var m1=i(vr);v2=s(m1,"torch.nn.Module"),m1.forEach(t),b2=s(Qm,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Qm.forEach(t),w2=p(yt),pt=r(yt,"DIV",{class:!0});var ds=i(pt);y(br.$$.fragment,ds),y2=p(ds),Co=r(ds,"P",{});var Ml=i(Co);k2=s(Ml,"The "),hl=r(Ml,"A",{href:!0});var h1=i(hl);T2=s(h1,"Wav2Vec2ForXVector"),h1.forEach(t),x2=s(Ml," forward method, overrides the "),Qc=r(Ml,"CODE",{});var u1=i(Qc);$2=s(u1,"__call__"),u1.forEach(t),j2=s(Ml," special method."),Ml.forEach(t),W2=p(ds),y(Ea.$$.fragment,ds),V2=p(ds),y(Ca.$$.fragment,ds),ds.forEach(t),yt.forEach(t),Lp=p(o),Po=r(o,"H2",{class:!0});var Ym=i(Po);Pa=r(Ym,"A",{id:!0,class:!0,href:!0});var f1=i(Pa);Yc=r(f1,"SPAN",{});var g1=i(Yc);y(wr.$$.fragment,g1),g1.forEach(t),f1.forEach(t),F2=p(Ym),ed=r(Ym,"SPAN",{});var _1=i(ed);E2=s(_1,"Wav2Vec2ForPreTraining"),_1.forEach(t),Ym.forEach(t),Op=p(o),ze=r(o,"DIV",{class:!0});var Qt=i(ze);y(yr.$$.fragment,Qt),C2=p(Qt),qo=r(Qt,"P",{});var Ll=i(qo);P2=s(Ll,"Wav2Vec2 Model with a quantizer and "),td=r(Ll,"CODE",{});var v1=i(td);q2=s(v1,"VQ"),v1.forEach(t),A2=s(Ll,` head on top.
Wav2Vec2 was proposed in `),kr=r(Ll,"A",{href:!0,rel:!0});var b1=i(kr);z2=s(b1,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),b1.forEach(t),M2=s(Ll,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Ll.forEach(t),L2=p(Qt),Tr=r(Qt,"P",{});var eh=i(Tr);O2=s(eh,"This model inherits from "),ul=r(eh,"A",{href:!0});var w1=i(ul);D2=s(w1,"PreTrainedModel"),w1.forEach(t),S2=s(eh,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),eh.forEach(t),I2=p(Qt),xr=r(Qt,"P",{});var th=i(xr);N2=s(th,"This model is a PyTorch "),$r=r(th,"A",{href:!0,rel:!0});var y1=i($r);B2=s(y1,"torch.nn.Module"),y1.forEach(t),R2=s(th,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),th.forEach(t),U2=p(Qt),mt=r(Qt,"DIV",{class:!0});var ps=i(mt);y(jr.$$.fragment,ps),H2=p(ps),Ao=r(ps,"P",{});var Ol=i(Ao);X2=s(Ol,"The "),fl=r(Ol,"A",{href:!0});var k1=i(fl);G2=s(k1,"Wav2Vec2ForPreTraining"),k1.forEach(t),K2=s(Ol," forward method, overrides the "),od=r(Ol,"CODE",{});var T1=i(od);J2=s(T1,"__call__"),T1.forEach(t),Z2=s(Ol," special method."),Ol.forEach(t),Q2=p(ps),y(qa.$$.fragment,ps),Y2=p(ps),y(Aa.$$.fragment,ps),ps.forEach(t),Qt.forEach(t),Dp=p(o),zo=r(o,"H2",{class:!0});var oh=i(zo);za=r(oh,"A",{id:!0,class:!0,href:!0});var x1=i(za);ad=r(x1,"SPAN",{});var $1=i(ad);y(Wr.$$.fragment,$1),$1.forEach(t),x1.forEach(t),eb=p(oh),sd=r(oh,"SPAN",{});var j1=i(sd);tb=s(j1,"TFWav2Vec2Model"),j1.forEach(t),oh.forEach(t),Sp=p(o),ve=r(o,"DIV",{class:!0});var kt=i(ve);y(Vr.$$.fragment,kt),ob=p(kt),nd=r(kt,"P",{});var W1=i(nd);ab=s(W1,"The bare TFWav2Vec2 Model transformer outputing raw hidden-states without any specific head on top."),W1.forEach(t),sb=p(kt),Fr=r(kt,"P",{});var ah=i(Fr);nb=s(ah,"This model inherits from "),gl=r(ah,"A",{href:!0});var V1=i(gl);rb=s(V1,"TFPreTrainedModel"),V1.forEach(t),ib=s(ah,`. 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.)`),ah.forEach(t),lb=p(kt),Er=r(kt,"P",{});var sh=i(Er);cb=s(sh,"This model is also a "),Cr=r(sh,"A",{href:!0,rel:!0});var F1=i(Cr);db=s(F1,"tf.keras.Model"),F1.forEach(t),pb=s(sh,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),sh.forEach(t),mb=p(kt),y(Ma.$$.fragment,kt),hb=p(kt),ht=r(kt,"DIV",{class:!0});var ms=i(ht);y(Pr.$$.fragment,ms),ub=p(ms),Mo=r(ms,"P",{});var Dl=i(Mo);fb=s(Dl,"The "),_l=r(Dl,"A",{href:!0});var E1=i(_l);gb=s(E1,"TFWav2Vec2Model"),E1.forEach(t),_b=s(Dl," forward method, overrides the "),rd=r(Dl,"CODE",{});var C1=i(rd);vb=s(C1,"__call__"),C1.forEach(t),bb=s(Dl," special method."),Dl.forEach(t),wb=p(ms),y(La.$$.fragment,ms),yb=p(ms),y(Oa.$$.fragment,ms),ms.forEach(t),kt.forEach(t),Ip=p(o),Lo=r(o,"H2",{class:!0});var nh=i(Lo);Da=r(nh,"A",{id:!0,class:!0,href:!0});var P1=i(Da);id=r(P1,"SPAN",{});var q1=i(id);y(qr.$$.fragment,q1),q1.forEach(t),P1.forEach(t),kb=p(nh),ld=r(nh,"SPAN",{});var A1=i(ld);Tb=s(A1,"TFWav2Vec2ForCTC"),A1.forEach(t),nh.forEach(t),Np=p(o),be=r(o,"DIV",{class:!0});var Tt=i(be);y(Ar.$$.fragment,Tt),xb=p(Tt),zr=r(Tt,"P",{});var rh=i(zr);$b=s(rh,"TFWav2Vec2 Model with a "),cd=r(rh,"CODE",{});var z1=i(cd);jb=s(z1,"language modeling"),z1.forEach(t),Wb=s(rh," head on top for Connectionist Temporal Classification (CTC)."),rh.forEach(t),Vb=p(Tt),Mr=r(Tt,"P",{});var ih=i(Mr);Fb=s(ih,"This model inherits from "),vl=r(ih,"A",{href:!0});var M1=i(vl);Eb=s(M1,"TFPreTrainedModel"),M1.forEach(t),Cb=s(ih,`. 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.)`),ih.forEach(t),Pb=p(Tt),Lr=r(Tt,"P",{});var lh=i(Lr);qb=s(lh,"This model is also a "),Or=r(lh,"A",{href:!0,rel:!0});var L1=i(Or);Ab=s(L1,"tf.keras.Model"),L1.forEach(t),zb=s(lh,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),lh.forEach(t),Mb=p(Tt),y(Sa.$$.fragment,Tt),Lb=p(Tt),ut=r(Tt,"DIV",{class:!0});var hs=i(ut);y(Dr.$$.fragment,hs),Ob=p(hs),Oo=r(hs,"P",{});var Sl=i(Oo);Db=s(Sl,"The "),bl=r(Sl,"A",{href:!0});var O1=i(bl);Sb=s(O1,"TFWav2Vec2ForCTC"),O1.forEach(t),Ib=s(Sl," forward method, overrides the "),dd=r(Sl,"CODE",{});var D1=i(dd);Nb=s(D1,"__call__"),D1.forEach(t),Bb=s(Sl," special method."),Sl.forEach(t),Rb=p(hs),y(Ia.$$.fragment,hs),Ub=p(hs),y(Na.$$.fragment,hs),hs.forEach(t),Tt.forEach(t),Bp=p(o),Do=r(o,"H2",{class:!0});var ch=i(Do);Ba=r(ch,"A",{id:!0,class:!0,href:!0});var S1=i(Ba);pd=r(S1,"SPAN",{});var I1=i(pd);y(Sr.$$.fragment,I1),I1.forEach(t),S1.forEach(t),Hb=p(ch),md=r(ch,"SPAN",{});var N1=i(md);Xb=s(N1,"FlaxWav2Vec2Model"),N1.forEach(t),ch.forEach(t),Rp=p(o),re=r(o,"DIV",{class:!0});var Re=i(re);y(Ir.$$.fragment,Re),Gb=p(Re),Nr=r(Re,"P",{});var dh=i(Nr);Kb=s(dh,`The bare Wav2Vec2 Model transformer outputting raw hidden-states without any specific head on top.
Wav2Vec2 was proposed in `),Br=r(dh,"A",{href:!0,rel:!0});var B1=i(Br);Jb=s(B1,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),B1.forEach(t),Zb=s(dh,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),dh.forEach(t),Qb=p(Re),Rr=r(Re,"P",{});var ph=i(Rr);Yb=s(ph,"This model inherits from "),wl=r(ph,"A",{href:!0});var R1=i(wl);ew=s(R1,"FlaxPreTrainedModel"),R1.forEach(t),tw=s(ph,`. 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.)`),ph.forEach(t),ow=p(Re),Ur=r(Re,"P",{});var mh=i(Ur);aw=s(mh,`This model is also a Flax Linen
`),Hr=r(mh,"A",{href:!0,rel:!0});var U1=i(Hr);sw=s(U1,"flax.nn.Module"),U1.forEach(t),nw=s(mh,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),mh.forEach(t),rw=p(Re),hd=r(Re,"P",{});var H1=i(hd);iw=s(H1,"Finally, this model supports inherent JAX features such as:"),H1.forEach(t),lw=p(Re),Lt=r(Re,"UL",{});var us=i(Lt);ud=r(us,"LI",{});var X1=i(ud);Xr=r(X1,"A",{href:!0,rel:!0});var G1=i(Xr);cw=s(G1,"Just-In-Time (JIT) compilation"),G1.forEach(t),X1.forEach(t),dw=p(us),fd=r(us,"LI",{});var K1=i(fd);Gr=r(K1,"A",{href:!0,rel:!0});var J1=i(Gr);pw=s(J1,"Automatic Differentiation"),J1.forEach(t),K1.forEach(t),mw=p(us),gd=r(us,"LI",{});var Z1=i(gd);Kr=r(Z1,"A",{href:!0,rel:!0});var Q1=i(Kr);hw=s(Q1,"Vectorization"),Q1.forEach(t),Z1.forEach(t),uw=p(us),_d=r(us,"LI",{});var Y1=i(_d);Jr=r(Y1,"A",{href:!0,rel:!0});var eT=i(Jr);fw=s(eT,"Parallelization"),eT.forEach(t),Y1.forEach(t),us.forEach(t),gw=p(Re),ft=r(Re,"DIV",{class:!0});var fs=i(ft);y(Zr.$$.fragment,fs),_w=p(fs),So=r(fs,"P",{});var Il=i(So);vw=s(Il,"The "),vd=r(Il,"CODE",{});var tT=i(vd);bw=s(tT,"FlaxWav2Vec2PreTrainedModel"),tT.forEach(t),ww=s(Il," forward method, overrides the "),bd=r(Il,"CODE",{});var oT=i(bd);yw=s(oT,"__call__"),oT.forEach(t),kw=s(Il," special method."),Il.forEach(t),Tw=p(fs),y(Ra.$$.fragment,fs),xw=p(fs),y(Ua.$$.fragment,fs),fs.forEach(t),Re.forEach(t),Up=p(o),Io=r(o,"H2",{class:!0});var hh=i(Io);Ha=r(hh,"A",{id:!0,class:!0,href:!0});var aT=i(Ha);wd=r(aT,"SPAN",{});var sT=i(wd);y(Qr.$$.fragment,sT),sT.forEach(t),aT.forEach(t),$w=p(hh),yd=r(hh,"SPAN",{});var nT=i(yd);jw=s(nT,"FlaxWav2Vec2ForCTC"),nT.forEach(t),hh.forEach(t),Hp=p(o),ie=r(o,"DIV",{class:!0});var Ue=i(ie);y(Yr.$$.fragment,Ue),Ww=p(Ue),No=r(Ue,"P",{});var Nl=i(No);Vw=s(Nl,"Wav2Vec2 Model with a "),kd=r(Nl,"CODE",{});var rT=i(kd);Fw=s(rT,"language modeling"),rT.forEach(t),Ew=s(Nl,` head on top for Connectionist Temporal Classification (CTC).
Wav2Vec2 was proposed in `),ei=r(Nl,"A",{href:!0,rel:!0});var iT=i(ei);Cw=s(iT,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),iT.forEach(t),Pw=s(Nl,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Nl.forEach(t),qw=p(Ue),ti=r(Ue,"P",{});var uh=i(ti);Aw=s(uh,"This model inherits from "),yl=r(uh,"A",{href:!0});var lT=i(yl);zw=s(lT,"FlaxPreTrainedModel"),lT.forEach(t),Mw=s(uh,`. 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.)`),uh.forEach(t),Lw=p(Ue),oi=r(Ue,"P",{});var fh=i(oi);Ow=s(fh,`This model is also a Flax Linen
`),ai=r(fh,"A",{href:!0,rel:!0});var cT=i(ai);Dw=s(cT,"flax.nn.Module"),cT.forEach(t),Sw=s(fh,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),fh.forEach(t),Iw=p(Ue),Td=r(Ue,"P",{});var dT=i(Td);Nw=s(dT,"Finally, this model supports inherent JAX features such as:"),dT.forEach(t),Bw=p(Ue),Ot=r(Ue,"UL",{});var gs=i(Ot);xd=r(gs,"LI",{});var pT=i(xd);si=r(pT,"A",{href:!0,rel:!0});var mT=i(si);Rw=s(mT,"Just-In-Time (JIT) compilation"),mT.forEach(t),pT.forEach(t),Uw=p(gs),$d=r(gs,"LI",{});var hT=i($d);ni=r(hT,"A",{href:!0,rel:!0});var uT=i(ni);Hw=s(uT,"Automatic Differentiation"),uT.forEach(t),hT.forEach(t),Xw=p(gs),jd=r(gs,"LI",{});var fT=i(jd);ri=r(fT,"A",{href:!0,rel:!0});var gT=i(ri);Gw=s(gT,"Vectorization"),gT.forEach(t),fT.forEach(t),Kw=p(gs),Wd=r(gs,"LI",{});var _T=i(Wd);ii=r(_T,"A",{href:!0,rel:!0});var vT=i(ii);Jw=s(vT,"Parallelization"),vT.forEach(t),_T.forEach(t),gs.forEach(t),Zw=p(Ue),gt=r(Ue,"DIV",{class:!0});var _s=i(gt);y(li.$$.fragment,_s),Qw=p(_s),Bo=r(_s,"P",{});var Bl=i(Bo);Yw=s(Bl,"The "),Vd=r(Bl,"CODE",{});var bT=i(Vd);ey=s(bT,"FlaxWav2Vec2PreTrainedModel"),bT.forEach(t),ty=s(Bl," forward method, overrides the "),Fd=r(Bl,"CODE",{});var wT=i(Fd);oy=s(wT,"__call__"),wT.forEach(t),ay=s(Bl," special method."),Bl.forEach(t),sy=p(_s),y(Xa.$$.fragment,_s),ny=p(_s),y(Ga.$$.fragment,_s),_s.forEach(t),Ue.forEach(t),Xp=p(o),Ro=r(o,"H2",{class:!0});var gh=i(Ro);Ka=r(gh,"A",{id:!0,class:!0,href:!0});var yT=i(Ka);Ed=r(yT,"SPAN",{});var kT=i(Ed);y(ci.$$.fragment,kT),kT.forEach(t),yT.forEach(t),ry=p(gh),Cd=r(gh,"SPAN",{});var TT=i(Cd);iy=s(TT,"FlaxWav2Vec2ForPreTraining"),TT.forEach(t),gh.forEach(t),Gp=p(o),le=r(o,"DIV",{class:!0});var He=i(le);y(di.$$.fragment,He),ly=p(He),Uo=r(He,"P",{});var Rl=i(Uo);cy=s(Rl,"Wav2Vec2 Model with a quantizer and "),Pd=r(Rl,"CODE",{});var xT=i(Pd);dy=s(xT,"VQ"),xT.forEach(t),py=s(Rl,` head on top.
Wav2Vec2 was proposed in `),pi=r(Rl,"A",{href:!0,rel:!0});var $T=i(pi);my=s($T,`wav2vec 2.0: A Framework for Self-Supervised Learning of Speech
Representations`),$T.forEach(t),hy=s(Rl,` by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael
Auli.`),Rl.forEach(t),uy=p(He),mi=r(He,"P",{});var _h=i(mi);fy=s(_h,"This model inherits from "),kl=r(_h,"A",{href:!0});var jT=i(kl);gy=s(jT,"FlaxPreTrainedModel"),jT.forEach(t),_y=s(_h,`. 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.)`),_h.forEach(t),vy=p(He),hi=r(He,"P",{});var vh=i(hi);by=s(vh,`This model is also a Flax Linen
`),ui=r(vh,"A",{href:!0,rel:!0});var WT=i(ui);wy=s(WT,"flax.nn.Module"),WT.forEach(t),yy=s(vh,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),vh.forEach(t),ky=p(He),qd=r(He,"P",{});var VT=i(qd);Ty=s(VT,"Finally, this model supports inherent JAX features such as:"),VT.forEach(t),xy=p(He),Dt=r(He,"UL",{});var vs=i(Dt);Ad=r(vs,"LI",{});var FT=i(Ad);fi=r(FT,"A",{href:!0,rel:!0});var ET=i(fi);$y=s(ET,"Just-In-Time (JIT) compilation"),ET.forEach(t),FT.forEach(t),jy=p(vs),zd=r(vs,"LI",{});var CT=i(zd);gi=r(CT,"A",{href:!0,rel:!0});var PT=i(gi);Wy=s(PT,"Automatic Differentiation"),PT.forEach(t),CT.forEach(t),Vy=p(vs),Md=r(vs,"LI",{});var qT=i(Md);_i=r(qT,"A",{href:!0,rel:!0});var AT=i(_i);Fy=s(AT,"Vectorization"),AT.forEach(t),qT.forEach(t),Ey=p(vs),Ld=r(vs,"LI",{});var zT=i(Ld);vi=r(zT,"A",{href:!0,rel:!0});var MT=i(vi);Cy=s(MT,"Parallelization"),MT.forEach(t),zT.forEach(t),vs.forEach(t),Py=p(He),_t=r(He,"DIV",{class:!0});var bs=i(_t);y(bi.$$.fragment,bs),qy=p(bs),Ho=r(bs,"P",{});var Ul=i(Ho);Ay=s(Ul,"The "),Tl=r(Ul,"A",{href:!0});var LT=i(Tl);zy=s(LT,"FlaxWav2Vec2ForPreTraining"),LT.forEach(t),My=s(Ul," forward method, overrides the "),Od=r(Ul,"CODE",{});var OT=i(Od);Ly=s(OT,"__call__"),OT.forEach(t),Oy=s(Ul," special method."),Ul.forEach(t),Dy=p(bs),y(Ja.$$.fragment,bs),Sy=p(bs),y(Za.$$.fragment,bs),bs.forEach(t),He.forEach(t),this.h()},h(){c(m,"name","hf:doc:metadata"),c(m,"content",JSON.stringify(kx)),c(u,"id","wav2vec2"),c(u,"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(u,"href","#wav2vec2"),c(f,"class","relative group"),c(z,"id","overview"),c(z,"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(z,"href","#overview"),c(A,"class","relative group"),c(I,"href","https://arxiv.org/abs/2006.11477"),c(I,"rel","nofollow"),c(U,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer"),c(Ee,"href","https://huggingface.co/patrickvonplaten"),c(Ee,"rel","nofollow"),c(ye,"id","resources"),c(ye,"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(ye,"href","#resources"),c(Y,"class","relative group"),c(Ze,"href","https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb"),c(Ze,"rel","nofollow"),c(pe,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC"),c(se,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification"),c(se,"rel","nofollow"),c(Pe,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb"),c(Pe,"rel","nofollow"),c(ks,"href","https://huggingface.co/blog/wav2vec2-with-ngram"),c(ks,"rel","nofollow"),c(xs,"href","https://huggingface.co/blog/fine-tune-wav2vec2-english"),c(xs,"rel","nofollow"),c(js,"href","https://huggingface.co/blog/fine-tune-xlsr-wav2vec2"),c(js,"rel","nofollow"),c(Vs,"href","https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb"),c(Vs,"rel","nofollow"),c(Ei,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC"),c(Fs,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb"),c(Fs,"rel","nofollow"),c(Es,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb"),c(Es,"rel","nofollow"),c(Ps,"href","https://www.philschmid.de/automatic-speech-recognition-sagemaker"),c(Ps,"rel","nofollow"),c(Xo,"id","transformers.Wav2Vec2Config"),c(Xo,"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(Xo,"href","#transformers.Wav2Vec2Config"),c(lo,"class","relative group"),c(qi,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Model"),c(zs,"href","https://huggingface.co/facebook/wav2vec2-base-960h"),c(zs,"rel","nofollow"),c(Ai,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(zi,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ko,"id","transformers.Wav2Vec2CTCTokenizer"),c(Ko,"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(Ko,"href","#transformers.Wav2Vec2CTCTokenizer"),c(mo,"class","relative group"),c(Mi,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),c(Jo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Li,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Qo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Yo,"id","transformers.Wav2Vec2FeatureExtractor"),c(Yo,"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(Yo,"href","#transformers.Wav2Vec2FeatureExtractor"),c(ho,"class","relative group"),c(Oi,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),c(ea,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ta,"id","transformers.Wav2Vec2Processor"),c(ta,"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(ta,"href","#transformers.Wav2Vec2Processor"),c(uo,"class","relative group"),c(Di,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor"),c(Si,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor"),c(Ii,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),c(Js,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__"),c(Ni,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.decode"),c(Qs,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor.__call__"),c(Ys,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__"),c(oa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Bi,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad"),c(Ri,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.pad"),c(aa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ui,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Hi,"href","/docs/transformers/main/en/model_doc/trocr#transformers.TrOCRProcessor.from_pretrained"),c(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Xi,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),c(na,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Gi,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),c(ra,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ia,"id","transformers.Wav2Vec2ProcessorWithLM"),c(ia,"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(ia,"href","#transformers.Wav2Vec2ProcessorWithLM"),c(fo,"class","relative group"),c(mn,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor.__call__"),c(hn,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__"),c(la,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ki,"href","/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad"),c(Ji,"href","/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.pad"),c(ca,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Zi,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM"),c(Ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Qi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Yi,"href","#decoding-multiple-audios"),c(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ha,"id","decoding-multiple-audios"),c(ha,"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(ha,"href","#decoding-multiple-audios"),c(go,"class","relative group"),c(el,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM.batch_decode"),c(tl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM.batch_decode"),c(ol,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ProcessorWithLM.decode"),c(ua,"id","transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput"),c(ua,"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(ua,"href","#transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput"),c(_o,"class","relative group"),c(vo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(al,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForPreTraining"),c(wo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(fa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ga,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(_a,"id","transformers.Wav2Vec2Model"),c(_a,"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(_a,"href","#transformers.Wav2Vec2Model"),c(yo,"class","relative group"),c(On,"href","https://arxiv.org/abs/2006.11477"),c(On,"rel","nofollow"),c(sl,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(In,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(In,"rel","nofollow"),c(nl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Model"),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(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(wa,"id","transformers.Wav2Vec2ForCTC"),c(wa,"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(wa,"href","#transformers.Wav2Vec2ForCTC"),c(To,"class","relative group"),c(Un,"href","https://arxiv.org/abs/2006.11477"),c(Un,"rel","nofollow"),c(rl,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Gn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Gn,"rel","nofollow"),c(il,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC"),c(lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ta,"id","transformers.Wav2Vec2ForSequenceClassification"),c(Ta,"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(Ta,"href","#transformers.Wav2Vec2ForSequenceClassification"),c(jo,"class","relative group"),c(Yn,"href","https://arxiv.org/abs/2006.11477"),c(Yn,"rel","nofollow"),c(ll,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(or,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(or,"rel","nofollow"),c(cl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForSequenceClassification"),c(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ja,"id","transformers.Wav2Vec2ForAudioFrameClassification"),c(ja,"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(ja,"href","#transformers.Wav2Vec2ForAudioFrameClassification"),c(Vo,"class","relative group"),c(ir,"href","https://arxiv.org/abs/2006.11477"),c(ir,"rel","nofollow"),c(dl,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(dr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(dr,"rel","nofollow"),c(pl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForAudioFrameClassification"),c(dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Fa,"id","transformers.Wav2Vec2ForXVector"),c(Fa,"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(Fa,"href","#transformers.Wav2Vec2ForXVector"),c(Eo,"class","relative group"),c(fr,"href","https://arxiv.org/abs/2006.11477"),c(fr,"rel","nofollow"),c(ml,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(vr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(vr,"rel","nofollow"),c(hl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForXVector"),c(pt,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Pa,"id","transformers.Wav2Vec2ForPreTraining"),c(Pa,"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(Pa,"href","#transformers.Wav2Vec2ForPreTraining"),c(Po,"class","relative group"),c(kr,"href","https://arxiv.org/abs/2006.11477"),c(kr,"rel","nofollow"),c(ul,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c($r,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c($r,"rel","nofollow"),c(fl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2ForPreTraining"),c(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(za,"id","transformers.TFWav2Vec2Model"),c(za,"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(za,"href","#transformers.TFWav2Vec2Model"),c(zo,"class","relative group"),c(gl,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),c(Cr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),c(Cr,"rel","nofollow"),c(_l,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.TFWav2Vec2Model"),c(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Da,"id","transformers.TFWav2Vec2ForCTC"),c(Da,"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(Da,"href","#transformers.TFWav2Vec2ForCTC"),c(Lo,"class","relative group"),c(vl,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),c(Or,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),c(Or,"rel","nofollow"),c(bl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.TFWav2Vec2ForCTC"),c(ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Ba,"id","transformers.FlaxWav2Vec2Model"),c(Ba,"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(Ba,"href","#transformers.FlaxWav2Vec2Model"),c(Do,"class","relative group"),c(Br,"href","https://arxiv.org/abs/2006.11477"),c(Br,"rel","nofollow"),c(wl,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),c(Hr,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c(Hr,"rel","nofollow"),c(Xr,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),c(Xr,"rel","nofollow"),c(Gr,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),c(Gr,"rel","nofollow"),c(Kr,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),c(Kr,"rel","nofollow"),c(Jr,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),c(Jr,"rel","nofollow"),c(ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ha,"id","transformers.FlaxWav2Vec2ForCTC"),c(Ha,"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(Ha,"href","#transformers.FlaxWav2Vec2ForCTC"),c(Io,"class","relative group"),c(ei,"href","https://arxiv.org/abs/2006.11477"),c(ei,"rel","nofollow"),c(yl,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),c(ai,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c(ai,"rel","nofollow"),c(si,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),c(si,"rel","nofollow"),c(ni,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),c(ni,"rel","nofollow"),c(ri,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),c(ri,"rel","nofollow"),c(ii,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),c(ii,"rel","nofollow"),c(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ka,"id","transformers.FlaxWav2Vec2ForPreTraining"),c(Ka,"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(Ka,"href","#transformers.FlaxWav2Vec2ForPreTraining"),c(Ro,"class","relative group"),c(pi,"href","https://arxiv.org/abs/2006.11477"),c(pi,"rel","nofollow"),c(kl,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),c(ui,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),c(ui,"rel","nofollow"),c(fi,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),c(fi,"rel","nofollow"),c(gi,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),c(gi,"rel","nofollow"),c(_i,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),c(_i,"rel","nofollow"),c(vi,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),c(vi,"rel","nofollow"),c(Tl,"href","/docs/transformers/main/en/model_doc/wav2vec2#transformers.FlaxWav2Vec2ForPreTraining"),c(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(le,"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,g){e(document.head,m),_(o,b,g),_(o,f,g),e(f,u),e(u,v),k(l,v,null),e(f,h),e(f,V),e(V,M),_(o,L,g),_(o,A,g),e(A,z),e(z,N),k(E,N,null),e(A,O),e(A,C),e(C,ce),_(o,K,g),_(o,S,g),e(S,de),e(S,I),e(I,R),e(S,Le),_(o,X,g),_(o,J,g),e(J,Oe),_(o,$e,g),_(o,Z,g),e(Z,Ke),e(Ke,xt),_(o,De,g),_(o,D,g),e(D,Q),_(o,tt,g),_(o,ae,g),e(ae,Je),e(Je,$t),e(ae,je),e(ae,We),e(We,jt),e(We,U),e(U,Wt),e(We,Ve),_(o,ot,g),_(o,we,g),e(we,Fe),e(we,Ee),e(Ee,Vt),e(we,he),_(o,at,g),_(o,Y,g),e(Y,ye),e(ye,Ce),k(B,Ce,null),e(Y,Ft),e(Y,ee),e(ee,Et),_(o,st,g),_(o,j,g),e(j,P),_(o,It,g),k(ue,o,g),_(o,Nt,g),_(o,Se,g),e(Se,q),e(q,Yt),e(q,Ze),e(Ze,eo),e(q,to),e(Se,oo),e(Se,H),e(H,pe),e(pe,ao),e(H,so),e(H,se),e(se,no),e(H,ro),e(H,Pe),e(Pe,io),e(H,Qe),_(o,Bt,g),k(ws,o,g),_(o,np,g),_(o,Ie,g),e(Ie,ys),e(ys,bh),e(ys,ks),e(ks,wh),e(ys,yh),e(Ie,kh),e(Ie,Ts),e(Ts,Th),e(Ts,xs),e(xs,xh),e(Ts,$h),e(Ie,jh),e(Ie,$s),e($s,Wh),e($s,js),e(js,Vh),e($s,Fh),e(Ie,Eh),e(Ie,Ws),e(Ws,Ch),e(Ws,Vs),e(Vs,Ph),e(Ws,qh),e(Ie,Ah),e(Ie,Rt),e(Rt,Ei),e(Ei,zh),e(Rt,Mh),e(Rt,Fs),e(Fs,Lh),e(Rt,Oh),e(Rt,Es),e(Es,Dh),e(Rt,Sh),_(o,rp,g),_(o,Ci,g),e(Ci,Ih),_(o,ip,g),_(o,Pi,g),e(Pi,Cs),e(Cs,Nh),e(Cs,Ps),e(Ps,Bh),e(Cs,Rh),_(o,lp,g),_(o,lo,g),e(lo,Xo),e(Xo,Hl),k(qs,Hl,null),e(lo,Uh),e(lo,Xl),e(Xl,Hh),_(o,cp,g),_(o,Ye,g),k(As,Ye,null),e(Ye,Xh),e(Ye,co),e(co,Gh),e(co,qi),e(qi,Kh),e(co,Jh),e(co,zs),e(zs,Zh),e(co,Qh),e(Ye,Yh),e(Ye,po),e(po,eu),e(po,Ai),e(Ai,tu),e(po,ou),e(po,zi),e(zi,au),e(po,su),e(Ye,nu),k(Go,Ye,null),_(o,dp,g),_(o,mo,g),e(mo,Ko),e(Ko,Gl),k(Ms,Gl,null),e(mo,ru),e(mo,Kl),e(Kl,iu),_(o,pp,g),_(o,ne,g),k(Ls,ne,null),e(ne,lu),e(ne,Jl),e(Jl,cu),e(ne,du),e(ne,Os),e(Os,pu),e(Os,Mi),e(Mi,mu),e(Os,hu),e(ne,uu),e(ne,Jo),k(Ds,Jo,null),e(Jo,fu),e(Jo,Zl),e(Zl,gu),e(ne,_u),e(ne,Li),k(Ss,Li,null),e(ne,vu),e(ne,nt),k(Is,nt,null),e(nt,bu),e(nt,Ql),e(Ql,wu),e(nt,yu),e(nt,Ns),e(Ns,ku),e(Ns,Yl),e(Yl,Tu),e(Ns,xu),e(nt,$u),k(Zo,nt,null),e(ne,ju),e(ne,Qo),k(Bs,Qo,null),e(Qo,Wu),e(Qo,ec),e(ec,Vu),_(o,mp,g),_(o,ho,g),e(ho,Yo),e(Yo,tc),k(Rs,tc,null),e(ho,Fu),e(ho,oc),e(oc,Eu),_(o,hp,g),_(o,et,g),k(Us,et,null),e(et,Cu),e(et,ac),e(ac,Pu),e(et,qu),e(et,Hs),e(Hs,Au),e(Hs,Oi),e(Oi,zu),e(Hs,Mu),e(et,Lu),e(et,ea),k(Xs,ea,null),e(ea,Ou),e(ea,sc),e(sc,Du),_(o,up,g),_(o,uo,g),e(uo,ta),e(ta,nc),k(Gs,nc,null),e(uo,Su),e(uo,rc),e(rc,Iu),_(o,fp,g),_(o,G,g),k(Ks,G,null),e(G,Nu),e(G,ic),e(ic,Bu),e(G,Ru),e(G,Ne),e(Ne,Di),e(Di,Uu),e(Ne,Hu),e(Ne,Si),e(Si,Xu),e(Ne,Gu),e(Ne,Ii),e(Ii,Ku),e(Ne,Ju),e(Ne,Js),e(Js,lc),e(lc,Zu),e(Js,Qu),e(Ne,Yu),e(Ne,Ni),e(Ni,ef),e(Ne,tf),e(G,of),e(G,oa),k(Zs,oa,null),e(oa,af),e(oa,Ct),e(Ct,sf),e(Ct,Qs),e(Qs,cc),e(cc,nf),e(Qs,rf),e(Ct,lf),e(Ct,dc),e(dc,cf),e(Ct,df),e(Ct,Ys),e(Ys,pc),e(pc,pf),e(Ys,mf),e(Ct,hf),e(G,uf),e(G,aa),k(en,aa,null),e(aa,ff),e(aa,Pt),e(Pt,gf),e(Pt,Bi),e(Bi,_f),e(Pt,vf),e(Pt,mc),e(mc,bf),e(Pt,wf),e(Pt,Ri),e(Ri,yf),e(Pt,kf),e(G,Tf),e(G,Ui),k(tn,Ui,null),e(G,xf),e(G,Ut),k(on,Ut,null),e(Ut,$f),e(Ut,an),e(an,jf),e(an,Hi),e(Hi,Wf),e(an,Vf),e(Ut,Ff),k(sa,Ut,null),e(G,Ef),e(G,na),k(sn,na,null),e(na,Cf),e(na,nn),e(nn,Pf),e(nn,Xi),e(Xi,qf),e(nn,Af),e(G,zf),e(G,ra),k(rn,ra,null),e(ra,Mf),e(ra,ln),e(ln,Lf),e(ln,Gi),e(Gi,Of),e(ln,Df),_(o,gp,g),_(o,fo,g),e(fo,ia),e(ia,hc),k(cn,hc,null),e(fo,Sf),e(fo,uc),e(uc,If),_(o,_p,g),_(o,te,g),k(dn,te,null),e(te,Nf),e(te,fc),e(fc,Bf),e(te,Rf),e(te,la),k(pn,la,null),e(la,Uf),e(la,qt),e(qt,Hf),e(qt,mn),e(mn,gc),e(gc,Xf),e(mn,Gf),e(qt,Kf),e(qt,_c),e(_c,Jf),e(qt,Zf),e(qt,hn),e(hn,vc),e(vc,Qf),e(hn,Yf),e(qt,eg),e(te,tg),e(te,ca),k(un,ca,null),e(ca,og),e(ca,At),e(At,ag),e(At,Ki),e(Ki,sg),e(At,ng),e(At,bc),e(bc,rg),e(At,ig),e(At,Ji),e(Ji,lg),e(At,cg),e(te,dg),e(te,Ht),k(fn,Ht,null),e(Ht,pg),e(Ht,gn),e(gn,mg),e(gn,Zi),e(Zi,hg),e(gn,ug),e(Ht,fg),k(da,Ht,null),e(te,gg),e(te,Qi),k(_n,Qi,null),e(te,_g),e(te,rt),k(vn,rt,null),e(rt,vg),e(rt,wc),e(wc,bg),e(rt,wg),k(pa,rt,null),e(rt,yg),e(rt,bn),e(bn,kg),e(bn,Yi),e(Yi,Tg),e(bn,xg),e(te,$g),e(te,Xt),k(wn,Xt,null),e(Xt,jg),e(Xt,yc),e(yc,Wg),e(Xt,Vg),k(ma,Xt,null),_(o,vp,g),_(o,go,g),e(go,ha),e(ha,kc),k(yn,kc,null),e(go,Fg),e(go,Tc),e(Tc,Eg),_(o,bp,g),_(o,ke,g),e(ke,Cg),e(ke,el),e(el,Pg),e(ke,qg),e(ke,xc),e(xc,Ag),e(ke,zg),e(ke,tl),e(tl,Mg),e(ke,Lg),e(ke,ol),e(ol,Og),e(ke,Dg),e(ke,$c),e($c,Sg),e(ke,Ig),_(o,wp,g),k(kn,o,g),_(o,yp,g),_(o,_o,g),e(_o,ua),e(ua,jc),k(Tn,jc,null),e(_o,Ng),e(_o,Wc),e(Wc,Bg),_(o,kp,g),_(o,vo,g),k(xn,vo,null),e(vo,Rg),e(vo,$n),e($n,Ug),e($n,Vc),e(Vc,Hg),e($n,Xg),_(o,Tp,g),_(o,bo,g),k(jn,bo,null),e(bo,Gg),e(bo,Fc),e(Fc,Kg),_(o,xp,g),_(o,wo,g),k(Wn,wo,null),e(wo,Jg),e(wo,Vn),e(Vn,Zg),e(Vn,al),e(al,Qg),e(Vn,Yg),_(o,$p,g),_(o,zt,g),k(Fn,zt,null),e(zt,e_),e(zt,En),e(En,t_),e(En,Ec),e(Ec,o_),e(En,a_),e(zt,s_),e(zt,fa),k(Cn,fa,null),e(fa,n_),e(fa,Cc),e(Cc,r_),_(o,jp,g),_(o,Mt,g),k(Pn,Mt,null),e(Mt,i_),e(Mt,qn),e(qn,l_),e(qn,Pc),e(Pc,c_),e(qn,d_),e(Mt,p_),e(Mt,ga),k(An,ga,null),e(ga,m_),e(ga,qc),e(qc,h_),_(o,Wp,g),_(o,yo,g),e(yo,_a),e(_a,Ac),k(zn,Ac,null),e(yo,u_),e(yo,zc),e(zc,f_),_(o,Vp,g),_(o,qe,g),k(Mn,qe,null),e(qe,g_),e(qe,Ln),e(Ln,__),e(Ln,On),e(On,v_),e(Ln,b_),e(qe,w_),e(qe,Dn),e(Dn,y_),e(Dn,sl),e(sl,k_),e(Dn,T_),e(qe,x_),e(qe,Sn),e(Sn,$_),e(Sn,In),e(In,j_),e(Sn,W_),e(qe,V_),e(qe,it),k(Nn,it,null),e(it,F_),e(it,ko),e(ko,E_),e(ko,nl),e(nl,C_),e(ko,P_),e(ko,Mc),e(Mc,q_),e(ko,A_),e(it,z_),k(va,it,null),e(it,M_),k(ba,it,null),_(o,Fp,g),_(o,To,g),e(To,wa),e(wa,Lc),k(Bn,Lc,null),e(To,L_),e(To,Oc),e(Oc,O_),_(o,Ep,g),_(o,Ae,g),k(Rn,Ae,null),e(Ae,D_),e(Ae,xo),e(xo,S_),e(xo,Dc),e(Dc,I_),e(xo,N_),e(xo,Un),e(Un,B_),e(xo,R_),e(Ae,U_),e(Ae,Hn),e(Hn,H_),e(Hn,rl),e(rl,X_),e(Hn,G_),e(Ae,K_),e(Ae,Xn),e(Xn,J_),e(Xn,Gn),e(Gn,Z_),e(Xn,Q_),e(Ae,Y_),e(Ae,lt),k(Kn,lt,null),e(lt,ev),e(lt,$o),e($o,tv),e($o,il),e(il,ov),e($o,av),e($o,Sc),e(Sc,sv),e($o,nv),e(lt,rv),k(ya,lt,null),e(lt,iv),k(ka,lt,null),_(o,Cp,g),_(o,jo,g),e(jo,Ta),e(Ta,Ic),k(Jn,Ic,null),e(jo,lv),e(jo,Nc),e(Nc,cv),_(o,Pp,g),_(o,fe,g),k(Zn,fe,null),e(fe,dv),e(fe,Bc),e(Bc,pv),e(fe,mv),e(fe,Qn),e(Qn,hv),e(Qn,Yn),e(Yn,uv),e(Qn,fv),e(fe,gv),e(fe,er),e(er,_v),e(er,ll),e(ll,vv),e(er,bv),e(fe,wv),e(fe,tr),e(tr,yv),e(tr,or),e(or,kv),e(tr,Tv),e(fe,xv),e(fe,ct),k(ar,ct,null),e(ct,$v),e(ct,Wo),e(Wo,jv),e(Wo,cl),e(cl,Wv),e(Wo,Vv),e(Wo,Rc),e(Rc,Fv),e(Wo,Ev),e(ct,Cv),k(xa,ct,null),e(ct,Pv),k($a,ct,null),_(o,qp,g),_(o,Vo,g),e(Vo,ja),e(ja,Uc),k(sr,Uc,null),e(Vo,qv),e(Vo,Hc),e(Hc,Av),_(o,Ap,g),_(o,ge,g),k(nr,ge,null),e(ge,zv),e(ge,Xc),e(Xc,Mv),e(ge,Lv),e(ge,rr),e(rr,Ov),e(rr,ir),e(ir,Dv),e(rr,Sv),e(ge,Iv),e(ge,lr),e(lr,Nv),e(lr,dl),e(dl,Bv),e(lr,Rv),e(ge,Uv),e(ge,cr),e(cr,Hv),e(cr,dr),e(dr,Xv),e(cr,Gv),e(ge,Kv),e(ge,dt),k(pr,dt,null),e(dt,Jv),e(dt,Fo),e(Fo,Zv),e(Fo,pl),e(pl,Qv),e(Fo,Yv),e(Fo,Gc),e(Gc,e2),e(Fo,t2),e(dt,o2),k(Wa,dt,null),e(dt,a2),k(Va,dt,null),_(o,zp,g),_(o,Eo,g),e(Eo,Fa),e(Fa,Kc),k(mr,Kc,null),e(Eo,s2),e(Eo,Jc),e(Jc,n2),_(o,Mp,g),_(o,_e,g),k(hr,_e,null),e(_e,r2),e(_e,Zc),e(Zc,i2),e(_e,l2),e(_e,ur),e(ur,c2),e(ur,fr),e(fr,d2),e(ur,p2),e(_e,m2),e(_e,gr),e(gr,h2),e(gr,ml),e(ml,u2),e(gr,f2),e(_e,g2),e(_e,_r),e(_r,_2),e(_r,vr),e(vr,v2),e(_r,b2),e(_e,w2),e(_e,pt),k(br,pt,null),e(pt,y2),e(pt,Co),e(Co,k2),e(Co,hl),e(hl,T2),e(Co,x2),e(Co,Qc),e(Qc,$2),e(Co,j2),e(pt,W2),k(Ea,pt,null),e(pt,V2),k(Ca,pt,null),_(o,Lp,g),_(o,Po,g),e(Po,Pa),e(Pa,Yc),k(wr,Yc,null),e(Po,F2),e(Po,ed),e(ed,E2),_(o,Op,g),_(o,ze,g),k(yr,ze,null),e(ze,C2),e(ze,qo),e(qo,P2),e(qo,td),e(td,q2),e(qo,A2),e(qo,kr),e(kr,z2),e(qo,M2),e(ze,L2),e(ze,Tr),e(Tr,O2),e(Tr,ul),e(ul,D2),e(Tr,S2),e(ze,I2),e(ze,xr),e(xr,N2),e(xr,$r),e($r,B2),e(xr,R2),e(ze,U2),e(ze,mt),k(jr,mt,null),e(mt,H2),e(mt,Ao),e(Ao,X2),e(Ao,fl),e(fl,G2),e(Ao,K2),e(Ao,od),e(od,J2),e(Ao,Z2),e(mt,Q2),k(qa,mt,null),e(mt,Y2),k(Aa,mt,null),_(o,Dp,g),_(o,zo,g),e(zo,za),e(za,ad),k(Wr,ad,null),e(zo,eb),e(zo,sd),e(sd,tb),_(o,Sp,g),_(o,ve,g),k(Vr,ve,null),e(ve,ob),e(ve,nd),e(nd,ab),e(ve,sb),e(ve,Fr),e(Fr,nb),e(Fr,gl),e(gl,rb),e(Fr,ib),e(ve,lb),e(ve,Er),e(Er,cb),e(Er,Cr),e(Cr,db),e(Er,pb),e(ve,mb),k(Ma,ve,null),e(ve,hb),e(ve,ht),k(Pr,ht,null),e(ht,ub),e(ht,Mo),e(Mo,fb),e(Mo,_l),e(_l,gb),e(Mo,_b),e(Mo,rd),e(rd,vb),e(Mo,bb),e(ht,wb),k(La,ht,null),e(ht,yb),k(Oa,ht,null),_(o,Ip,g),_(o,Lo,g),e(Lo,Da),e(Da,id),k(qr,id,null),e(Lo,kb),e(Lo,ld),e(ld,Tb),_(o,Np,g),_(o,be,g),k(Ar,be,null),e(be,xb),e(be,zr),e(zr,$b),e(zr,cd),e(cd,jb),e(zr,Wb),e(be,Vb),e(be,Mr),e(Mr,Fb),e(Mr,vl),e(vl,Eb),e(Mr,Cb),e(be,Pb),e(be,Lr),e(Lr,qb),e(Lr,Or),e(Or,Ab),e(Lr,zb),e(be,Mb),k(Sa,be,null),e(be,Lb),e(be,ut),k(Dr,ut,null),e(ut,Ob),e(ut,Oo),e(Oo,Db),e(Oo,bl),e(bl,Sb),e(Oo,Ib),e(Oo,dd),e(dd,Nb),e(Oo,Bb),e(ut,Rb),k(Ia,ut,null),e(ut,Ub),k(Na,ut,null),_(o,Bp,g),_(o,Do,g),e(Do,Ba),e(Ba,pd),k(Sr,pd,null),e(Do,Hb),e(Do,md),e(md,Xb),_(o,Rp,g),_(o,re,g),k(Ir,re,null),e(re,Gb),e(re,Nr),e(Nr,Kb),e(Nr,Br),e(Br,Jb),e(Nr,Zb),e(re,Qb),e(re,Rr),e(Rr,Yb),e(Rr,wl),e(wl,ew),e(Rr,tw),e(re,ow),e(re,Ur),e(Ur,aw),e(Ur,Hr),e(Hr,sw),e(Ur,nw),e(re,rw),e(re,hd),e(hd,iw),e(re,lw),e(re,Lt),e(Lt,ud),e(ud,Xr),e(Xr,cw),e(Lt,dw),e(Lt,fd),e(fd,Gr),e(Gr,pw),e(Lt,mw),e(Lt,gd),e(gd,Kr),e(Kr,hw),e(Lt,uw),e(Lt,_d),e(_d,Jr),e(Jr,fw),e(re,gw),e(re,ft),k(Zr,ft,null),e(ft,_w),e(ft,So),e(So,vw),e(So,vd),e(vd,bw),e(So,ww),e(So,bd),e(bd,yw),e(So,kw),e(ft,Tw),k(Ra,ft,null),e(ft,xw),k(Ua,ft,null),_(o,Up,g),_(o,Io,g),e(Io,Ha),e(Ha,wd),k(Qr,wd,null),e(Io,$w),e(Io,yd),e(yd,jw),_(o,Hp,g),_(o,ie,g),k(Yr,ie,null),e(ie,Ww),e(ie,No),e(No,Vw),e(No,kd),e(kd,Fw),e(No,Ew),e(No,ei),e(ei,Cw),e(No,Pw),e(ie,qw),e(ie,ti),e(ti,Aw),e(ti,yl),e(yl,zw),e(ti,Mw),e(ie,Lw),e(ie,oi),e(oi,Ow),e(oi,ai),e(ai,Dw),e(oi,Sw),e(ie,Iw),e(ie,Td),e(Td,Nw),e(ie,Bw),e(ie,Ot),e(Ot,xd),e(xd,si),e(si,Rw),e(Ot,Uw),e(Ot,$d),e($d,ni),e(ni,Hw),e(Ot,Xw),e(Ot,jd),e(jd,ri),e(ri,Gw),e(Ot,Kw),e(Ot,Wd),e(Wd,ii),e(ii,Jw),e(ie,Zw),e(ie,gt),k(li,gt,null),e(gt,Qw),e(gt,Bo),e(Bo,Yw),e(Bo,Vd),e(Vd,ey),e(Bo,ty),e(Bo,Fd),e(Fd,oy),e(Bo,ay),e(gt,sy),k(Xa,gt,null),e(gt,ny),k(Ga,gt,null),_(o,Xp,g),_(o,Ro,g),e(Ro,Ka),e(Ka,Ed),k(ci,Ed,null),e(Ro,ry),e(Ro,Cd),e(Cd,iy),_(o,Gp,g),_(o,le,g),k(di,le,null),e(le,ly),e(le,Uo),e(Uo,cy),e(Uo,Pd),e(Pd,dy),e(Uo,py),e(Uo,pi),e(pi,my),e(Uo,hy),e(le,uy),e(le,mi),e(mi,fy),e(mi,kl),e(kl,gy),e(mi,_y),e(le,vy),e(le,hi),e(hi,by),e(hi,ui),e(ui,wy),e(hi,yy),e(le,ky),e(le,qd),e(qd,Ty),e(le,xy),e(le,Dt),e(Dt,Ad),e(Ad,fi),e(fi,$y),e(Dt,jy),e(Dt,zd),e(zd,gi),e(gi,Wy),e(Dt,Vy),e(Dt,Md),e(Md,_i),e(_i,Fy),e(Dt,Ey),e(Dt,Ld),e(Ld,vi),e(vi,Cy),e(le,Py),e(le,_t),k(bi,_t,null),e(_t,qy),e(_t,Ho),e(Ho,Ay),e(Ho,Tl),e(Tl,zy),e(Ho,My),e(Ho,Od),e(Od,Ly),e(Ho,Oy),e(_t,Dy),k(Ja,_t,null),e(_t,Sy),k(Za,_t,null),Kp=!0},p(o,[g]){const wi={};g&2&&(wi.$$scope={dirty:g,ctx:o}),Go.$set(wi);const Dd={};g&2&&(Dd.$$scope={dirty:g,ctx:o}),Zo.$set(Dd);const Sd={};g&2&&(Sd.$$scope={dirty:g,ctx:o}),sa.$set(Sd);const Id={};g&2&&(Id.$$scope={dirty:g,ctx:o}),da.$set(Id);const yi={};g&2&&(yi.$$scope={dirty:g,ctx:o}),pa.$set(yi);const Nd={};g&2&&(Nd.$$scope={dirty:g,ctx:o}),ma.$set(Nd);const Bd={};g&2&&(Bd.$$scope={dirty:g,ctx:o}),va.$set(Bd);const Rd={};g&2&&(Rd.$$scope={dirty:g,ctx:o}),ba.$set(Rd);const ki={};g&2&&(ki.$$scope={dirty:g,ctx:o}),ya.$set(ki);const Ud={};g&2&&(Ud.$$scope={dirty:g,ctx:o}),ka.$set(Ud);const Hd={};g&2&&(Hd.$$scope={dirty:g,ctx:o}),xa.$set(Hd);const Xd={};g&2&&(Xd.$$scope={dirty:g,ctx:o}),$a.$set(Xd);const Gd={};g&2&&(Gd.$$scope={dirty:g,ctx:o}),Wa.$set(Gd);const Kd={};g&2&&(Kd.$$scope={dirty:g,ctx:o}),Va.$set(Kd);const Ti={};g&2&&(Ti.$$scope={dirty:g,ctx:o}),Ea.$set(Ti);const Jd={};g&2&&(Jd.$$scope={dirty:g,ctx:o}),Ca.$set(Jd);const xi={};g&2&&(xi.$$scope={dirty:g,ctx:o}),qa.$set(xi);const Zd={};g&2&&(Zd.$$scope={dirty:g,ctx:o}),Aa.$set(Zd);const $i={};g&2&&($i.$$scope={dirty:g,ctx:o}),Ma.$set($i);const Qd={};g&2&&(Qd.$$scope={dirty:g,ctx:o}),La.$set(Qd);const ji={};g&2&&(ji.$$scope={dirty:g,ctx:o}),Oa.$set(ji);const Yd={};g&2&&(Yd.$$scope={dirty:g,ctx:o}),Sa.$set(Yd);const ep={};g&2&&(ep.$$scope={dirty:g,ctx:o}),Ia.$set(ep);const tp={};g&2&&(tp.$$scope={dirty:g,ctx:o}),Na.$set(tp);const op={};g&2&&(op.$$scope={dirty:g,ctx:o}),Ra.$set(op);const Wi={};g&2&&(Wi.$$scope={dirty:g,ctx:o}),Ua.$set(Wi);const Vi={};g&2&&(Vi.$$scope={dirty:g,ctx:o}),Xa.$set(Vi);const ap={};g&2&&(ap.$$scope={dirty:g,ctx:o}),Ga.$set(ap);const Gt={};g&2&&(Gt.$$scope={dirty:g,ctx:o}),Ja.$set(Gt);const sp={};g&2&&(sp.$$scope={dirty:g,ctx:o}),Za.$set(sp)},i(o){Kp||(T(l.$$.fragment,o),T(E.$$.fragment,o),T(B.$$.fragment,o),T(ue.$$.fragment,o),T(ws.$$.fragment,o),T(qs.$$.fragment,o),T(As.$$.fragment,o),T(Go.$$.fragment,o),T(Ms.$$.fragment,o),T(Ls.$$.fragment,o),T(Ds.$$.fragment,o),T(Ss.$$.fragment,o),T(Is.$$.fragment,o),T(Zo.$$.fragment,o),T(Bs.$$.fragment,o),T(Rs.$$.fragment,o),T(Us.$$.fragment,o),T(Xs.$$.fragment,o),T(Gs.$$.fragment,o),T(Ks.$$.fragment,o),T(Zs.$$.fragment,o),T(en.$$.fragment,o),T(tn.$$.fragment,o),T(on.$$.fragment,o),T(sa.$$.fragment,o),T(sn.$$.fragment,o),T(rn.$$.fragment,o),T(cn.$$.fragment,o),T(dn.$$.fragment,o),T(pn.$$.fragment,o),T(un.$$.fragment,o),T(fn.$$.fragment,o),T(da.$$.fragment,o),T(_n.$$.fragment,o),T(vn.$$.fragment,o),T(pa.$$.fragment,o),T(wn.$$.fragment,o),T(ma.$$.fragment,o),T(yn.$$.fragment,o),T(kn.$$.fragment,o),T(Tn.$$.fragment,o),T(xn.$$.fragment,o),T(jn.$$.fragment,o),T(Wn.$$.fragment,o),T(Fn.$$.fragment,o),T(Cn.$$.fragment,o),T(Pn.$$.fragment,o),T(An.$$.fragment,o),T(zn.$$.fragment,o),T(Mn.$$.fragment,o),T(Nn.$$.fragment,o),T(va.$$.fragment,o),T(ba.$$.fragment,o),T(Bn.$$.fragment,o),T(Rn.$$.fragment,o),T(Kn.$$.fragment,o),T(ya.$$.fragment,o),T(ka.$$.fragment,o),T(Jn.$$.fragment,o),T(Zn.$$.fragment,o),T(ar.$$.fragment,o),T(xa.$$.fragment,o),T($a.$$.fragment,o),T(sr.$$.fragment,o),T(nr.$$.fragment,o),T(pr.$$.fragment,o),T(Wa.$$.fragment,o),T(Va.$$.fragment,o),T(mr.$$.fragment,o),T(hr.$$.fragment,o),T(br.$$.fragment,o),T(Ea.$$.fragment,o),T(Ca.$$.fragment,o),T(wr.$$.fragment,o),T(yr.$$.fragment,o),T(jr.$$.fragment,o),T(qa.$$.fragment,o),T(Aa.$$.fragment,o),T(Wr.$$.fragment,o),T(Vr.$$.fragment,o),T(Ma.$$.fragment,o),T(Pr.$$.fragment,o),T(La.$$.fragment,o),T(Oa.$$.fragment,o),T(qr.$$.fragment,o),T(Ar.$$.fragment,o),T(Sa.$$.fragment,o),T(Dr.$$.fragment,o),T(Ia.$$.fragment,o),T(Na.$$.fragment,o),T(Sr.$$.fragment,o),T(Ir.$$.fragment,o),T(Zr.$$.fragment,o),T(Ra.$$.fragment,o),T(Ua.$$.fragment,o),T(Qr.$$.fragment,o),T(Yr.$$.fragment,o),T(li.$$.fragment,o),T(Xa.$$.fragment,o),T(Ga.$$.fragment,o),T(ci.$$.fragment,o),T(di.$$.fragment,o),T(bi.$$.fragment,o),T(Ja.$$.fragment,o),T(Za.$$.fragment,o),Kp=!0)},o(o){x(l.$$.fragment,o),x(E.$$.fragment,o),x(B.$$.fragment,o),x(ue.$$.fragment,o),x(ws.$$.fragment,o),x(qs.$$.fragment,o),x(As.$$.fragment,o),x(Go.$$.fragment,o),x(Ms.$$.fragment,o),x(Ls.$$.fragment,o),x(Ds.$$.fragment,o),x(Ss.$$.fragment,o),x(Is.$$.fragment,o),x(Zo.$$.fragment,o),x(Bs.$$.fragment,o),x(Rs.$$.fragment,o),x(Us.$$.fragment,o),x(Xs.$$.fragment,o),x(Gs.$$.fragment,o),x(Ks.$$.fragment,o),x(Zs.$$.fragment,o),x(en.$$.fragment,o),x(tn.$$.fragment,o),x(on.$$.fragment,o),x(sa.$$.fragment,o),x(sn.$$.fragment,o),x(rn.$$.fragment,o),x(cn.$$.fragment,o),x(dn.$$.fragment,o),x(pn.$$.fragment,o),x(un.$$.fragment,o),x(fn.$$.fragment,o),x(da.$$.fragment,o),x(_n.$$.fragment,o),x(vn.$$.fragment,o),x(pa.$$.fragment,o),x(wn.$$.fragment,o),x(ma.$$.fragment,o),x(yn.$$.fragment,o),x(kn.$$.fragment,o),x(Tn.$$.fragment,o),x(xn.$$.fragment,o),x(jn.$$.fragment,o),x(Wn.$$.fragment,o),x(Fn.$$.fragment,o),x(Cn.$$.fragment,o),x(Pn.$$.fragment,o),x(An.$$.fragment,o),x(zn.$$.fragment,o),x(Mn.$$.fragment,o),x(Nn.$$.fragment,o),x(va.$$.fragment,o),x(ba.$$.fragment,o),x(Bn.$$.fragment,o),x(Rn.$$.fragment,o),x(Kn.$$.fragment,o),x(ya.$$.fragment,o),x(ka.$$.fragment,o),x(Jn.$$.fragment,o),x(Zn.$$.fragment,o),x(ar.$$.fragment,o),x(xa.$$.fragment,o),x($a.$$.fragment,o),x(sr.$$.fragment,o),x(nr.$$.fragment,o),x(pr.$$.fragment,o),x(Wa.$$.fragment,o),x(Va.$$.fragment,o),x(mr.$$.fragment,o),x(hr.$$.fragment,o),x(br.$$.fragment,o),x(Ea.$$.fragment,o),x(Ca.$$.fragment,o),x(wr.$$.fragment,o),x(yr.$$.fragment,o),x(jr.$$.fragment,o),x(qa.$$.fragment,o),x(Aa.$$.fragment,o),x(Wr.$$.fragment,o),x(Vr.$$.fragment,o),x(Ma.$$.fragment,o),x(Pr.$$.fragment,o),x(La.$$.fragment,o),x(Oa.$$.fragment,o),x(qr.$$.fragment,o),x(Ar.$$.fragment,o),x(Sa.$$.fragment,o),x(Dr.$$.fragment,o),x(Ia.$$.fragment,o),x(Na.$$.fragment,o),x(Sr.$$.fragment,o),x(Ir.$$.fragment,o),x(Zr.$$.fragment,o),x(Ra.$$.fragment,o),x(Ua.$$.fragment,o),x(Qr.$$.fragment,o),x(Yr.$$.fragment,o),x(li.$$.fragment,o),x(Xa.$$.fragment,o),x(Ga.$$.fragment,o),x(ci.$$.fragment,o),x(di.$$.fragment,o),x(bi.$$.fragment,o),x(Ja.$$.fragment,o),x(Za.$$.fragment,o),Kp=!1},d(o){t(m),o&&t(b),o&&t(f),$(l),o&&t(L),o&&t(A),$(E),o&&t(K),o&&t(S),o&&t(X),o&&t(J),o&&t($e),o&&t(Z),o&&t(De),o&&t(D),o&&t(tt),o&&t(ae),o&&t(ot),o&&t(we),o&&t(at),o&&t(Y),$(B),o&&t(st),o&&t(j),o&&t(It),$(ue,o),o&&t(Nt),o&&t(Se),o&&t(Bt),$(ws,o),o&&t(np),o&&t(Ie),o&&t(rp),o&&t(Ci),o&&t(ip),o&&t(Pi),o&&t(lp),o&&t(lo),$(qs),o&&t(cp),o&&t(Ye),$(As),$(Go),o&&t(dp),o&&t(mo),$(Ms),o&&t(pp),o&&t(ne),$(Ls),$(Ds),$(Ss),$(Is),$(Zo),$(Bs),o&&t(mp),o&&t(ho),$(Rs),o&&t(hp),o&&t(et),$(Us),$(Xs),o&&t(up),o&&t(uo),$(Gs),o&&t(fp),o&&t(G),$(Ks),$(Zs),$(en),$(tn),$(on),$(sa),$(sn),$(rn),o&&t(gp),o&&t(fo),$(cn),o&&t(_p),o&&t(te),$(dn),$(pn),$(un),$(fn),$(da),$(_n),$(vn),$(pa),$(wn),$(ma),o&&t(vp),o&&t(go),$(yn),o&&t(bp),o&&t(ke),o&&t(wp),$(kn,o),o&&t(yp),o&&t(_o),$(Tn),o&&t(kp),o&&t(vo),$(xn),o&&t(Tp),o&&t(bo),$(jn),o&&t(xp),o&&t(wo),$(Wn),o&&t($p),o&&t(zt),$(Fn),$(Cn),o&&t(jp),o&&t(Mt),$(Pn),$(An),o&&t(Wp),o&&t(yo),$(zn),o&&t(Vp),o&&t(qe),$(Mn),$(Nn),$(va),$(ba),o&&t(Fp),o&&t(To),$(Bn),o&&t(Ep),o&&t(Ae),$(Rn),$(Kn),$(ya),$(ka),o&&t(Cp),o&&t(jo),$(Jn),o&&t(Pp),o&&t(fe),$(Zn),$(ar),$(xa),$($a),o&&t(qp),o&&t(Vo),$(sr),o&&t(Ap),o&&t(ge),$(nr),$(pr),$(Wa),$(Va),o&&t(zp),o&&t(Eo),$(mr),o&&t(Mp),o&&t(_e),$(hr),$(br),$(Ea),$(Ca),o&&t(Lp),o&&t(Po),$(wr),o&&t(Op),o&&t(ze),$(yr),$(jr),$(qa),$(Aa),o&&t(Dp),o&&t(zo),$(Wr),o&&t(Sp),o&&t(ve),$(Vr),$(Ma),$(Pr),$(La),$(Oa),o&&t(Ip),o&&t(Lo),$(qr),o&&t(Np),o&&t(be),$(Ar),$(Sa),$(Dr),$(Ia),$(Na),o&&t(Bp),o&&t(Do),$(Sr),o&&t(Rp),o&&t(re),$(Ir),$(Zr),$(Ra),$(Ua),o&&t(Up),o&&t(Io),$(Qr),o&&t(Hp),o&&t(ie),$(Yr),$(li),$(Xa),$(Ga),o&&t(Xp),o&&t(Ro),$(ci),o&&t(Gp),o&&t(le),$(di),$(bi),$(Ja),$(Za)}}}const kx={local:"wav2vec2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Wav2Vec2Config",title:"Wav2Vec2Config"},{local:"transformers.Wav2Vec2CTCTokenizer",title:"Wav2Vec2CTCTokenizer"},{local:"transformers.Wav2Vec2FeatureExtractor",title:"Wav2Vec2FeatureExtractor"},{local:"transformers.Wav2Vec2Processor",title:"Wav2Vec2Processor"},{local:"transformers.Wav2Vec2ProcessorWithLM",sections:[{local:"decoding-multiple-audios",title:"Decoding multiple audios"}],title:"Wav2Vec2ProcessorWithLM"},{local:"transformers.models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput",title:"Wav2Vec2 specific outputs"},{local:"transformers.Wav2Vec2Model",title:"Wav2Vec2Model"},{local:"transformers.Wav2Vec2ForCTC",title:"Wav2Vec2ForCTC"},{local:"transformers.Wav2Vec2ForSequenceClassification",title:"Wav2Vec2ForSequenceClassification"},{local:"transformers.Wav2Vec2ForAudioFrameClassification",title:"Wav2Vec2ForAudioFrameClassification"},{local:"transformers.Wav2Vec2ForXVector",title:"Wav2Vec2ForXVector"},{local:"transformers.Wav2Vec2ForPreTraining",title:"Wav2Vec2ForPreTraining"},{local:"transformers.TFWav2Vec2Model",title:"TFWav2Vec2Model"},{local:"transformers.TFWav2Vec2ForCTC",title:"TFWav2Vec2ForCTC"},{local:"transformers.FlaxWav2Vec2Model",title:"FlaxWav2Vec2Model"},{local:"transformers.FlaxWav2Vec2ForCTC",title:"FlaxWav2Vec2ForCTC"},{local:"transformers.FlaxWav2Vec2ForPreTraining",title:"FlaxWav2Vec2ForPreTraining"}],title:"Wav2Vec2"};function Tx(W){return RT(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cx extends ST{constructor(m){super();IT(this,m,Tx,yx,NT,{})}}export{Cx as default,kx as metadata};
