import{S as ui,i as fi,s as gi,e as n,k as p,w as y,t as s,M as _i,c as a,d as o,m as h,a as r,x as w,h as i,b as c,G as e,g as _,y as T,q as U,o as M,B as S,v as vi,L as Fo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Sn}from"../../chunks/Tip-hf-doc-builder.js";import{D as I}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Jo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as re}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as $o}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function bi(k){let d,b,g,f,v;return f=new Jo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFVuaVNwZWVjaENvbmZpZyUyQyUyMFVuaVNwZWVjaE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFVuaVNwZWVjaCUyMGZhY2Vib29rJTJGdW5pc3BlZWNoLWJhc2UtOTYwaCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBVbmlTcGVlY2hDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwZmFjZWJvb2slMkZ1bmlzcGVlY2gtYmFzZS05NjBoJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBVbmlTcGVlY2hNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> UniSpeechConfig, UniSpeechModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/unispeech-base-960h style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UniSpeechModel(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(){d=n("p"),b=s("Example:"),g=p(),y(f.$$.fragment)},l(l){d=a(l,"P",{});var m=r(d);b=i(m,"Example:"),m.forEach(o),g=h(l),w(f.$$.fragment,l)},m(l,m){_(l,d,m),e(d,b),_(l,g,m),T(f,l,m),v=!0},p:Fo,i(l){v||(U(f.$$.fragment,l),v=!0)},o(l){M(f.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(g),S(f,l)}}}function yi(k){let d,b,g,f,v;return{c(){d=n("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=s("Module"),v=s(`
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){d=a(l,"P",{});var m=r(d);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(m,"CODE",{});var C=r(g);f=i(C,"Module"),C.forEach(o),v=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,b),e(d,g),e(g,f),e(d,v)},d(l){l&&o(d)}}}function wi(k){let d,b,g,f,v;return f=new Jo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVbmlTcGVlY2hNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2RlbW8lMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkYXRhc2V0JTIwJTNEJTIwZGF0YXNldC5zb3J0KCUyMmlkJTIyKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdHJpY2t2b25wbGF0ZW4lMkZ1bmlzcGVlY2gtbGFyZ2UtMTUwMGgtY3YtdGltaXQlMjIpJTBBbW9kZWwlMjAlM0QlMjBVbmlTcGVlY2hNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIycGF0cmlja3ZvbnBsYXRlbiUyRnVuaXNwZWVjaC1sYXJnZS0xNTAwaC1jdi10aW1pdCUyMiklMEElMEElMjMlMjBhdWRpbyUyMGZpbGUlMjBpcyUyMGRlY29kZWQlMjBvbiUyMHRoZSUyMGZseSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihkYXRhc2V0JTVCMCU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyYXJyYXklMjIlNUQlMkMlMjBzYW1wbGluZ19yYXRlJTNEc2FtcGxpbmdfcmF0ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, UniSpeechModel
<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;patrickvonplaten/unispeech-large-1500h-cv-timit&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UniSpeechModel.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/unispeech-large-1500h-cv-timit&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">1024</span>]`}}),{c(){d=n("p"),b=s("Example:"),g=p(),y(f.$$.fragment)},l(l){d=a(l,"P",{});var m=r(d);b=i(m,"Example:"),m.forEach(o),g=h(l),w(f.$$.fragment,l)},m(l,m){_(l,d,m),e(d,b),_(l,g,m),T(f,l,m),v=!0},p:Fo,i(l){v||(U(f.$$.fragment,l),v=!0)},o(l){M(f.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(g),S(f,l)}}}function Ti(k){let d,b,g,f,v;return{c(){d=n("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=s("Module"),v=s(`
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){d=a(l,"P",{});var m=r(d);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(m,"CODE",{});var C=r(g);f=i(C,"Module"),C.forEach(o),v=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,b),e(d,g),e(g,f),e(d,v)},d(l){l&&o(d)}}}function Ui(k){let d,b,g,f,v;return f=new Jo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBVbmlTcGVlY2hGb3JDVEMlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmxpYnJpc3BlZWNoX2Fzcl9kZW1vJTIyJTJDJTIwJTIyY2xlYW4lMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIpJTBBZGF0YXNldCUyMCUzRCUyMGRhdGFzZXQuc29ydCglMjJpZCUyMiklMEFzYW1wbGluZ19yYXRlJTIwJTNEJTIwZGF0YXNldC5mZWF0dXJlcyU1QiUyMmF1ZGlvJTIyJTVELnNhbXBsaW5nX3JhdGUlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJwYXRyaWNrdm9ucGxhdGVuJTJGdW5pc3BlZWNoLWxhcmdlLTE1MDBoLWN2LXRpbWl0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVW5pU3BlZWNoRm9yQ1RDLmZyb21fcHJldHJhaW5lZCglMjJwYXRyaWNrdm9ucGxhdGVuJTJGdW5pc3BlZWNoLWxhcmdlLTE1MDBoLWN2LXRpbWl0JTIyKSUwQSUwQSUyMyUyMGF1ZGlvJTIwZmlsZSUyMGlzJTIwZGVjb2RlZCUyMG9uJTIwdGhlJTIwZmx5JTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGRhdGFzZXQlNUIwJTVEJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUyQyUyMHNhbXBsaW5nX3JhdGUlM0RzYW1wbGluZ19yYXRlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQXByZWRpY3RlZF9pZHMlMjAlM0QlMjB0b3JjaC5hcmdtYXgobG9naXRzJTJDJTIwZGltJTNELTEpJTBBJTBBJTIzJTIwdHJhbnNjcmliZSUyMHNwZWVjaCUwQXRyYW5zY3JpcHRpb24lMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKHByZWRpY3RlZF9pZHMpJTBBdHJhbnNjcmlwdGlvbiU1QjAlNUQlMEElMEFpbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRGRhdGFzZXQlNUIwJTVEJTVCJTIydGV4dCUyMiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcyUwQSUwQSUyMyUyMGNvbXB1dGUlMjBsb3NzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb3NzJTBBcm91bmQobG9zcy5pdGVtKCklMkMlMjAyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, UniSpeechForCTC
<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;patrickvonplaten/unispeech-large-1500h-cv-timit&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UniSpeechForCTC.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/unispeech-large-1500h-cv-timit&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 apposl of the midle classes and weare glad to welcom his gosepl&#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">17.17</span>`}}),{c(){d=n("p"),b=s("Example:"),g=p(),y(f.$$.fragment)},l(l){d=a(l,"P",{});var m=r(d);b=i(m,"Example:"),m.forEach(o),g=h(l),w(f.$$.fragment,l)},m(l,m){_(l,d,m),e(d,b),_(l,g,m),T(f,l,m),v=!0},p:Fo,i(l){v||(U(f.$$.fragment,l),v=!0)},o(l){M(f.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(g),S(f,l)}}}function Mi(k){let d,b,g,f,v;return{c(){d=n("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=s("Module"),v=s(`
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){d=a(l,"P",{});var m=r(d);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(m,"CODE",{});var C=r(g);f=i(C,"Module"),C.forEach(o),v=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,b),e(d,g),e(g,f),e(d,v)},d(l){l&&o(d)}}}function Si(k){let d,b,g,f,v;return f=new Jo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9GZWF0dXJlRXh0cmFjdG9yJTJDJTIwVW5pU3BlZWNoRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2RlbW8lMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkYXRhc2V0JTIwJTNEJTIwZGF0YXNldC5zb3J0KCUyMmlkJTIyKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdHJpY2t2b25wbGF0ZW4lMkZ1bmlzcGVlY2gtbGFyZ2UtMTUwMGgtY3YtdGltaXQlMjIpJTBBbW9kZWwlMjAlM0QlMjBVbmlTcGVlY2hGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJwYXRyaWNrdm9ucGxhdGVuJTJGdW5pc3BlZWNoLWxhcmdlLTE1MDBoLWN2LXRpbWl0JTIyKSUwQSUwQSUyMyUyMGF1ZGlvJTIwZmlsZSUyMGlzJTIwZGVjb2RlZCUyMG9uJTIwdGhlJTIwZmx5JTBBaW5wdXRzJTIwJTNEJTIwZmVhdHVyZV9leHRyYWN0b3IoZGF0YXNldCU1QjAlNUQlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVEJTJDJTIwc2FtcGxpbmdfcmF0ZSUzRHNhbXBsaW5nX3JhdGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkcyUyMCUzRCUyMHRvcmNoLmFyZ21heChsb2dpdHMlMkMlMjBkaW0lM0QtMSkuaXRlbSgpJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2NsYXNzX2lkcyU1RCUwQSUwQSUyMyUyMGNvbXB1dGUlMjBsb3NzJTIwLSUyMHRhcmdldF9sYWJlbCUyMGlzJTIwZS5nLiUyMCUyMmRvd24lMjIlMEF0YXJnZXRfbGFiZWwlMjAlM0QlMjBtb2RlbC5jb25maWcuaWQybGFiZWwlNUIwJTVEJTBBaW5wdXRzJTVCJTIybGFiZWxzJTIyJTVEJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1Qm1vZGVsLmNvbmZpZy5sYWJlbDJpZCU1QnRhcmdldF9sYWJlbCU1RCU1RCklMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, UniSpeechForSequenceClassification
<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;patrickvonplaten/unispeech-large-1500h-cv-timit&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UniSpeechForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;patrickvonplaten/unispeech-large-1500h-cv-timit&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><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`}}),{c(){d=n("p"),b=s("Example:"),g=p(),y(f.$$.fragment)},l(l){d=a(l,"P",{});var m=r(d);b=i(m,"Example:"),m.forEach(o),g=h(l),w(f.$$.fragment,l)},m(l,m){_(l,d,m),e(d,b),_(l,g,m),T(f,l,m),v=!0},p:Fo,i(l){v||(U(f.$$.fragment,l),v=!0)},o(l){M(f.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(g),S(f,l)}}}function ki(k){let d,b,g,f,v;return{c(){d=n("p"),b=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=s("Module"),v=s(`
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){d=a(l,"P",{});var m=r(d);b=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(m,"CODE",{});var C=r(g);f=i(C,"Module"),C.forEach(o),v=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,b),e(d,g),e(g,f),e(d,v)},d(l){l&&o(d)}}}function Ci(k){let d,b,g,f,v;return f=new Jo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IlMkMlMjBVbmlTcGVlY2hGb3JQcmVUcmFpbmluZyUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnVuaXNwZWVjaC1sYXJnZS0xNTAwaC1jdiUyMiklMEFtb2RlbCUyMCUzRCUyMFVuaVNwZWVjaEZvclByZVRyYWluaW5nLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZ1bmlzcGVlY2gtbGFyZ2UtMTUwMGgtY3YlMjIpJTBBJTIzJTIwVE9ETyUzQSUyMEFkZCUyMGZ1bGwlMjBwcmV0cmFpbmluZyUyMGV4YW1wbGU=",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, UniSpeechForPreTraining

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;microsoft/unispeech-large-1500h-cv&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = UniSpeechForPreTraining.from_pretrained(<span class="hljs-string">&quot;microsoft/unispeech-large-1500h-cv&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># <span class="hljs-doctag">TODO:</span> Add full pretraining example</span>`}}),{c(){d=n("p"),b=s("Example:"),g=p(),y(f.$$.fragment)},l(l){d=a(l,"P",{});var m=r(d);b=i(m,"Example:"),m.forEach(o),g=h(l),w(f.$$.fragment,l)},m(l,m){_(l,d,m),e(d,b),_(l,g,m),T(f,l,m),v=!0},p:Fo,i(l){v||(U(f.$$.fragment,l),v=!0)},o(l){M(f.$$.fragment,l),v=!1},d(l){l&&o(d),l&&o(g),S(f,l)}}}function ji(k){let d,b,g,f,v,l,m,C,kn,xo,X,se,Dt,Je,Cn,Ht,jn,Eo,ie,$n,xe,Fn,Jn,Wo,Mt,xn,Zo,St,Ot,En,zo,kt,Wn,qo,le,Ee,Zn,Ct,zn,qn,Gn,We,Nn,jt,Vn,Pn,Go,G,In,Ze,Xn,Rn,ze,Yn,Bn,No,R,ce,Kt,qe,An,eo,Qn,Vo,de,to,$t,Ln,Dn,oo,Ft,Hn,Po,Y,pe,no,Ge,On,ao,Kn,Io,x,Ne,ea,B,ta,Jt,oa,na,Ve,aa,ra,sa,A,ia,xt,la,ca,Et,da,pa,ha,he,Xo,Q,me,ro,Pe,ma,so,ua,Ro,L,Ie,fa,Xe,ga,io,_a,va,Yo,D,ue,lo,Re,ba,co,ya,Bo,$,Ye,wa,Be,Ta,Ae,Ua,Ma,Sa,Qe,ka,Wt,Ca,ja,$a,Le,Fa,De,Ja,xa,Ea,E,He,Wa,H,Za,Zt,za,qa,po,Ga,Na,Va,fe,Pa,ge,Ao,O,_e,ho,Oe,Ia,mo,Xa,Qo,F,Ke,Ra,K,Ya,uo,Ba,Aa,et,Qa,La,Da,tt,Ha,zt,Oa,Ka,er,ot,tr,nt,or,nr,ar,W,at,rr,ee,sr,qt,ir,lr,fo,cr,dr,pr,ve,hr,be,Lo,te,ye,go,rt,mr,_o,ur,Do,j,st,fr,vo,gr,_r,it,vr,lt,br,yr,wr,ct,Tr,Gt,Ur,Mr,Sr,dt,kr,pt,Cr,jr,$r,Z,ht,Fr,oe,Jr,Nt,xr,Er,bo,Wr,Zr,zr,we,qr,Te,Ho,ne,Ue,yo,mt,Gr,wo,Nr,Oo,J,ut,Vr,ft,Pr,gt,Ir,Xr,Rr,_t,Yr,Vt,Br,Ar,Qr,vt,Lr,bt,Dr,Hr,Or,z,yt,Kr,ae,es,Pt,ts,os,To,ns,as,rs,Me,ss,Se,Ko;return l=new re({}),Je=new re({}),qe=new re({}),Ge=new re({}),Ne=new I({props:{name:"class transformers.UniSpeechConfig",anchor:"transformers.UniSpeechConfig",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:" = 'mean'"},{name:"ctc_zero_infinity",val:" = False"},{name:"use_weighted_layer_sum",val:" = False"},{name:"classifier_proj_size",val:" = 256"},{name:"num_ctc_classes",val:" = 80"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"replace_prob",val:" = 0.5"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.UniSpeechConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Vocabulary size of the UniSpeech model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechModel">UniSpeechModel</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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechModel">UniSpeechModel</a>.`,name:"vocab_size"},{anchor:"transformers.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForCTC">UniSpeechForCTC</a>.`,name:"final_dropout"},{anchor:"transformers.UniSpeechConfig.layerdrop",description:`<strong>layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The LayerDrop probability. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>) for more
details.`,name:"layerdrop"},{anchor:"transformers.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.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.UniSpeechConfig.ctc_loss_reduction",description:`<strong>ctc_loss_reduction</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;mean&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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForCTC">UniSpeechForCTC</a>.`,name:"ctc_loss_reduction"},{anchor:"transformers.UniSpeechConfig.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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForCTC">UniSpeechForCTC</a>.`,name:"ctc_zero_infinity"},{anchor:"transformers.UniSpeechConfig.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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForSequenceClassification">UniSpeechForSequenceClassification</a>.`,name:"use_weighted_layer_sum"},{anchor:"transformers.UniSpeechConfig.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.UniSpeechConfig.replace_prob",description:`<strong>replace_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Propability that transformer feature is replaced by quantized feature for pretraining.`,name:"replace_prob"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/configuration_unispeech.py#L34"}}),he=new $o({props:{anchor:"transformers.UniSpeechConfig.example",$$slots:{default:[bi]},$$scope:{ctx:k}}}),Pe=new re({}),Ie=new I({props:{name:"class transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput",anchor:"transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput",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"}],parametersDescription:[{anchor:"transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput.loss",description:`<strong>loss</strong> (<em>optional</em>, returned when model is in train mode, <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.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput.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.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput.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.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput.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.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput.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/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L67"}}),Re=new re({}),Ye=new I({props:{name:"class transformers.UniSpeechModel",anchor:"transformers.UniSpeechModel",parameters:[{name:"config",val:": UniSpeechConfig"}],parametersDescription:[{anchor:"transformers.UniSpeechModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig">UniSpeechConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1107"}}),He=new I({props:{name:"forward",anchor:"transformers.UniSpeechModel.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.UniSpeechModel.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/v4.31.0/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/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.UniSpeechModel.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>, <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.UniSpeechModel.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.UniSpeechModel.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.UniSpeechModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1172",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig"
>UniSpeechConfig</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/v4.31.0/en/model_doc/wav2vec2#transformers.modeling_outputs.Wav2Vec2BaseModelOutput"
>transformers.modeling_outputs.Wav2Vec2BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),fe=new Sn({props:{$$slots:{default:[yi]},$$scope:{ctx:k}}}),ge=new $o({props:{anchor:"transformers.UniSpeechModel.forward.example",$$slots:{default:[wi]},$$scope:{ctx:k}}}),Oe=new re({}),Ke=new I({props:{name:"class transformers.UniSpeechForCTC",anchor:"transformers.UniSpeechForCTC",parameters:[{name:"config",val:""},{name:"target_lang",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.UniSpeechForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig">UniSpeechConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1379"}}),at=new I({props:{name:"forward",anchor:"transformers.UniSpeechForCTC.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.UniSpeechForCTC.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/v4.31.0/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/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.UniSpeechForCTC.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>, <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.UniSpeechForCTC.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.UniSpeechForCTC.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.UniSpeechForCTC.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.UniSpeechForCTC.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/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1451",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig"
>UniSpeechConfig</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/v4.31.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ve=new Sn({props:{$$slots:{default:[Ti]},$$scope:{ctx:k}}}),be=new $o({props:{anchor:"transformers.UniSpeechForCTC.forward.example",$$slots:{default:[Ui]},$$scope:{ctx:k}}}),rt=new re({}),st=new I({props:{name:"class transformers.UniSpeechForSequenceClassification",anchor:"transformers.UniSpeechForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.UniSpeechForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig">UniSpeechConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1538"}}),ht=new I({props:{name:"forward",anchor:"transformers.UniSpeechForSequenceClassification.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.UniSpeechForSequenceClassification.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/v4.31.0/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/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.UniSpeechForSequenceClassification.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>, <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.UniSpeechForSequenceClassification.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.UniSpeechForSequenceClassification.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.UniSpeechForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.UniSpeechForSequenceClassification.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/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1586",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/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/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig"
>UniSpeechConfig</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/v4.31.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),we=new Sn({props:{$$slots:{default:[Mi]},$$scope:{ctx:k}}}),Te=new $o({props:{anchor:"transformers.UniSpeechForSequenceClassification.forward.example",$$slots:{default:[Si]},$$scope:{ctx:k}}}),mt=new re({}),ut=new I({props:{name:"class transformers.UniSpeechForPreTraining",anchor:"transformers.UniSpeechForPreTraining",parameters:[{name:"config",val:": UniSpeechConfig"}],parametersDescription:[{anchor:"transformers.UniSpeechForPreTraining.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig">UniSpeechConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1231"}}),yt=new I({props:{name:"forward",anchor:"transformers.UniSpeechForPreTraining.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"}],parametersDescription:[{anchor:"transformers.UniSpeechForPreTraining.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/v4.31.0/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/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor.__call__">Wav2Vec2Processor.<strong>call</strong>()</a> for details.`,name:"input_values"},{anchor:"transformers.UniSpeechForPreTraining.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>, <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.UniSpeechForPreTraining.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.UniSpeechForPreTraining.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.UniSpeechForPreTraining.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.UniSpeechForPreTraining.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.UniSpeechForPreTraining.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/v4.31.0/src/transformers/models/unispeech/modeling_unispeech.py#L1292",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput"
>transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechConfig"
>UniSpeechConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<em>optional</em>, returned when model is in train mode, <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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput"
>transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new Sn({props:{$$slots:{default:[ki]},$$scope:{ctx:k}}}),Se=new $o({props:{anchor:"transformers.UniSpeechForPreTraining.forward.example",$$slots:{default:[Ci]},$$scope:{ctx:k}}}),{c(){d=n("meta"),b=p(),g=n("h1"),f=n("a"),v=n("span"),y(l.$$.fragment),m=p(),C=n("span"),kn=s("UniSpeech"),xo=p(),X=n("h2"),se=n("a"),Dt=n("span"),y(Je.$$.fragment),Cn=p(),Ht=n("span"),jn=s("Overview"),Eo=p(),ie=n("p"),$n=s("The UniSpeech model was proposed in "),xe=n("a"),Fn=s("UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data"),Jn=s(` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael
Zeng, Xuedong Huang .`),Wo=p(),Mt=n("p"),xn=s("The abstract from the paper is the following:"),Zo=p(),St=n("p"),Ot=n("em"),En=s(`In this paper, we propose a unified pre-training approach called UniSpeech to learn speech representations with both
unlabeled and labeled data, in which supervised phonetic CTC learning and phonetically-aware contrastive
self-supervised learning are conducted in a multi-task learning manner. The resultant representations can capture
information more correlated with phonetic structures and improve the generalization across languages and domains. We
evaluate the effectiveness of UniSpeech for cross-lingual representation learning on public CommonVoice corpus. The
results show that UniSpeech outperforms self-supervised pretraining and supervised transfer learning for speech
recognition by a maximum of 13.4% and 17.8% relative phone error rate reductions respectively (averaged over all
testing languages). The transferability of UniSpeech is also demonstrated on a domain-shift speech recognition task,
i.e., a relative word error rate reduction of 6% against the previous approach.`),zo=p(),kt=n("p"),Wn=s("Tips:"),qo=p(),le=n("ul"),Ee=n("li"),Zn=s(`UniSpeech is a speech model that accepts a float array corresponding to the raw waveform of the speech signal. Please
use `),Ct=n("a"),zn=s("Wav2Vec2Processor"),qn=s(" for the feature extraction."),Gn=p(),We=n("li"),Nn=s(`UniSpeech model can be fine-tuned using connectionist temporal classification (CTC) so the model output has to be
decoded using `),jt=n("a"),Vn=s("Wav2Vec2CTCTokenizer"),Pn=s("."),Go=p(),G=n("p"),In=s("This model was contributed by "),Ze=n("a"),Xn=s("patrickvonplaten"),Rn=s(`. The Authors\u2019 code can be
found `),ze=n("a"),Yn=s("here"),Bn=s("."),No=p(),R=n("h2"),ce=n("a"),Kt=n("span"),y(qe.$$.fragment),An=p(),eo=n("span"),Qn=s("Documentation resources"),Vo=p(),de=n("ul"),to=n("li"),$t=n("a"),Ln=s("Audio classification task guide"),Dn=p(),oo=n("li"),Ft=n("a"),Hn=s("Automatic speech recognition task guide"),Po=p(),Y=n("h2"),pe=n("a"),no=n("span"),y(Ge.$$.fragment),On=p(),ao=n("span"),Kn=s("UniSpeechConfig"),Io=p(),x=n("div"),y(Ne.$$.fragment),ea=p(),B=n("p"),ta=s("This is the configuration class to store the configuration of a "),Jt=n("a"),oa=s("UniSpeechModel"),na=s(`. It is used to instantiate an
UniSpeech 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 UniSpeech
`),Ve=n("a"),aa=s("microsoft/unispeech-large-1500h-cv"),ra=s(" architecture."),sa=p(),A=n("p"),ia=s("Configuration objects inherit from "),xt=n("a"),la=s("PretrainedConfig"),ca=s(` and can be used to control the model outputs. Read the
documentation from `),Et=n("a"),da=s("PretrainedConfig"),pa=s(" for more information."),ha=p(),y(he.$$.fragment),Xo=p(),Q=n("h2"),me=n("a"),ro=n("span"),y(Pe.$$.fragment),ma=p(),so=n("span"),ua=s("UniSpeech specific outputs"),Ro=p(),L=n("div"),y(Ie.$$.fragment),fa=p(),Xe=n("p"),ga=s("Output type of "),io=n("code"),_a=s("UniSpeechForPreTrainingOutput"),va=s(", with potential hidden states and attentions."),Yo=p(),D=n("h2"),ue=n("a"),lo=n("span"),y(Re.$$.fragment),ba=p(),co=n("span"),ya=s("UniSpeechModel"),Bo=p(),$=n("div"),y(Ye.$$.fragment),wa=p(),Be=n("p"),Ta=s(`The bare UniSpeech Model transformer outputting raw hidden-states without any specific head on top.
UniSpeech was proposed in `),Ae=n("a"),Ua=s(`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),Ma=s(` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),Sa=p(),Qe=n("p"),ka=s("This model inherits from "),Wt=n("a"),Ca=s("PreTrainedModel"),ja=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),$a=p(),Le=n("p"),Fa=s("This model is a PyTorch "),De=n("a"),Ja=s("torch.nn.Module"),xa=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ea=p(),E=n("div"),y(He.$$.fragment),Wa=p(),H=n("p"),Za=s("The "),Zt=n("a"),za=s("UniSpeechModel"),qa=s(" forward method, overrides the "),po=n("code"),Ga=s("__call__"),Na=s(" special method."),Va=p(),y(fe.$$.fragment),Pa=p(),y(ge.$$.fragment),Ao=p(),O=n("h2"),_e=n("a"),ho=n("span"),y(Oe.$$.fragment),Ia=p(),mo=n("span"),Xa=s("UniSpeechForCTC"),Qo=p(),F=n("div"),y(Ke.$$.fragment),Ra=p(),K=n("p"),Ya=s("UniSpeech Model with a "),uo=n("code"),Ba=s("language modeling"),Aa=s(` head on top for Connectionist Temporal Classification (CTC).
UniSpeech was proposed in `),et=n("a"),Qa=s(`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),La=s(` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),Da=p(),tt=n("p"),Ha=s("This model inherits from "),zt=n("a"),Oa=s("PreTrainedModel"),Ka=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),er=p(),ot=n("p"),tr=s("This model is a PyTorch "),nt=n("a"),or=s("torch.nn.Module"),nr=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ar=p(),W=n("div"),y(at.$$.fragment),rr=p(),ee=n("p"),sr=s("The "),qt=n("a"),ir=s("UniSpeechForCTC"),lr=s(" forward method, overrides the "),fo=n("code"),cr=s("__call__"),dr=s(" special method."),pr=p(),y(ve.$$.fragment),hr=p(),y(be.$$.fragment),Lo=p(),te=n("h2"),ye=n("a"),go=n("span"),y(rt.$$.fragment),mr=p(),_o=n("span"),ur=s("UniSpeechForSequenceClassification"),Do=p(),j=n("div"),y(st.$$.fragment),fr=p(),vo=n("p"),gr=s(`UniSpeech Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),_r=p(),it=n("p"),vr=s("UniSpeech was proposed in "),lt=n("a"),br=s(`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),yr=s(` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),wr=p(),ct=n("p"),Tr=s("This model inherits from "),Gt=n("a"),Ur=s("PreTrainedModel"),Mr=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Sr=p(),dt=n("p"),kr=s("This model is a PyTorch "),pt=n("a"),Cr=s("torch.nn.Module"),jr=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$r=p(),Z=n("div"),y(ht.$$.fragment),Fr=p(),oe=n("p"),Jr=s("The "),Nt=n("a"),xr=s("UniSpeechForSequenceClassification"),Er=s(" forward method, overrides the "),bo=n("code"),Wr=s("__call__"),Zr=s(" special method."),zr=p(),y(we.$$.fragment),qr=p(),y(Te.$$.fragment),Ho=p(),ne=n("h2"),Ue=n("a"),yo=n("span"),y(mt.$$.fragment),Gr=p(),wo=n("span"),Nr=s("UniSpeechForPreTraining"),Oo=p(),J=n("div"),y(ut.$$.fragment),Vr=p(),ft=n("p"),Pr=s(`UniSpeech Model with a vector-quantization module and ctc loss for pre-training.
UniSpeech was proposed in `),gt=n("a"),Ir=s(`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),Xr=s(` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),Rr=p(),_t=n("p"),Yr=s("This model inherits from "),Vt=n("a"),Br=s("PreTrainedModel"),Ar=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Qr=p(),vt=n("p"),Lr=s("This model is a PyTorch "),bt=n("a"),Dr=s("torch.nn.Module"),Hr=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Or=p(),z=n("div"),y(yt.$$.fragment),Kr=p(),ae=n("p"),es=s("The "),Pt=n("a"),ts=s("UniSpeechForPreTraining"),os=s(" forward method, overrides the "),To=n("code"),ns=s("__call__"),as=s(" special method."),rs=p(),y(Me.$$.fragment),ss=p(),y(Se.$$.fragment),this.h()},l(t){const u=_i('[data-svelte="svelte-1phssyn"]',document.head);d=a(u,"META",{name:!0,content:!0}),u.forEach(o),b=h(t),g=a(t,"H1",{class:!0});var wt=r(g);f=a(wt,"A",{id:!0,class:!0,href:!0});var Uo=r(f);v=a(Uo,"SPAN",{});var Mo=r(v);w(l.$$.fragment,Mo),Mo.forEach(o),Uo.forEach(o),m=h(wt),C=a(wt,"SPAN",{});var So=r(C);kn=i(So,"UniSpeech"),So.forEach(o),wt.forEach(o),xo=h(t),X=a(t,"H2",{class:!0});var Tt=r(X);se=a(Tt,"A",{id:!0,class:!0,href:!0});var ko=r(se);Dt=a(ko,"SPAN",{});var Co=r(Dt);w(Je.$$.fragment,Co),Co.forEach(o),ko.forEach(o),Cn=h(Tt),Ht=a(Tt,"SPAN",{});var jo=r(Ht);jn=i(jo,"Overview"),jo.forEach(o),Tt.forEach(o),Eo=h(t),ie=a(t,"P",{});var Ut=r(ie);$n=i(Ut,"The UniSpeech model was proposed in "),xe=a(Ut,"A",{href:!0,rel:!0});var is=r(xe);Fn=i(is,"UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data"),is.forEach(o),Jn=i(Ut,` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael
Zeng, Xuedong Huang .`),Ut.forEach(o),Wo=h(t),Mt=a(t,"P",{});var ls=r(Mt);xn=i(ls,"The abstract from the paper is the following:"),ls.forEach(o),Zo=h(t),St=a(t,"P",{});var cs=r(St);Ot=a(cs,"EM",{});var ds=r(Ot);En=i(ds,`In this paper, we propose a unified pre-training approach called UniSpeech to learn speech representations with both
unlabeled and labeled data, in which supervised phonetic CTC learning and phonetically-aware contrastive
self-supervised learning are conducted in a multi-task learning manner. The resultant representations can capture
information more correlated with phonetic structures and improve the generalization across languages and domains. We
evaluate the effectiveness of UniSpeech for cross-lingual representation learning on public CommonVoice corpus. The
results show that UniSpeech outperforms self-supervised pretraining and supervised transfer learning for speech
recognition by a maximum of 13.4% and 17.8% relative phone error rate reductions respectively (averaged over all
testing languages). The transferability of UniSpeech is also demonstrated on a domain-shift speech recognition task,
i.e., a relative word error rate reduction of 6% against the previous approach.`),ds.forEach(o),cs.forEach(o),zo=h(t),kt=a(t,"P",{});var ps=r(kt);Wn=i(ps,"Tips:"),ps.forEach(o),qo=h(t),le=a(t,"UL",{});var en=r(le);Ee=a(en,"LI",{});var tn=r(Ee);Zn=i(tn,`UniSpeech is a speech model that accepts a float array corresponding to the raw waveform of the speech signal. Please
use `),Ct=a(tn,"A",{href:!0});var hs=r(Ct);zn=i(hs,"Wav2Vec2Processor"),hs.forEach(o),qn=i(tn," for the feature extraction."),tn.forEach(o),Gn=h(en),We=a(en,"LI",{});var on=r(We);Nn=i(on,`UniSpeech model can be fine-tuned using connectionist temporal classification (CTC) so the model output has to be
decoded using `),jt=a(on,"A",{href:!0});var ms=r(jt);Vn=i(ms,"Wav2Vec2CTCTokenizer"),ms.forEach(o),Pn=i(on,"."),on.forEach(o),en.forEach(o),Go=h(t),G=a(t,"P",{});var It=r(G);In=i(It,"This model was contributed by "),Ze=a(It,"A",{href:!0,rel:!0});var us=r(Ze);Xn=i(us,"patrickvonplaten"),us.forEach(o),Rn=i(It,`. The Authors\u2019 code can be
found `),ze=a(It,"A",{href:!0,rel:!0});var fs=r(ze);Yn=i(fs,"here"),fs.forEach(o),Bn=i(It,"."),It.forEach(o),No=h(t),R=a(t,"H2",{class:!0});var nn=r(R);ce=a(nn,"A",{id:!0,class:!0,href:!0});var gs=r(ce);Kt=a(gs,"SPAN",{});var _s=r(Kt);w(qe.$$.fragment,_s),_s.forEach(o),gs.forEach(o),An=h(nn),eo=a(nn,"SPAN",{});var vs=r(eo);Qn=i(vs,"Documentation resources"),vs.forEach(o),nn.forEach(o),Vo=h(t),de=a(t,"UL",{});var an=r(de);to=a(an,"LI",{});var bs=r(to);$t=a(bs,"A",{href:!0});var ys=r($t);Ln=i(ys,"Audio classification task guide"),ys.forEach(o),bs.forEach(o),Dn=h(an),oo=a(an,"LI",{});var ws=r(oo);Ft=a(ws,"A",{href:!0});var Ts=r(Ft);Hn=i(Ts,"Automatic speech recognition task guide"),Ts.forEach(o),ws.forEach(o),an.forEach(o),Po=h(t),Y=a(t,"H2",{class:!0});var rn=r(Y);pe=a(rn,"A",{id:!0,class:!0,href:!0});var Us=r(pe);no=a(Us,"SPAN",{});var Ms=r(no);w(Ge.$$.fragment,Ms),Ms.forEach(o),Us.forEach(o),On=h(rn),ao=a(rn,"SPAN",{});var Ss=r(ao);Kn=i(Ss,"UniSpeechConfig"),Ss.forEach(o),rn.forEach(o),Io=h(t),x=a(t,"DIV",{class:!0});var ke=r(x);w(Ne.$$.fragment,ke),ea=h(ke),B=a(ke,"P",{});var Xt=r(B);ta=i(Xt,"This is the configuration class to store the configuration of a "),Jt=a(Xt,"A",{href:!0});var ks=r(Jt);oa=i(ks,"UniSpeechModel"),ks.forEach(o),na=i(Xt,`. It is used to instantiate an
UniSpeech 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 UniSpeech
`),Ve=a(Xt,"A",{href:!0,rel:!0});var Cs=r(Ve);aa=i(Cs,"microsoft/unispeech-large-1500h-cv"),Cs.forEach(o),ra=i(Xt," architecture."),Xt.forEach(o),sa=h(ke),A=a(ke,"P",{});var Rt=r(A);ia=i(Rt,"Configuration objects inherit from "),xt=a(Rt,"A",{href:!0});var js=r(xt);la=i(js,"PretrainedConfig"),js.forEach(o),ca=i(Rt,` and can be used to control the model outputs. Read the
documentation from `),Et=a(Rt,"A",{href:!0});var $s=r(Et);da=i($s,"PretrainedConfig"),$s.forEach(o),pa=i(Rt," for more information."),Rt.forEach(o),ha=h(ke),w(he.$$.fragment,ke),ke.forEach(o),Xo=h(t),Q=a(t,"H2",{class:!0});var sn=r(Q);me=a(sn,"A",{id:!0,class:!0,href:!0});var Fs=r(me);ro=a(Fs,"SPAN",{});var Js=r(ro);w(Pe.$$.fragment,Js),Js.forEach(o),Fs.forEach(o),ma=h(sn),so=a(sn,"SPAN",{});var xs=r(so);ua=i(xs,"UniSpeech specific outputs"),xs.forEach(o),sn.forEach(o),Ro=h(t),L=a(t,"DIV",{class:!0});var ln=r(L);w(Ie.$$.fragment,ln),fa=h(ln),Xe=a(ln,"P",{});var cn=r(Xe);ga=i(cn,"Output type of "),io=a(cn,"CODE",{});var Es=r(io);_a=i(Es,"UniSpeechForPreTrainingOutput"),Es.forEach(o),va=i(cn,", with potential hidden states and attentions."),cn.forEach(o),ln.forEach(o),Yo=h(t),D=a(t,"H2",{class:!0});var dn=r(D);ue=a(dn,"A",{id:!0,class:!0,href:!0});var Ws=r(ue);lo=a(Ws,"SPAN",{});var Zs=r(lo);w(Re.$$.fragment,Zs),Zs.forEach(o),Ws.forEach(o),ba=h(dn),co=a(dn,"SPAN",{});var zs=r(co);ya=i(zs,"UniSpeechModel"),zs.forEach(o),dn.forEach(o),Bo=h(t),$=a(t,"DIV",{class:!0});var N=r($);w(Ye.$$.fragment,N),wa=h(N),Be=a(N,"P",{});var pn=r(Be);Ta=i(pn,`The bare UniSpeech Model transformer outputting raw hidden-states without any specific head on top.
UniSpeech was proposed in `),Ae=a(pn,"A",{href:!0,rel:!0});var qs=r(Ae);Ua=i(qs,`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),qs.forEach(o),Ma=i(pn,` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),pn.forEach(o),Sa=h(N),Qe=a(N,"P",{});var hn=r(Qe);ka=i(hn,"This model inherits from "),Wt=a(hn,"A",{href:!0});var Gs=r(Wt);Ca=i(Gs,"PreTrainedModel"),Gs.forEach(o),ja=i(hn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),hn.forEach(o),$a=h(N),Le=a(N,"P",{});var mn=r(Le);Fa=i(mn,"This model is a PyTorch "),De=a(mn,"A",{href:!0,rel:!0});var Ns=r(De);Ja=i(Ns,"torch.nn.Module"),Ns.forEach(o),xa=i(mn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),mn.forEach(o),Ea=h(N),E=a(N,"DIV",{class:!0});var Ce=r(E);w(He.$$.fragment,Ce),Wa=h(Ce),H=a(Ce,"P",{});var Yt=r(H);Za=i(Yt,"The "),Zt=a(Yt,"A",{href:!0});var Vs=r(Zt);za=i(Vs,"UniSpeechModel"),Vs.forEach(o),qa=i(Yt," forward method, overrides the "),po=a(Yt,"CODE",{});var Ps=r(po);Ga=i(Ps,"__call__"),Ps.forEach(o),Na=i(Yt," special method."),Yt.forEach(o),Va=h(Ce),w(fe.$$.fragment,Ce),Pa=h(Ce),w(ge.$$.fragment,Ce),Ce.forEach(o),N.forEach(o),Ao=h(t),O=a(t,"H2",{class:!0});var un=r(O);_e=a(un,"A",{id:!0,class:!0,href:!0});var Is=r(_e);ho=a(Is,"SPAN",{});var Xs=r(ho);w(Oe.$$.fragment,Xs),Xs.forEach(o),Is.forEach(o),Ia=h(un),mo=a(un,"SPAN",{});var Rs=r(mo);Xa=i(Rs,"UniSpeechForCTC"),Rs.forEach(o),un.forEach(o),Qo=h(t),F=a(t,"DIV",{class:!0});var V=r(F);w(Ke.$$.fragment,V),Ra=h(V),K=a(V,"P",{});var Bt=r(K);Ya=i(Bt,"UniSpeech Model with a "),uo=a(Bt,"CODE",{});var Ys=r(uo);Ba=i(Ys,"language modeling"),Ys.forEach(o),Aa=i(Bt,` head on top for Connectionist Temporal Classification (CTC).
UniSpeech was proposed in `),et=a(Bt,"A",{href:!0,rel:!0});var Bs=r(et);Qa=i(Bs,`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),Bs.forEach(o),La=i(Bt,` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),Bt.forEach(o),Da=h(V),tt=a(V,"P",{});var fn=r(tt);Ha=i(fn,"This model inherits from "),zt=a(fn,"A",{href:!0});var As=r(zt);Oa=i(As,"PreTrainedModel"),As.forEach(o),Ka=i(fn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),fn.forEach(o),er=h(V),ot=a(V,"P",{});var gn=r(ot);tr=i(gn,"This model is a PyTorch "),nt=a(gn,"A",{href:!0,rel:!0});var Qs=r(nt);or=i(Qs,"torch.nn.Module"),Qs.forEach(o),nr=i(gn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),gn.forEach(o),ar=h(V),W=a(V,"DIV",{class:!0});var je=r(W);w(at.$$.fragment,je),rr=h(je),ee=a(je,"P",{});var At=r(ee);sr=i(At,"The "),qt=a(At,"A",{href:!0});var Ls=r(qt);ir=i(Ls,"UniSpeechForCTC"),Ls.forEach(o),lr=i(At," forward method, overrides the "),fo=a(At,"CODE",{});var Ds=r(fo);cr=i(Ds,"__call__"),Ds.forEach(o),dr=i(At," special method."),At.forEach(o),pr=h(je),w(ve.$$.fragment,je),hr=h(je),w(be.$$.fragment,je),je.forEach(o),V.forEach(o),Lo=h(t),te=a(t,"H2",{class:!0});var _n=r(te);ye=a(_n,"A",{id:!0,class:!0,href:!0});var Hs=r(ye);go=a(Hs,"SPAN",{});var Os=r(go);w(rt.$$.fragment,Os),Os.forEach(o),Hs.forEach(o),mr=h(_n),_o=a(_n,"SPAN",{});var Ks=r(_o);ur=i(Ks,"UniSpeechForSequenceClassification"),Ks.forEach(o),_n.forEach(o),Do=h(t),j=a(t,"DIV",{class:!0});var q=r(j);w(st.$$.fragment,q),fr=h(q),vo=a(q,"P",{});var ei=r(vo);gr=i(ei,`UniSpeech Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),ei.forEach(o),_r=h(q),it=a(q,"P",{});var vn=r(it);vr=i(vn,"UniSpeech was proposed in "),lt=a(vn,"A",{href:!0,rel:!0});var ti=r(lt);br=i(ti,`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),ti.forEach(o),yr=i(vn,` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),vn.forEach(o),wr=h(q),ct=a(q,"P",{});var bn=r(ct);Tr=i(bn,"This model inherits from "),Gt=a(bn,"A",{href:!0});var oi=r(Gt);Ur=i(oi,"PreTrainedModel"),oi.forEach(o),Mr=i(bn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),bn.forEach(o),Sr=h(q),dt=a(q,"P",{});var yn=r(dt);kr=i(yn,"This model is a PyTorch "),pt=a(yn,"A",{href:!0,rel:!0});var ni=r(pt);Cr=i(ni,"torch.nn.Module"),ni.forEach(o),jr=i(yn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yn.forEach(o),$r=h(q),Z=a(q,"DIV",{class:!0});var $e=r(Z);w(ht.$$.fragment,$e),Fr=h($e),oe=a($e,"P",{});var Qt=r(oe);Jr=i(Qt,"The "),Nt=a(Qt,"A",{href:!0});var ai=r(Nt);xr=i(ai,"UniSpeechForSequenceClassification"),ai.forEach(o),Er=i(Qt," forward method, overrides the "),bo=a(Qt,"CODE",{});var ri=r(bo);Wr=i(ri,"__call__"),ri.forEach(o),Zr=i(Qt," special method."),Qt.forEach(o),zr=h($e),w(we.$$.fragment,$e),qr=h($e),w(Te.$$.fragment,$e),$e.forEach(o),q.forEach(o),Ho=h(t),ne=a(t,"H2",{class:!0});var wn=r(ne);Ue=a(wn,"A",{id:!0,class:!0,href:!0});var si=r(Ue);yo=a(si,"SPAN",{});var ii=r(yo);w(mt.$$.fragment,ii),ii.forEach(o),si.forEach(o),Gr=h(wn),wo=a(wn,"SPAN",{});var li=r(wo);Nr=i(li,"UniSpeechForPreTraining"),li.forEach(o),wn.forEach(o),Oo=h(t),J=a(t,"DIV",{class:!0});var P=r(J);w(ut.$$.fragment,P),Vr=h(P),ft=a(P,"P",{});var Tn=r(ft);Pr=i(Tn,`UniSpeech Model with a vector-quantization module and ctc loss for pre-training.
UniSpeech was proposed in `),gt=a(Tn,"A",{href:!0,rel:!0});var ci=r(gt);Ir=i(ci,`UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled
Data`),ci.forEach(o),Xr=i(Tn,` by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei,
Michael Zeng, Xuedong Huang.`),Tn.forEach(o),Rr=h(P),_t=a(P,"P",{});var Un=r(_t);Yr=i(Un,"This model inherits from "),Vt=a(Un,"A",{href:!0});var di=r(Vt);Br=i(di,"PreTrainedModel"),di.forEach(o),Ar=i(Un,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Un.forEach(o),Qr=h(P),vt=a(P,"P",{});var Mn=r(vt);Lr=i(Mn,"This model is a PyTorch "),bt=a(Mn,"A",{href:!0,rel:!0});var pi=r(bt);Dr=i(pi,"torch.nn.Module"),pi.forEach(o),Hr=i(Mn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Mn.forEach(o),Or=h(P),z=a(P,"DIV",{class:!0});var Fe=r(z);w(yt.$$.fragment,Fe),Kr=h(Fe),ae=a(Fe,"P",{});var Lt=r(ae);es=i(Lt,"The "),Pt=a(Lt,"A",{href:!0});var hi=r(Pt);ts=i(hi,"UniSpeechForPreTraining"),hi.forEach(o),os=i(Lt," forward method, overrides the "),To=a(Lt,"CODE",{});var mi=r(To);ns=i(mi,"__call__"),mi.forEach(o),as=i(Lt," special method."),Lt.forEach(o),rs=h(Fe),w(Me.$$.fragment,Fe),ss=h(Fe),w(Se.$$.fragment,Fe),Fe.forEach(o),P.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify($i)),c(f,"id","unispeech"),c(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(f,"href","#unispeech"),c(g,"class","relative group"),c(se,"id","overview"),c(se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(se,"href","#overview"),c(X,"class","relative group"),c(xe,"href","https://arxiv.org/abs/2101.07597"),c(xe,"rel","nofollow"),c(Ct,"href","/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor"),c(jt,"href","/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer"),c(Ze,"href","https://huggingface.co/patrickvonplaten"),c(Ze,"rel","nofollow"),c(ze,"href","https://github.com/microsoft/UniSpeech/tree/main/UniSpeech"),c(ze,"rel","nofollow"),c(ce,"id","documentation-resources"),c(ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ce,"href","#documentation-resources"),c(R,"class","relative group"),c($t,"href","../tasks/audio_classification"),c(Ft,"href","../tasks/asr"),c(pe,"id","transformers.UniSpeechConfig"),c(pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(pe,"href","#transformers.UniSpeechConfig"),c(Y,"class","relative group"),c(Jt,"href","/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechModel"),c(Ve,"href","https://huggingface.co/microsoft/unispeech-large-1500h-cv"),c(Ve,"rel","nofollow"),c(xt,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Et,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(me,"id","transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput"),c(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(me,"href","#transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput"),c(Q,"class","relative group"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ue,"id","transformers.UniSpeechModel"),c(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ue,"href","#transformers.UniSpeechModel"),c(D,"class","relative group"),c(Ae,"href","https://arxiv.org/abs/2101.07597"),c(Ae,"rel","nofollow"),c(Wt,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),c(De,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(De,"rel","nofollow"),c(Zt,"href","/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechModel"),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($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(_e,"id","transformers.UniSpeechForCTC"),c(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(_e,"href","#transformers.UniSpeechForCTC"),c(O,"class","relative group"),c(et,"href","https://arxiv.org/abs/2101.07597"),c(et,"rel","nofollow"),c(zt,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),c(nt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(nt,"rel","nofollow"),c(qt,"href","/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForCTC"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ye,"id","transformers.UniSpeechForSequenceClassification"),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","#transformers.UniSpeechForSequenceClassification"),c(te,"class","relative group"),c(lt,"href","https://arxiv.org/abs/2101.07597"),c(lt,"rel","nofollow"),c(Gt,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),c(pt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(pt,"rel","nofollow"),c(Nt,"href","/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForSequenceClassification"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ue,"id","transformers.UniSpeechForPreTraining"),c(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ue,"href","#transformers.UniSpeechForPreTraining"),c(ne,"class","relative group"),c(gt,"href","https://arxiv.org/abs/2101.07597"),c(gt,"rel","nofollow"),c(Vt,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),c(bt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(bt,"rel","nofollow"),c(Pt,"href","/docs/transformers/v4.31.0/en/model_doc/unispeech#transformers.UniSpeechForPreTraining"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,u){e(document.head,d),_(t,b,u),_(t,g,u),e(g,f),e(f,v),T(l,v,null),e(g,m),e(g,C),e(C,kn),_(t,xo,u),_(t,X,u),e(X,se),e(se,Dt),T(Je,Dt,null),e(X,Cn),e(X,Ht),e(Ht,jn),_(t,Eo,u),_(t,ie,u),e(ie,$n),e(ie,xe),e(xe,Fn),e(ie,Jn),_(t,Wo,u),_(t,Mt,u),e(Mt,xn),_(t,Zo,u),_(t,St,u),e(St,Ot),e(Ot,En),_(t,zo,u),_(t,kt,u),e(kt,Wn),_(t,qo,u),_(t,le,u),e(le,Ee),e(Ee,Zn),e(Ee,Ct),e(Ct,zn),e(Ee,qn),e(le,Gn),e(le,We),e(We,Nn),e(We,jt),e(jt,Vn),e(We,Pn),_(t,Go,u),_(t,G,u),e(G,In),e(G,Ze),e(Ze,Xn),e(G,Rn),e(G,ze),e(ze,Yn),e(G,Bn),_(t,No,u),_(t,R,u),e(R,ce),e(ce,Kt),T(qe,Kt,null),e(R,An),e(R,eo),e(eo,Qn),_(t,Vo,u),_(t,de,u),e(de,to),e(to,$t),e($t,Ln),e(de,Dn),e(de,oo),e(oo,Ft),e(Ft,Hn),_(t,Po,u),_(t,Y,u),e(Y,pe),e(pe,no),T(Ge,no,null),e(Y,On),e(Y,ao),e(ao,Kn),_(t,Io,u),_(t,x,u),T(Ne,x,null),e(x,ea),e(x,B),e(B,ta),e(B,Jt),e(Jt,oa),e(B,na),e(B,Ve),e(Ve,aa),e(B,ra),e(x,sa),e(x,A),e(A,ia),e(A,xt),e(xt,la),e(A,ca),e(A,Et),e(Et,da),e(A,pa),e(x,ha),T(he,x,null),_(t,Xo,u),_(t,Q,u),e(Q,me),e(me,ro),T(Pe,ro,null),e(Q,ma),e(Q,so),e(so,ua),_(t,Ro,u),_(t,L,u),T(Ie,L,null),e(L,fa),e(L,Xe),e(Xe,ga),e(Xe,io),e(io,_a),e(Xe,va),_(t,Yo,u),_(t,D,u),e(D,ue),e(ue,lo),T(Re,lo,null),e(D,ba),e(D,co),e(co,ya),_(t,Bo,u),_(t,$,u),T(Ye,$,null),e($,wa),e($,Be),e(Be,Ta),e(Be,Ae),e(Ae,Ua),e(Be,Ma),e($,Sa),e($,Qe),e(Qe,ka),e(Qe,Wt),e(Wt,Ca),e(Qe,ja),e($,$a),e($,Le),e(Le,Fa),e(Le,De),e(De,Ja),e(Le,xa),e($,Ea),e($,E),T(He,E,null),e(E,Wa),e(E,H),e(H,Za),e(H,Zt),e(Zt,za),e(H,qa),e(H,po),e(po,Ga),e(H,Na),e(E,Va),T(fe,E,null),e(E,Pa),T(ge,E,null),_(t,Ao,u),_(t,O,u),e(O,_e),e(_e,ho),T(Oe,ho,null),e(O,Ia),e(O,mo),e(mo,Xa),_(t,Qo,u),_(t,F,u),T(Ke,F,null),e(F,Ra),e(F,K),e(K,Ya),e(K,uo),e(uo,Ba),e(K,Aa),e(K,et),e(et,Qa),e(K,La),e(F,Da),e(F,tt),e(tt,Ha),e(tt,zt),e(zt,Oa),e(tt,Ka),e(F,er),e(F,ot),e(ot,tr),e(ot,nt),e(nt,or),e(ot,nr),e(F,ar),e(F,W),T(at,W,null),e(W,rr),e(W,ee),e(ee,sr),e(ee,qt),e(qt,ir),e(ee,lr),e(ee,fo),e(fo,cr),e(ee,dr),e(W,pr),T(ve,W,null),e(W,hr),T(be,W,null),_(t,Lo,u),_(t,te,u),e(te,ye),e(ye,go),T(rt,go,null),e(te,mr),e(te,_o),e(_o,ur),_(t,Do,u),_(t,j,u),T(st,j,null),e(j,fr),e(j,vo),e(vo,gr),e(j,_r),e(j,it),e(it,vr),e(it,lt),e(lt,br),e(it,yr),e(j,wr),e(j,ct),e(ct,Tr),e(ct,Gt),e(Gt,Ur),e(ct,Mr),e(j,Sr),e(j,dt),e(dt,kr),e(dt,pt),e(pt,Cr),e(dt,jr),e(j,$r),e(j,Z),T(ht,Z,null),e(Z,Fr),e(Z,oe),e(oe,Jr),e(oe,Nt),e(Nt,xr),e(oe,Er),e(oe,bo),e(bo,Wr),e(oe,Zr),e(Z,zr),T(we,Z,null),e(Z,qr),T(Te,Z,null),_(t,Ho,u),_(t,ne,u),e(ne,Ue),e(Ue,yo),T(mt,yo,null),e(ne,Gr),e(ne,wo),e(wo,Nr),_(t,Oo,u),_(t,J,u),T(ut,J,null),e(J,Vr),e(J,ft),e(ft,Pr),e(ft,gt),e(gt,Ir),e(ft,Xr),e(J,Rr),e(J,_t),e(_t,Yr),e(_t,Vt),e(Vt,Br),e(_t,Ar),e(J,Qr),e(J,vt),e(vt,Lr),e(vt,bt),e(bt,Dr),e(vt,Hr),e(J,Or),e(J,z),T(yt,z,null),e(z,Kr),e(z,ae),e(ae,es),e(ae,Pt),e(Pt,ts),e(ae,os),e(ae,To),e(To,ns),e(ae,as),e(z,rs),T(Me,z,null),e(z,ss),T(Se,z,null),Ko=!0},p(t,[u]){const wt={};u&2&&(wt.$$scope={dirty:u,ctx:t}),he.$set(wt);const Uo={};u&2&&(Uo.$$scope={dirty:u,ctx:t}),fe.$set(Uo);const Mo={};u&2&&(Mo.$$scope={dirty:u,ctx:t}),ge.$set(Mo);const So={};u&2&&(So.$$scope={dirty:u,ctx:t}),ve.$set(So);const Tt={};u&2&&(Tt.$$scope={dirty:u,ctx:t}),be.$set(Tt);const ko={};u&2&&(ko.$$scope={dirty:u,ctx:t}),we.$set(ko);const Co={};u&2&&(Co.$$scope={dirty:u,ctx:t}),Te.$set(Co);const jo={};u&2&&(jo.$$scope={dirty:u,ctx:t}),Me.$set(jo);const Ut={};u&2&&(Ut.$$scope={dirty:u,ctx:t}),Se.$set(Ut)},i(t){Ko||(U(l.$$.fragment,t),U(Je.$$.fragment,t),U(qe.$$.fragment,t),U(Ge.$$.fragment,t),U(Ne.$$.fragment,t),U(he.$$.fragment,t),U(Pe.$$.fragment,t),U(Ie.$$.fragment,t),U(Re.$$.fragment,t),U(Ye.$$.fragment,t),U(He.$$.fragment,t),U(fe.$$.fragment,t),U(ge.$$.fragment,t),U(Oe.$$.fragment,t),U(Ke.$$.fragment,t),U(at.$$.fragment,t),U(ve.$$.fragment,t),U(be.$$.fragment,t),U(rt.$$.fragment,t),U(st.$$.fragment,t),U(ht.$$.fragment,t),U(we.$$.fragment,t),U(Te.$$.fragment,t),U(mt.$$.fragment,t),U(ut.$$.fragment,t),U(yt.$$.fragment,t),U(Me.$$.fragment,t),U(Se.$$.fragment,t),Ko=!0)},o(t){M(l.$$.fragment,t),M(Je.$$.fragment,t),M(qe.$$.fragment,t),M(Ge.$$.fragment,t),M(Ne.$$.fragment,t),M(he.$$.fragment,t),M(Pe.$$.fragment,t),M(Ie.$$.fragment,t),M(Re.$$.fragment,t),M(Ye.$$.fragment,t),M(He.$$.fragment,t),M(fe.$$.fragment,t),M(ge.$$.fragment,t),M(Oe.$$.fragment,t),M(Ke.$$.fragment,t),M(at.$$.fragment,t),M(ve.$$.fragment,t),M(be.$$.fragment,t),M(rt.$$.fragment,t),M(st.$$.fragment,t),M(ht.$$.fragment,t),M(we.$$.fragment,t),M(Te.$$.fragment,t),M(mt.$$.fragment,t),M(ut.$$.fragment,t),M(yt.$$.fragment,t),M(Me.$$.fragment,t),M(Se.$$.fragment,t),Ko=!1},d(t){o(d),t&&o(b),t&&o(g),S(l),t&&o(xo),t&&o(X),S(Je),t&&o(Eo),t&&o(ie),t&&o(Wo),t&&o(Mt),t&&o(Zo),t&&o(St),t&&o(zo),t&&o(kt),t&&o(qo),t&&o(le),t&&o(Go),t&&o(G),t&&o(No),t&&o(R),S(qe),t&&o(Vo),t&&o(de),t&&o(Po),t&&o(Y),S(Ge),t&&o(Io),t&&o(x),S(Ne),S(he),t&&o(Xo),t&&o(Q),S(Pe),t&&o(Ro),t&&o(L),S(Ie),t&&o(Yo),t&&o(D),S(Re),t&&o(Bo),t&&o($),S(Ye),S(He),S(fe),S(ge),t&&o(Ao),t&&o(O),S(Oe),t&&o(Qo),t&&o(F),S(Ke),S(at),S(ve),S(be),t&&o(Lo),t&&o(te),S(rt),t&&o(Do),t&&o(j),S(st),S(ht),S(we),S(Te),t&&o(Ho),t&&o(ne),S(mt),t&&o(Oo),t&&o(J),S(ut),S(yt),S(Me),S(Se)}}}const $i={local:"unispeech",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.UniSpeechConfig",title:"UniSpeechConfig"},{local:"transformers.models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput",title:"UniSpeech specific outputs"},{local:"transformers.UniSpeechModel",title:"UniSpeechModel"},{local:"transformers.UniSpeechForCTC",title:"UniSpeechForCTC"},{local:"transformers.UniSpeechForSequenceClassification",title:"UniSpeechForSequenceClassification"},{local:"transformers.UniSpeechForPreTraining",title:"UniSpeechForPreTraining"}],title:"UniSpeech"};function Fi(k){return vi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qi extends ui{constructor(d){super();fi(this,d,Fi,ji,gi,{})}}export{qi as default,$i as metadata};
