import{S as Vl,i as ql,s as Sl,e as a,k as p,w,t as n,M as Xl,c as r,d as t,m as u,a as l,x as M,h as s,b as h,G as e,g,y as k,q as C,o as j,B as E,v as Yl,L as tn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Io}from"../../chunks/Tip-hf-doc-builder.js";import{D as ot}from"../../chunks/Docstring-hf-doc-builder.js";import{C as on}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Tt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as en}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Al(F){let d,y,f,m,v;return m=new on({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEh1YmVydE1vZGVsJTJDJTIwSHViZXJ0Q29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEh1YmVydCUyMGZhY2Vib29rJTJGaHViZXJ0LWJhc2UtbHM5NjAlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwSHViZXJ0Q29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwZmFjZWJvb2slMkZodWJlcnQtYmFzZS1sczk2MCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwSHViZXJ0TW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> HubertModel, HubertConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Hubert facebook/hubert-base-ls960 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = HubertConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the facebook/hubert-base-ls960 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = HubertModel(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=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function Pl(F){let d,y,f,m,v;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),m=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var H=l(f);m=s(H,"Module"),H.forEach(t),v=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,f),e(f,m),e(d,v)},d(i){i&&t(d)}}}function Dl(F){let d,y,f,m,v;return m=new on({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBIdWJlcnRNb2RlbCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWltcG9ydCUyMHNvdW5kZmlsZSUyMGFzJTIwc2YlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmh1YmVydC1sYXJnZS1sczk2MC1mdCUyMiklMEFtb2RlbCUyMCUzRCUyMEh1YmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmh1YmVydC1sYXJnZS1sczk2MC1mdCUyMiklMEElMEElMEFkZWYlMjBtYXBfdG9fYXJyYXkoYmF0Y2gpJTNBJTBBJTIwJTIwJTIwJTIwc3BlZWNoJTJDJTIwXyUyMCUzRCUyMHNmLnJlYWQoYmF0Y2glNUIlMjJmaWxlJTIyJTVEKSUwQSUyMCUyMCUyMCUyMGJhdGNoJTVCJTIyc3BlZWNoJTIyJTVEJTIwJTNEJTIwc3BlZWNoJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYmF0Y2glMEElMEElMEFkcyUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2R1bW15JTIyJTJDJTIwJTIyY2xlYW4lMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIpJTBBZHMlMjAlM0QlMjBkcy5tYXAobWFwX3RvX2FycmF5KSUwQSUwQWlucHV0X3ZhbHVlcyUyMCUzRCUyMHByb2Nlc3NvcihkcyU1QiUyMnNwZWVjaCUyMiU1RCU1QjAlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF92YWx1ZXMlMjAlMjAlMjMlMjBCYXRjaCUyMHNpemUlMjAxJTBBaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG1vZGVsKGlucHV0X3ZhbHVlcykubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, HubertModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> soundfile <span class="hljs-keyword">as</span> sf

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = HubertModel.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)


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


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

<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = model(input_values).last_hidden_state`}}),{c(){d=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function Ql(F){let d,y,f,m,v;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),m=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var H=l(f);m=s(H,"Module"),H.forEach(t),v=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,f),e(f,m),e(d,v)},d(i){i&&t(d)}}}function Ll(F){let d,y,f,m,v;return m=new on({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBIdWJlcnRGb3JDVEMlMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmxpYnJpc3BlZWNoX2Fzcl9kZW1vJTIyJTJDJTIwJTIyY2xlYW4lMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIpJTBBZGF0YXNldCUyMCUzRCUyMGRhdGFzZXQuc29ydCglMjJpZCUyMiklMEFzYW1wbGluZ19yYXRlJTIwJTNEJTIwZGF0YXNldC5mZWF0dXJlcyU1QiUyMmF1ZGlvJTIyJTVELnNhbXBsaW5nX3JhdGUlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRmh1YmVydC1sYXJnZS1sczk2MC1mdCUyMiklMEFtb2RlbCUyMCUzRCUyMEh1YmVydEZvckNUQy5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZodWJlcnQtbGFyZ2UtbHM5NjAtZnQlMjIpJTBBJTBBJTIzJTIwYXVkaW8lMjBmaWxlJTIwaXMlMjBkZWNvZGVkJTIwb24lMjB0aGUlMjBmbHklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoZGF0YXNldCU1QjAlNUQlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVEJTJDJTIwc2FtcGxpbmdfcmF0ZSUzRHNhbXBsaW5nX3JhdGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBcHJlZGljdGVkX2lkcyUyMCUzRCUyMHRvcmNoLmFyZ21heChsb2dpdHMlMkMlMjBkaW0lM0QtMSklMEElMEElMjMlMjB0cmFuc2NyaWJlJTIwc3BlZWNoJTBBdHJhbnNjcmlwdGlvbiUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUocHJlZGljdGVkX2lkcyklMEF0cmFuc2NyaXB0aW9uJTVCMCU1RCUwQSUwQWlucHV0cyU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEZGF0YXNldCU1QjAlNUQlNUIlMjJ0ZXh0JTIyJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikuaW5wdXRfaWRzJTBBJTBBJTIzJTIwY29tcHV0ZSUyMGxvc3MlMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvc3MlMEFyb3VuZChsb3NzLml0ZW0oKSUyQyUyMDIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, HubertForCTC
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = HubertForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = processor(text=dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;text&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute loss</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">22.68</span>`}}),{c(){d=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function Ol(F){let d,y,f,m,v;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),m=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var H=l(f);m=s(H,"Module"),H.forEach(t),v=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,f),e(f,m),e(d,v)},d(i){i&&t(d)}}}function Kl(F){let d,y,f,m,v;return m=new on({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9GZWF0dXJlRXh0cmFjdG9yJTJDJTIwSHViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2RlbW8lMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkYXRhc2V0JTIwJTNEJTIwZGF0YXNldC5zb3J0KCUyMmlkJTIyKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IuZnJvbV9wcmV0cmFpbmVkKCUyMnN1cGVyYiUyRmh1YmVydC1iYXNlLXN1cGVyYi1rcyUyMiklMEFtb2RlbCUyMCUzRCUyMEh1YmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnN1cGVyYiUyRmh1YmVydC1iYXNlLXN1cGVyYi1rcyUyMiklMEElMEElMjMlMjBhdWRpbyUyMGZpbGUlMjBpcyUyMGRlY29kZWQlMjBvbiUyMHRoZSUyMGZseSUwQWlucHV0cyUyMCUzRCUyMGZlYXR1cmVfZXh0cmFjdG9yKGRhdGFzZXQlNUIwJTVEJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUyQyUyMHNhbXBsaW5nX3JhdGUlM0RzYW1wbGluZ19yYXRlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmdtYXgobG9naXRzJTJDJTIwZGltJTNELTEpLml0ZW0oKSUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZHMlNUQlMEFwcmVkaWN0ZWRfbGFiZWwlMEElMEElMjMlMjBjb21wdXRlJTIwbG9zcyUyMC0lMjB0YXJnZXRfbGFiZWwlMjBpcyUyMGUuZy4lMjAlMjJkb3duJTIyJTBBdGFyZ2V0X2xhYmVsJTIwJTNEJTIwbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCMCU1RCUwQWlucHV0cyU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUJtb2RlbC5jb25maWcubGFiZWwyaWQlNUJ0YXJnZXRfbGFiZWwlNUQlNUQpJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb3NzJTBBcm91bmQobG9zcy5pdGVtKCklMkMlMjAyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor, HubertForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_demo&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.sort(<span class="hljs-string">&quot;id&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># compute loss - target_label is e.g. &quot;down&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_label = model.config.id2label[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs[<span class="hljs-string">&quot;labels&quot;</span>] = torch.tensor([model.config.label2id[target_label]])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">8.53</span>`}}),{c(){d=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function ei(F){let d,y,f,m,v,i,c,H,Re,Te,Z,Q,ee,T,ze,X,Ge,we,z,Ve,te,oe,qe,Me,q,Se,ke,S,ge,Xe,me,U,N,Ce,G,_e,Ye,ne,se,Ae,x,Pe,ae,je,L,re,le,De,Y,Ee,W,O,ie,I,Qe,B,Le,$e;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),f=a("code"),m=n("transformers"),v=n(" accept two formats as input:"),i=p(),c=a("ul"),H=a("li"),Re=n("having all inputs as keyword arguments (like PyTorch models), or"),Te=p(),Z=a("li"),Q=n("having all inputs as a list, tuple or dict in the first positional argument."),ee=p(),T=a("p"),ze=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),X=a("code"),Ge=n("model.fit()"),we=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=a("code"),Ve=n("model.fit()"),te=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),oe=a("code"),qe=n("fit()"),Me=n(" and "),q=a("code"),Se=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),ge=n("Functional"),Xe=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),me=p(),U=a("ul"),N=a("li"),Ce=n("a single Tensor with "),G=a("code"),_e=n("input_values"),Ye=n(" only and nothing else: "),ne=a("code"),se=n("model(input_values)"),Ae=p(),x=a("li"),Pe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ae=a("code"),je=n("model([input_values, attention_mask])"),L=n(" or "),re=a("code"),le=n("model([input_values, attention_mask, token_type_ids])"),De=p(),Y=a("li"),Ee=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),W=a("code"),O=n('model({"input_values": input_values, "token_type_ids": token_type_ids})'),ie=p(),I=a("p"),Qe=n(`Note that when creating models and layers with
`),B=a("a"),Le=n("subclassing"),$e=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var $=l(d);y=s($,"TensorFlow models and layers in "),f=r($,"CODE",{});var He=l(f);m=s(He,"transformers"),He.forEach(t),v=s($," accept two formats as input:"),$.forEach(t),i=u(b),c=r(b,"UL",{});var be=l(c);H=r(be,"LI",{});var rt=l(H);Re=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),Te=u(be),Z=r(be,"LI",{});var Oe=l(Z);Q=s(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),be.forEach(t),ee=u(b),T=r(b,"P",{});var J=l(T);ze=s(J,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),X=r(J,"CODE",{});var lt=l(X);Ge=s(lt,"model.fit()"),lt.forEach(t),we=s(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=r(J,"CODE",{});var nt=l(z);Ve=s(nt,"model.fit()"),nt.forEach(t),te=s(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),oe=r(J,"CODE",{});var de=l(oe);qe=s(de,"fit()"),de.forEach(t),Me=s(J," and "),q=r(J,"CODE",{});var fe=l(q);Se=s(fe,"predict()"),fe.forEach(t),ke=s(J,`, such as when creating your own layers or models with
the Keras `),S=r(J,"CODE",{});var Ke=l(S);ge=s(Ke,"Functional"),Ke.forEach(t),Xe=s(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),me=u(b),U=r(b,"UL",{});var R=l(U);N=r(R,"LI",{});var ce=l(N);Ce=s(ce,"a single Tensor with "),G=r(ce,"CODE",{});var et=l(G);_e=s(et,"input_values"),et.forEach(t),Ye=s(ce," only and nothing else: "),ne=r(ce,"CODE",{});var it=l(ne);se=s(it,"model(input_values)"),it.forEach(t),ce.forEach(t),Ae=u(R),x=r(R,"LI",{});var K=l(x);Pe=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ae=r(K,"CODE",{});var V=l(ae);je=s(V,"model([input_values, attention_mask])"),V.forEach(t),L=s(K," or "),re=r(K,"CODE",{});var ve=l(re);le=s(ve,"model([input_values, attention_mask, token_type_ids])"),ve.forEach(t),K.forEach(t),De=u(R),Y=r(R,"LI",{});var tt=l(Y);Ee=s(tt,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),W=r(tt,"CODE",{});var pe=l(W);O=s(pe,'model({"input_values": input_values, "token_type_ids": token_type_ids})'),pe.forEach(t),tt.forEach(t),R.forEach(t),ie=u(b),I=r(b,"P",{});var ye=l(I);Qe=s(ye,`Note that when creating models and layers with
`),B=r(ye,"A",{href:!0,rel:!0});var Je=l(B);Le=s(Je,"subclassing"),Je.forEach(t),$e=s(ye,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),ye.forEach(t),this.h()},h(){h(B,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(B,"rel","nofollow")},m(b,$){g(b,d,$),e(d,y),e(d,f),e(f,m),e(d,v),g(b,i,$),g(b,c,$),e(c,H),e(H,Re),e(c,Te),e(c,Z),e(Z,Q),g(b,ee,$),g(b,T,$),e(T,ze),e(T,X),e(X,Ge),e(T,we),e(T,z),e(z,Ve),e(T,te),e(T,oe),e(oe,qe),e(T,Me),e(T,q),e(q,Se),e(T,ke),e(T,S),e(S,ge),e(T,Xe),g(b,me,$),g(b,U,$),e(U,N),e(N,Ce),e(N,G),e(G,_e),e(N,Ye),e(N,ne),e(ne,se),e(U,Ae),e(U,x),e(x,Pe),e(x,ae),e(ae,je),e(x,L),e(x,re),e(re,le),e(U,De),e(U,Y),e(Y,Ee),e(Y,W),e(W,O),g(b,ie,$),g(b,I,$),e(I,Qe),e(I,B),e(B,Le),e(I,$e)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ee),b&&t(T),b&&t(me),b&&t(U),b&&t(ie),b&&t(I)}}}function ti(F){let d,y,f,m,v;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),m=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var H=l(f);m=s(H,"Module"),H.forEach(t),v=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,f),e(f,m),e(d,v)},d(i){i&&t(d)}}}function oi(F){let d,y,f,m,v;return m=new on({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBURkh1YmVydE1vZGVsJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwc291bmRmaWxlJTIwYXMlMjBzZiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGaHViZXJ0LWxhcmdlLWxzOTYwLWZ0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZIdWJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZodWJlcnQtbGFyZ2UtbHM5NjAtZnQlMjIpJTBBJTBBJTBBZGVmJTIwbWFwX3RvX2FycmF5KGJhdGNoKSUzQSUwQSUyMCUyMCUyMCUyMHNwZWVjaCUyQyUyMF8lMjAlM0QlMjBzZi5yZWFkKGJhdGNoJTVCJTIyZmlsZSUyMiU1RCklMEElMjAlMjAlMjAlMjBiYXRjaCU1QiUyMnNwZWVjaCUyMiU1RCUyMCUzRCUyMHNwZWVjaCUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGJhdGNoJTBBJTBBJTBBZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmxpYnJpc3BlZWNoX2Fzcl9kdW1teSUyMiUyQyUyMCUyMmNsZWFuJTIyJTJDJTIwc3BsaXQlM0QlMjJ2YWxpZGF0aW9uJTIyKSUwQWRzJTIwJTNEJTIwZHMubWFwKG1hcF90b19hcnJheSklMEElMEFpbnB1dF92YWx1ZXMlMjAlM0QlMjBwcm9jZXNzb3IoZHMlNUIlMjJzcGVlY2glMjIlNUQlNUIwJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMikuaW5wdXRfdmFsdWVzJTIwJTIwJTIzJTIwQmF0Y2glMjBzaXplJTIwMSUwQWhpZGRlbl9zdGF0ZXMlMjAlM0QlMjBtb2RlbChpbnB1dF92YWx1ZXMpLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFHubertModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> soundfile <span class="hljs-keyword">as</span> sf

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFHubertModel.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)


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


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

<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>hidden_states = model(input_values).last_hidden_state`}}),{c(){d=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function ni(F){let d,y,f,m,v,i,c,H,Re,Te,Z,Q,ee,T,ze,X,Ge,we,z,Ve,te,oe,qe,Me,q,Se,ke,S,ge,Xe,me,U,N,Ce,G,_e,Ye,ne,se,Ae,x,Pe,ae,je,L,re,le,De,Y,Ee,W,O,ie,I,Qe,B,Le,$e;return{c(){d=a("p"),y=n("TensorFlow models and layers in "),f=a("code"),m=n("transformers"),v=n(" accept two formats as input:"),i=p(),c=a("ul"),H=a("li"),Re=n("having all inputs as keyword arguments (like PyTorch models), or"),Te=p(),Z=a("li"),Q=n("having all inputs as a list, tuple or dict in the first positional argument."),ee=p(),T=a("p"),ze=n(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),X=a("code"),Ge=n("model.fit()"),we=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=a("code"),Ve=n("model.fit()"),te=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),oe=a("code"),qe=n("fit()"),Me=n(" and "),q=a("code"),Se=n("predict()"),ke=n(`, such as when creating your own layers or models with
the Keras `),S=a("code"),ge=n("Functional"),Xe=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),me=p(),U=a("ul"),N=a("li"),Ce=n("a single Tensor with "),G=a("code"),_e=n("input_values"),Ye=n(" only and nothing else: "),ne=a("code"),se=n("model(input_values)"),Ae=p(),x=a("li"),Pe=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ae=a("code"),je=n("model([input_values, attention_mask])"),L=n(" or "),re=a("code"),le=n("model([input_values, attention_mask, token_type_ids])"),De=p(),Y=a("li"),Ee=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),W=a("code"),O=n('model({"input_values": input_values, "token_type_ids": token_type_ids})'),ie=p(),I=a("p"),Qe=n(`Note that when creating models and layers with
`),B=a("a"),Le=n("subclassing"),$e=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(b){d=r(b,"P",{});var $=l(d);y=s($,"TensorFlow models and layers in "),f=r($,"CODE",{});var He=l(f);m=s(He,"transformers"),He.forEach(t),v=s($," accept two formats as input:"),$.forEach(t),i=u(b),c=r(b,"UL",{});var be=l(c);H=r(be,"LI",{});var rt=l(H);Re=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),Te=u(be),Z=r(be,"LI",{});var Oe=l(Z);Q=s(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),be.forEach(t),ee=u(b),T=r(b,"P",{});var J=l(T);ze=s(J,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),X=r(J,"CODE",{});var lt=l(X);Ge=s(lt,"model.fit()"),lt.forEach(t),we=s(J,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=r(J,"CODE",{});var nt=l(z);Ve=s(nt,"model.fit()"),nt.forEach(t),te=s(J,` supports! If, however, you want to use the second
format outside of Keras methods like `),oe=r(J,"CODE",{});var de=l(oe);qe=s(de,"fit()"),de.forEach(t),Me=s(J," and "),q=r(J,"CODE",{});var fe=l(q);Se=s(fe,"predict()"),fe.forEach(t),ke=s(J,`, such as when creating your own layers or models with
the Keras `),S=r(J,"CODE",{});var Ke=l(S);ge=s(Ke,"Functional"),Ke.forEach(t),Xe=s(J,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),J.forEach(t),me=u(b),U=r(b,"UL",{});var R=l(U);N=r(R,"LI",{});var ce=l(N);Ce=s(ce,"a single Tensor with "),G=r(ce,"CODE",{});var et=l(G);_e=s(et,"input_values"),et.forEach(t),Ye=s(ce," only and nothing else: "),ne=r(ce,"CODE",{});var it=l(ne);se=s(it,"model(input_values)"),it.forEach(t),ce.forEach(t),Ae=u(R),x=r(R,"LI",{});var K=l(x);Pe=s(K,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ae=r(K,"CODE",{});var V=l(ae);je=s(V,"model([input_values, attention_mask])"),V.forEach(t),L=s(K," or "),re=r(K,"CODE",{});var ve=l(re);le=s(ve,"model([input_values, attention_mask, token_type_ids])"),ve.forEach(t),K.forEach(t),De=u(R),Y=r(R,"LI",{});var tt=l(Y);Ee=s(tt,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),W=r(tt,"CODE",{});var pe=l(W);O=s(pe,'model({"input_values": input_values, "token_type_ids": token_type_ids})'),pe.forEach(t),tt.forEach(t),R.forEach(t),ie=u(b),I=r(b,"P",{});var ye=l(I);Qe=s(ye,`Note that when creating models and layers with
`),B=r(ye,"A",{href:!0,rel:!0});var Je=l(B);Le=s(Je,"subclassing"),Je.forEach(t),$e=s(ye,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),ye.forEach(t),this.h()},h(){h(B,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(B,"rel","nofollow")},m(b,$){g(b,d,$),e(d,y),e(d,f),e(f,m),e(d,v),g(b,i,$),g(b,c,$),e(c,H),e(H,Re),e(c,Te),e(c,Z),e(Z,Q),g(b,ee,$),g(b,T,$),e(T,ze),e(T,X),e(X,Ge),e(T,we),e(T,z),e(z,Ve),e(T,te),e(T,oe),e(oe,qe),e(T,Me),e(T,q),e(q,Se),e(T,ke),e(T,S),e(S,ge),e(T,Xe),g(b,me,$),g(b,U,$),e(U,N),e(N,Ce),e(N,G),e(G,_e),e(N,Ye),e(N,ne),e(ne,se),e(U,Ae),e(U,x),e(x,Pe),e(x,ae),e(ae,je),e(x,L),e(x,re),e(re,le),e(U,De),e(U,Y),e(Y,Ee),e(Y,W),e(W,O),g(b,ie,$),g(b,I,$),e(I,Qe),e(I,B),e(B,Le),e(I,$e)},d(b){b&&t(d),b&&t(i),b&&t(c),b&&t(ee),b&&t(T),b&&t(me),b&&t(U),b&&t(ie),b&&t(I)}}}function si(F){let d,y,f,m,v;return{c(){d=a("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),m=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var H=l(f);m=s(H,"Module"),H.forEach(t),v=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(i,c){g(i,d,c),e(d,y),e(d,f),e(f,m),e(d,v)},d(i){i&&t(d)}}}function ai(F){let d,y,f,m,v;return m=new on({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFRGSHViZXJ0Rm9yQ1RDJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBaW1wb3J0JTIwc291bmRmaWxlJTIwYXMlMjBzZiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGaHViZXJ0LWxhcmdlLWxzOTYwLWZ0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZIdWJlcnRGb3JDVEMuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGaHViZXJ0LWxhcmdlLWxzOTYwLWZ0JTIyKSUwQSUwQSUwQWRlZiUyMG1hcF90b19hcnJheShiYXRjaCklM0ElMEElMjAlMjAlMjAlMjBzcGVlY2glMkMlMjBfJTIwJTNEJTIwc2YucmVhZChiYXRjaCU1QiUyMmZpbGUlMjIlNUQpJTBBJTIwJTIwJTIwJTIwYmF0Y2glNUIlMjJzcGVlY2glMjIlNUQlMjAlM0QlMjBzcGVlY2glMEElMjAlMjAlMjAlMjByZXR1cm4lMjBiYXRjaCUwQSUwQSUwQWRzJTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZsaWJyaXNwZWVjaF9hc3JfZHVtbXklMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEFkcyUyMCUzRCUyMGRzLm1hcChtYXBfdG9fYXJyYXkpJTBBJTBBaW5wdXRfdmFsdWVzJTIwJTNEJTIwcHJvY2Vzc29yKGRzJTVCJTIyc3BlZWNoJTIyJTVEJTVCMCU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLmlucHV0X3ZhbHVlcyUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEFsb2dpdHMlMjAlM0QlMjBtb2RlbChpbnB1dF92YWx1ZXMpLmxvZ2l0cyUwQXByZWRpY3RlZF9pZHMlMjAlM0QlMjB0Zi5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSUwQSUwQXRyYW5zY3JpcHRpb24lMjAlM0QlMjBwcm9jZXNzb3IuZGVjb2RlKHByZWRpY3RlZF9pZHMlNUIwJTVEKSUwQSUwQSUyMyUyMGNvbXB1dGUlMjBsb3NzJTBBdGFyZ2V0X3RyYW5zY3JpcHRpb24lMjAlM0QlMjAlMjJBJTIwTUFOJTIwU0FJRCUyMFRPJTIwVEhFJTIwVU5JVkVSU0UlMjBTSVIlMjBJJTIwRVhJU1QlMjIlMEElMEElMjMlMjBQYXNzJTIwdGhlJTIwdHJhbnNjcmlwdGlvbiUyMGFzJTIwdGV4dCUyMHRvJTIwZW5jb2RlJTIwbGFiZWxzJTBBbGFiZWxzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0R0cmFuc2NyaXB0aW9uJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMikuaW5wdXRfdmFsdWVzJTBBJTBBbG9zcyUyMCUzRCUyMG1vZGVsKGlucHV0X3ZhbHVlcyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, TFHubertForCTC
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> soundfile <span class="hljs-keyword">as</span> sf

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFHubertForCTC.from_pretrained(<span class="hljs-string">&quot;facebook/hubert-large-ls960-ft&quot;</span>)


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


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

<span class="hljs-meta">&gt;&gt;&gt; </span>input_values = processor(ds[<span class="hljs-string">&quot;speech&quot;</span>][<span class="hljs-number">0</span>], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_values  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(input_values).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_ids = tf.argmax(logits, axis=-<span class="hljs-number">1</span>)

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(input_values, labels=labels).loss`}}),{c(){d=a("p"),y=n("Example:"),f=p(),w(m.$$.fragment)},l(i){d=r(i,"P",{});var c=l(d);y=s(c,"Example:"),c.forEach(t),f=u(i),M(m.$$.fragment,i)},m(i,c){g(i,d,c),e(d,y),g(i,f,c),k(m,i,c),v=!0},p:tn,i(i){v||(C(m.$$.fragment,i),v=!0)},o(i){j(m.$$.fragment,i),v=!1},d(i){i&&t(d),i&&t(f),E(m,i)}}}function ri(F){let d,y,f,m,v,i,c,H,Re,Te,Z,Q,ee,T,ze,X,Ge,we,z,Ve,te,oe,qe,Me,q,Se,ke,S,ge,Xe,me,U,N,Ce,G,_e,Ye,ne,se,Ae,x,Pe,ae,je,L,re,le,De,Y,Ee,W,O,ie,I,Qe,B,Le,$e,b,$,He,be,rt,Oe,J,lt,nt,de,fe,Ke,R,ce,et,it,K,V,ve,tt,pe,ye,Je,ms,fs,Yt,gs,_s,bs,dt,vs,xo,ys,Ts,Zo,ws,Ms,ks,wt,In,ct,Mt,nn,At,Cs,sn,js,xn,ue,Pt,Es,Dt,$s,Qt,Hs,Js,Fs,Lt,Us,No,Is,xs,Zs,Ot,Ns,Kt,Ws,Bs,Rs,Fe,eo,zs,pt,Gs,Wo,Vs,qs,an,Ss,Xs,Ys,kt,As,Ct,Zn,ut,jt,rn,to,Ps,ln,Ds,Nn,he,oo,Qs,ht,Ls,dn,Os,Ks,no,ea,ta,oa,so,na,Bo,sa,aa,ra,ao,la,ro,ia,da,ca,Ue,lo,pa,mt,ua,Ro,ha,ma,cn,fa,ga,_a,Et,ba,$t,Wn,ft,Ht,pn,io,va,un,ya,Bn,A,co,Ta,hn,wa,Ma,po,ka,uo,Ca,ja,Ea,ho,$a,zo,Ha,Ja,Fa,mo,Ua,fo,Ia,xa,Za,Ie,go,Na,gt,Wa,Go,Ba,Ra,mn,za,Ga,Va,Jt,qa,Ft,Rn,_t,Ut,fn,_o,Sa,gn,Xa,zn,P,bo,Ya,_n,Aa,Pa,vo,Da,Vo,Qa,La,Oa,yo,Ka,To,er,tr,or,It,nr,xe,wo,sr,bt,ar,qo,rr,lr,bn,ir,dr,cr,xt,pr,Zt,Gn,vt,Nt,vn,Mo,ur,yn,hr,Vn,D,ko,mr,Co,fr,Tn,gr,_r,br,jo,vr,So,yr,Tr,wr,Eo,Mr,$o,kr,Cr,jr,Wt,Er,Ze,Ho,$r,yt,Hr,Xo,Jr,Fr,wn,Ur,Ir,xr,Bt,Zr,Rt,qn;return i=new Tt({}),T=new Tt({}),I=new Tt({}),R=new Tt({}),ve=new ot({props:{name:"class transformers.HubertConfig",anchor:"transformers.HubertConfig",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_layer_norm",val:" = True"},{name:"feat_proj_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:"ctc_loss_reduction",val:" = 'sum'"},{name:"ctc_zero_infinity",val:" = False"},{name:"use_weighted_layer_sum",val:" = False"},{name:"classifier_proj_size",val:" = 256"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.HubertConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Vocabulary size of the Hubert 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/hubert#transformers.HubertModel">HubertModel</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/hubert#transformers.HubertModel">HubertModel</a>.`,name:"vocab_size"},{anchor:"transformers.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.hidden_dropout(float,",description:`<strong>hidden_dropout(<code>float</code>,</strong> <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(float,"},{anchor:"transformers.HubertConfig.attention_dropout(float,",description:`<strong>attention_dropout(<code>float</code>,</strong> <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout(float,"},{anchor:"transformers.HubertConfig.final_dropout",description:`<strong>final_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for the final projection layer of <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2ForCTC">Wav2Vec2ForCTC</a>.`,name:"final_dropout"},{anchor:"transformers.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.feat_proj_layer_norm",description:`<strong>feat_proj_layer_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply LayerNorm to the output of the feature encoder.`,name:"feat_proj_layer_norm"},{anchor:"transformers.HubertConfig.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.HubertConfig.conv_dim",description:`<strong>conv_dim</strong> (<code>Tuple[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.HubertConfig.conv_stride",description:`<strong>conv_stride</strong> (<code>Tuple[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.HubertConfig.conv_kernel",description:`<strong>conv_kernel</strong> (<code>Tuple[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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.do_stable_layer_norm",description:`<strong>do_stable_layer_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether do 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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.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.HubertConfig.ctc_loss_reduction",description:`<strong>ctc_loss_reduction</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;sum&quot;</code>) &#x2014;
Specifies the reduction to apply to the output of <code>torch.nn.CTCLoss</code>. Only relevant when training an
instance of <a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertForCTC">HubertForCTC</a>.`,name:"ctc_loss_reduction"},{anchor:"transformers.HubertConfig.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/hubert#transformers.HubertForCTC">HubertForCTC</a>.`,name:"ctc_zero_infinity"},{anchor:"transformers.HubertConfig.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/hubert#transformers.HubertForSequenceClassification">HubertForSequenceClassification</a>.`,name:"use_weighted_layer_sum"},{anchor:"transformers.HubertConfig.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"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/hubert/configuration_hubert.py#L32"}}),wt=new en({props:{anchor:"transformers.HubertConfig.example",$$slots:{default:[Al]},$$scope:{ctx:F}}}),At=new Tt({}),Pt=new ot({props:{name:"class transformers.HubertModel",anchor:"transformers.HubertModel",parameters:[{name:"config",val:": HubertConfig"}],parametersDescription:[{anchor:"transformers.HubertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig">HubertConfig</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/hubert/modeling_hubert.py#L991"}}),eo=new ot({props:{name:"forward",anchor:"transformers.HubertModel.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.HubertModel.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.HubertModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/hubert-base-ls960" rel="nofollow">hubert-base</a>, <code>attention_mask</code> should <strong>not</strong> be passed
to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should simply be
padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly different
results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.HubertModel.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.HubertModel.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.HubertModel.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/hubert/modeling_hubert.py#L1056",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</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/hubert#transformers.HubertConfig"
>HubertConfig</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>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.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),kt=new Io({props:{$$slots:{default:[Pl]},$$scope:{ctx:F}}}),Ct=new en({props:{anchor:"transformers.HubertModel.forward.example",$$slots:{default:[Dl]},$$scope:{ctx:F}}}),to=new Tt({}),oo=new ot({props:{name:"class transformers.HubertForCTC",anchor:"transformers.HubertForCTC",parameters:[{name:"config",val:""},{name:"target_lang",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.HubertForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig">HubertConfig</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/hubert/modeling_hubert.py#L1135"}}),lo=new ot({props:{name:"forward",anchor:"transformers.HubertForCTC.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.HubertForCTC.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.HubertForCTC.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/hubert-base-ls960" rel="nofollow">hubert-base</a>, <code>attention_mask</code> should <strong>not</strong> be passed
to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should simply be
padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly different
results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.HubertForCTC.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.HubertForCTC.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.HubertForCTC.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.HubertForCTC.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/hubert/modeling_hubert.py#L1207",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/hubert#transformers.HubertConfig"
>HubertConfig</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>
`}}),Et=new Io({props:{$$slots:{default:[Ql]},$$scope:{ctx:F}}}),$t=new en({props:{anchor:"transformers.HubertForCTC.forward.example",$$slots:{default:[Ll]},$$scope:{ctx:F}}}),io=new Tt({}),co=new ot({props:{name:"class transformers.HubertForSequenceClassification",anchor:"transformers.HubertForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.HubertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig">HubertConfig</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/hubert/modeling_hubert.py#L1295"}}),go=new ot({props:{name:"forward",anchor:"transformers.HubertForSequenceClassification.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.HubertForSequenceClassification.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.HubertForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing convolution and attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p><code>attention_mask</code> should only be passed if the corresponding processor has <code>config.return_attention_mask == True</code>. For all models whose processor has <code>config.return_attention_mask == False</code>, such as
<a href="https://huggingface.co/facebook/hubert-base-ls960" rel="nofollow">hubert-base</a>, <code>attention_mask</code> should <strong>not</strong> be passed
to avoid degraded performance when doing batched inference. For such models <code>input_values</code> should simply be
padded with 0 and passed without <code>attention_mask</code>. Be aware that these models also yield slightly different
results depending on whether <code>input_values</code> is padded or not.</p>

					</div>`,name:"attention_mask"},{anchor:"transformers.HubertForSequenceClassification.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.HubertForSequenceClassification.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.HubertForSequenceClassification.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.HubertForSequenceClassification.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/hubert/modeling_hubert.py#L1340",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/hubert#transformers.HubertConfig"
>HubertConfig</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>
`}}),Jt=new Io({props:{$$slots:{default:[Ol]},$$scope:{ctx:F}}}),Ft=new en({props:{anchor:"transformers.HubertForSequenceClassification.forward.example",$$slots:{default:[Kl]},$$scope:{ctx:F}}}),_o=new Tt({}),bo=new ot({props:{name:"class transformers.TFHubertModel",anchor:"transformers.TFHubertModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFHubertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig">HubertConfig</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/hubert/modeling_tf_hubert.py#L1279"}}),It=new Io({props:{$$slots:{default:[ei]},$$scope:{ctx:F}}}),wo=new ot({props:{name:"call",anchor:"transformers.TFHubertModel.call",parameters:[{name:"input_values",val:": tf.Tensor"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"token_type_ids",val:": tf.Tensor | None = None"},{name:"position_ids",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"inputs_embeds",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFHubertModel.call.input_values",description:`<strong>input_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> <code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_values"},{anchor:"transformers.TFHubertModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFHubertModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFHubertModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFHubertModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFHubertModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_values</code> you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>input_values</code> indices into associated vectors
than the model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFHubertModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFHubertModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFHubertModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFHubertModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/hubert/modeling_tf_hubert.py#L1285",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig"
>HubertConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),xt=new Io({props:{$$slots:{default:[ti]},$$scope:{ctx:F}}}),Zt=new en({props:{anchor:"transformers.TFHubertModel.call.example",$$slots:{default:[oi]},$$scope:{ctx:F}}}),Mo=new Tt({}),ko=new ot({props:{name:"class transformers.TFHubertForCTC",anchor:"transformers.TFHubertForCTC",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFHubertForCTC.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig">HubertConfig</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/hubert/modeling_tf_hubert.py#L1353"}}),Wt=new Io({props:{$$slots:{default:[ni]},$$scope:{ctx:F}}}),Ho=new ot({props:{name:"call",anchor:"transformers.TFHubertForCTC.call",parameters:[{name:"input_values",val:": tf.Tensor"},{name:"attention_mask",val:": tf.Tensor | None = None"},{name:"token_type_ids",val:": tf.Tensor | None = None"},{name:"position_ids",val:": tf.Tensor | None = None"},{name:"head_mask",val:": tf.Tensor | None = None"},{name:"inputs_embeds",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"labels",val:": tf.Tensor | None = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFHubertForCTC.call.input_values",description:`<strong>input_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> <code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.31.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.31.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_values"},{anchor:"transformers.TFHubertForCTC.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFHubertForCTC.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFHubertForCTC.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0})</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFHubertForCTC.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFHubertForCTC.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_values</code> you can choose to directly pass an embedded representation.
This is useful if you want more control over how to convert <code>input_values</code> indices into associated vectors
than the model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFHubertForCTC.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFHubertForCTC.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFHubertForCTC.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFHubertForCTC.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFHubertForCTC.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_values</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked),
the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/hubert/modeling_tf_hubert.py#L1380",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertConfig"
>HubertConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutput"
>transformers.modeling_tf_outputs.TFCausalLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Bt=new Io({props:{$$slots:{default:[si]},$$scope:{ctx:F}}}),Rt=new en({props:{anchor:"transformers.TFHubertForCTC.call.example",$$slots:{default:[ai]},$$scope:{ctx:F}}}),{c(){d=a("meta"),y=p(),f=a("h1"),m=a("a"),v=a("span"),w(i.$$.fragment),c=p(),H=a("span"),Re=n("Hubert"),Te=p(),Z=a("h2"),Q=a("a"),ee=a("span"),w(T.$$.fragment),ze=p(),X=a("span"),Ge=n("Overview"),we=p(),z=a("p"),Ve=n("Hubert was proposed in "),te=a("a"),oe=n("HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units"),qe=n(` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan
Salakhutdinov, Abdelrahman Mohamed.`),Me=p(),q=a("p"),Se=n("The abstract from the paper is the following:"),ke=p(),S=a("p"),ge=a("em"),Xe=n(`Self-supervised approaches for speech representation learning are challenged by three unique problems: (1) there are
multiple sound units in each input utterance, (2) there is no lexicon of input sound units during the pre-training
phase, and (3) sound units have variable lengths with no explicit segmentation. To deal with these three problems, we
propose the Hidden-Unit BERT (HuBERT) approach for self-supervised speech representation learning, which utilizes an
offline clustering step to provide aligned target labels for a BERT-like prediction loss. A key ingredient of our
approach is applying the prediction loss over the masked regions only, which forces the model to learn a combined
acoustic and language model over the continuous inputs. HuBERT relies primarily on the consistency of the unsupervised
clustering step rather than the intrinsic quality of the assigned cluster labels. Starting with a simple k-means
teacher of 100 clusters, and using two iterations of clustering, the HuBERT model either matches or improves upon the
state-of-the-art wav2vec 2.0 performance on the Librispeech (960h) and Libri-light (60,000h) benchmarks with 10min, 1h,
10h, 100h, and 960h fine-tuning subsets. Using a 1B parameter model, HuBERT shows up to 19% and 13% relative WER
reduction on the more challenging dev-other and test-other evaluation subsets.`),me=p(),U=a("p"),N=n("Tips:"),Ce=p(),G=a("ul"),_e=a("li"),Ye=n("Hubert is a speech model that accepts a float array corresponding to the raw waveform of the speech signal."),ne=p(),se=a("li"),Ae=n(`Hubert model was fine-tuned using connectionist temporal classification (CTC) so the model output has to be decoded
using `),x=a("a"),Pe=n("Wav2Vec2CTCTokenizer"),ae=n("."),je=p(),L=a("p"),re=n("This model was contributed by "),le=a("a"),De=n("patrickvonplaten"),Y=n("."),Ee=p(),W=a("h2"),O=a("a"),ie=a("span"),w(I.$$.fragment),Qe=p(),B=a("span"),Le=n("Documentation resources"),$e=p(),b=a("ul"),$=a("li"),He=a("a"),be=n("Audio classification task guide"),rt=p(),Oe=a("li"),J=a("a"),lt=n("Automatic speech recognition task guide"),nt=p(),de=a("h2"),fe=a("a"),Ke=a("span"),w(R.$$.fragment),ce=p(),et=a("span"),it=n("HubertConfig"),K=p(),V=a("div"),w(ve.$$.fragment),tt=p(),pe=a("p"),ye=n("This is the configuration class to store the configuration of a "),Je=a("a"),ms=n("HubertModel"),fs=n(`. It is used to instantiate an
Hubert 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 Hubert
`),Yt=a("a"),gs=n("facebook/hubert-base-ls960"),_s=n(" architecture."),bs=p(),dt=a("p"),vs=n("Configuration objects inherit from "),xo=a("a"),ys=n("PretrainedConfig"),Ts=n(` and can be used to control the model outputs. Read the
documentation from `),Zo=a("a"),ws=n("PretrainedConfig"),Ms=n(" for more information."),ks=p(),w(wt.$$.fragment),In=p(),ct=a("h2"),Mt=a("a"),nn=a("span"),w(At.$$.fragment),Cs=p(),sn=a("span"),js=n("HubertModel"),xn=p(),ue=a("div"),w(Pt.$$.fragment),Es=p(),Dt=a("p"),$s=n(`The bare Hubert Model transformer outputting raw hidden-states without any specific head on top.
Hubert was proposed in `),Qt=a("a"),Hs=n(`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),Js=n(` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),Fs=p(),Lt=a("p"),Us=n("This model inherits from "),No=a("a"),Is=n("PreTrainedModel"),xs=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Zs=p(),Ot=a("p"),Ns=n("This model is a PyTorch "),Kt=a("a"),Ws=n("torch.nn.Module"),Bs=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rs=p(),Fe=a("div"),w(eo.$$.fragment),zs=p(),pt=a("p"),Gs=n("The "),Wo=a("a"),Vs=n("HubertModel"),qs=n(" forward method, overrides the "),an=a("code"),Ss=n("__call__"),Xs=n(" special method."),Ys=p(),w(kt.$$.fragment),As=p(),w(Ct.$$.fragment),Zn=p(),ut=a("h2"),jt=a("a"),rn=a("span"),w(to.$$.fragment),Ps=p(),ln=a("span"),Ds=n("HubertForCTC"),Nn=p(),he=a("div"),w(oo.$$.fragment),Qs=p(),ht=a("p"),Ls=n("Hubert Model with a "),dn=a("code"),Os=n("language modeling"),Ks=n(` head on top for Connectionist Temporal Classification (CTC).
Hubert was proposed in `),no=a("a"),ea=n(`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),ta=n(` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),oa=p(),so=a("p"),na=n("This model inherits from "),Bo=a("a"),sa=n("PreTrainedModel"),aa=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),ra=p(),ao=a("p"),la=n("This model is a PyTorch "),ro=a("a"),ia=n("torch.nn.Module"),da=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ca=p(),Ue=a("div"),w(lo.$$.fragment),pa=p(),mt=a("p"),ua=n("The "),Ro=a("a"),ha=n("HubertForCTC"),ma=n(" forward method, overrides the "),cn=a("code"),fa=n("__call__"),ga=n(" special method."),_a=p(),w(Et.$$.fragment),ba=p(),w($t.$$.fragment),Wn=p(),ft=a("h2"),Ht=a("a"),pn=a("span"),w(io.$$.fragment),va=p(),un=a("span"),ya=n("HubertForSequenceClassification"),Bn=p(),A=a("div"),w(co.$$.fragment),Ta=p(),hn=a("p"),wa=n(`Hubert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),Ma=p(),po=a("p"),ka=n("Hubert was proposed in "),uo=a("a"),Ca=n(`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),ja=n(` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),Ea=p(),ho=a("p"),$a=n("This model inherits from "),zo=a("a"),Ha=n("PreTrainedModel"),Ja=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),Fa=p(),mo=a("p"),Ua=n("This model is a PyTorch "),fo=a("a"),Ia=n("torch.nn.Module"),xa=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Za=p(),Ie=a("div"),w(go.$$.fragment),Na=p(),gt=a("p"),Wa=n("The "),Go=a("a"),Ba=n("HubertForSequenceClassification"),Ra=n(" forward method, overrides the "),mn=a("code"),za=n("__call__"),Ga=n(" special method."),Va=p(),w(Jt.$$.fragment),qa=p(),w(Ft.$$.fragment),Rn=p(),_t=a("h2"),Ut=a("a"),fn=a("span"),w(_o.$$.fragment),Sa=p(),gn=a("span"),Xa=n("TFHubertModel"),zn=p(),P=a("div"),w(bo.$$.fragment),Ya=p(),_n=a("p"),Aa=n("The bare TFHubert Model transformer outputing raw hidden-states without any specific head on top."),Pa=p(),vo=a("p"),Da=n("This model inherits from "),Vo=a("a"),Qa=n("TFPreTrainedModel"),La=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Oa=p(),yo=a("p"),Ka=n("This model is also a "),To=a("a"),er=n("tf.keras.Model"),tr=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),or=p(),w(It.$$.fragment),nr=p(),xe=a("div"),w(wo.$$.fragment),sr=p(),bt=a("p"),ar=n("The "),qo=a("a"),rr=n("TFHubertModel"),lr=n(" forward method, overrides the "),bn=a("code"),ir=n("__call__"),dr=n(" special method."),cr=p(),w(xt.$$.fragment),pr=p(),w(Zt.$$.fragment),Gn=p(),vt=a("h2"),Nt=a("a"),vn=a("span"),w(Mo.$$.fragment),ur=p(),yn=a("span"),hr=n("TFHubertForCTC"),Vn=p(),D=a("div"),w(ko.$$.fragment),mr=p(),Co=a("p"),fr=n("TFHubert Model with a "),Tn=a("code"),gr=n("language modeling"),_r=n(" head on top for Connectionist Temporal Classification (CTC)."),br=p(),jo=a("p"),vr=n("This model inherits from "),So=a("a"),yr=n("TFPreTrainedModel"),Tr=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),wr=p(),Eo=a("p"),Mr=n("This model is also a "),$o=a("a"),kr=n("tf.keras.Model"),Cr=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),jr=p(),w(Wt.$$.fragment),Er=p(),Ze=a("div"),w(Ho.$$.fragment),$r=p(),yt=a("p"),Hr=n("The "),Xo=a("a"),Jr=n("TFHubertForCTC"),Fr=n(" forward method, overrides the "),wn=a("code"),Ur=n("__call__"),Ir=n(" special method."),xr=p(),w(Bt.$$.fragment),Zr=p(),w(Rt.$$.fragment),this.h()},l(o){const _=Xl('[data-svelte="svelte-1phssyn"]',document.head);d=r(_,"META",{name:!0,content:!0}),_.forEach(t),y=u(o),f=r(o,"H1",{class:!0});var Jo=l(f);m=r(Jo,"A",{id:!0,class:!0,href:!0});var Mn=l(m);v=r(Mn,"SPAN",{});var kn=l(v);M(i.$$.fragment,kn),kn.forEach(t),Mn.forEach(t),c=u(Jo),H=r(Jo,"SPAN",{});var Cn=l(H);Re=s(Cn,"Hubert"),Cn.forEach(t),Jo.forEach(t),Te=u(o),Z=r(o,"H2",{class:!0});var Fo=l(Z);Q=r(Fo,"A",{id:!0,class:!0,href:!0});var jn=l(Q);ee=r(jn,"SPAN",{});var En=l(ee);M(T.$$.fragment,En),En.forEach(t),jn.forEach(t),ze=u(Fo),X=r(Fo,"SPAN",{});var $n=l(X);Ge=s($n,"Overview"),$n.forEach(t),Fo.forEach(t),we=u(o),z=r(o,"P",{});var Uo=l(z);Ve=s(Uo,"Hubert was proposed in "),te=r(Uo,"A",{href:!0,rel:!0});var Hn=l(te);oe=s(Hn,"HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units"),Hn.forEach(t),qe=s(Uo,` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan
Salakhutdinov, Abdelrahman Mohamed.`),Uo.forEach(t),Me=u(o),q=r(o,"P",{});var Jn=l(q);Se=s(Jn,"The abstract from the paper is the following:"),Jn.forEach(t),ke=u(o),S=r(o,"P",{});var Fn=l(S);ge=r(Fn,"EM",{});var Un=l(ge);Xe=s(Un,`Self-supervised approaches for speech representation learning are challenged by three unique problems: (1) there are
multiple sound units in each input utterance, (2) there is no lexicon of input sound units during the pre-training
phase, and (3) sound units have variable lengths with no explicit segmentation. To deal with these three problems, we
propose the Hidden-Unit BERT (HuBERT) approach for self-supervised speech representation learning, which utilizes an
offline clustering step to provide aligned target labels for a BERT-like prediction loss. A key ingredient of our
approach is applying the prediction loss over the masked regions only, which forces the model to learn a combined
acoustic and language model over the continuous inputs. HuBERT relies primarily on the consistency of the unsupervised
clustering step rather than the intrinsic quality of the assigned cluster labels. Starting with a simple k-means
teacher of 100 clusters, and using two iterations of clustering, the HuBERT model either matches or improves upon the
state-of-the-art wav2vec 2.0 performance on the Librispeech (960h) and Libri-light (60,000h) benchmarks with 10min, 1h,
10h, 100h, and 960h fine-tuning subsets. Using a 1B parameter model, HuBERT shows up to 19% and 13% relative WER
reduction on the more challenging dev-other and test-other evaluation subsets.`),Un.forEach(t),Fn.forEach(t),me=u(o),U=r(o,"P",{});var Nr=l(U);N=s(Nr,"Tips:"),Nr.forEach(t),Ce=u(o),G=r(o,"UL",{});var Sn=l(G);_e=r(Sn,"LI",{});var Wr=l(_e);Ye=s(Wr,"Hubert is a speech model that accepts a float array corresponding to the raw waveform of the speech signal."),Wr.forEach(t),ne=u(Sn),se=r(Sn,"LI",{});var Xn=l(se);Ae=s(Xn,`Hubert model was fine-tuned using connectionist temporal classification (CTC) so the model output has to be decoded
using `),x=r(Xn,"A",{href:!0});var Br=l(x);Pe=s(Br,"Wav2Vec2CTCTokenizer"),Br.forEach(t),ae=s(Xn,"."),Xn.forEach(t),Sn.forEach(t),je=u(o),L=r(o,"P",{});var Yn=l(L);re=s(Yn,"This model was contributed by "),le=r(Yn,"A",{href:!0,rel:!0});var Rr=l(le);De=s(Rr,"patrickvonplaten"),Rr.forEach(t),Y=s(Yn,"."),Yn.forEach(t),Ee=u(o),W=r(o,"H2",{class:!0});var An=l(W);O=r(An,"A",{id:!0,class:!0,href:!0});var zr=l(O);ie=r(zr,"SPAN",{});var Gr=l(ie);M(I.$$.fragment,Gr),Gr.forEach(t),zr.forEach(t),Qe=u(An),B=r(An,"SPAN",{});var Vr=l(B);Le=s(Vr,"Documentation resources"),Vr.forEach(t),An.forEach(t),$e=u(o),b=r(o,"UL",{});var Pn=l(b);$=r(Pn,"LI",{});var qr=l($);He=r(qr,"A",{href:!0});var Sr=l(He);be=s(Sr,"Audio classification task guide"),Sr.forEach(t),qr.forEach(t),rt=u(Pn),Oe=r(Pn,"LI",{});var Xr=l(Oe);J=r(Xr,"A",{href:!0});var Yr=l(J);lt=s(Yr,"Automatic speech recognition task guide"),Yr.forEach(t),Xr.forEach(t),Pn.forEach(t),nt=u(o),de=r(o,"H2",{class:!0});var Dn=l(de);fe=r(Dn,"A",{id:!0,class:!0,href:!0});var Ar=l(fe);Ke=r(Ar,"SPAN",{});var Pr=l(Ke);M(R.$$.fragment,Pr),Pr.forEach(t),Ar.forEach(t),ce=u(Dn),et=r(Dn,"SPAN",{});var Dr=l(et);it=s(Dr,"HubertConfig"),Dr.forEach(t),Dn.forEach(t),K=u(o),V=r(o,"DIV",{class:!0});var zt=l(V);M(ve.$$.fragment,zt),tt=u(zt),pe=r(zt,"P",{});var Yo=l(pe);ye=s(Yo,"This is the configuration class to store the configuration of a "),Je=r(Yo,"A",{href:!0});var Qr=l(Je);ms=s(Qr,"HubertModel"),Qr.forEach(t),fs=s(Yo,`. It is used to instantiate an
Hubert 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 Hubert
`),Yt=r(Yo,"A",{href:!0,rel:!0});var Lr=l(Yt);gs=s(Lr,"facebook/hubert-base-ls960"),Lr.forEach(t),_s=s(Yo," architecture."),Yo.forEach(t),bs=u(zt),dt=r(zt,"P",{});var Ao=l(dt);vs=s(Ao,"Configuration objects inherit from "),xo=r(Ao,"A",{href:!0});var Or=l(xo);ys=s(Or,"PretrainedConfig"),Or.forEach(t),Ts=s(Ao,` and can be used to control the model outputs. Read the
documentation from `),Zo=r(Ao,"A",{href:!0});var Kr=l(Zo);ws=s(Kr,"PretrainedConfig"),Kr.forEach(t),Ms=s(Ao," for more information."),Ao.forEach(t),ks=u(zt),M(wt.$$.fragment,zt),zt.forEach(t),In=u(o),ct=r(o,"H2",{class:!0});var Qn=l(ct);Mt=r(Qn,"A",{id:!0,class:!0,href:!0});var el=l(Mt);nn=r(el,"SPAN",{});var tl=l(nn);M(At.$$.fragment,tl),tl.forEach(t),el.forEach(t),Cs=u(Qn),sn=r(Qn,"SPAN",{});var ol=l(sn);js=s(ol,"HubertModel"),ol.forEach(t),Qn.forEach(t),xn=u(o),ue=r(o,"DIV",{class:!0});var st=l(ue);M(Pt.$$.fragment,st),Es=u(st),Dt=r(st,"P",{});var Ln=l(Dt);$s=s(Ln,`The bare Hubert Model transformer outputting raw hidden-states without any specific head on top.
Hubert was proposed in `),Qt=r(Ln,"A",{href:!0,rel:!0});var nl=l(Qt);Hs=s(nl,`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),nl.forEach(t),Js=s(Ln,` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),Ln.forEach(t),Fs=u(st),Lt=r(st,"P",{});var On=l(Lt);Us=s(On,"This model inherits from "),No=r(On,"A",{href:!0});var sl=l(No);Is=s(sl,"PreTrainedModel"),sl.forEach(t),xs=s(On,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),On.forEach(t),Zs=u(st),Ot=r(st,"P",{});var Kn=l(Ot);Ns=s(Kn,"This model is a PyTorch "),Kt=r(Kn,"A",{href:!0,rel:!0});var al=l(Kt);Ws=s(al,"torch.nn.Module"),al.forEach(t),Bs=s(Kn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Kn.forEach(t),Rs=u(st),Fe=r(st,"DIV",{class:!0});var Gt=l(Fe);M(eo.$$.fragment,Gt),zs=u(Gt),pt=r(Gt,"P",{});var Po=l(pt);Gs=s(Po,"The "),Wo=r(Po,"A",{href:!0});var rl=l(Wo);Vs=s(rl,"HubertModel"),rl.forEach(t),qs=s(Po," forward method, overrides the "),an=r(Po,"CODE",{});var ll=l(an);Ss=s(ll,"__call__"),ll.forEach(t),Xs=s(Po," special method."),Po.forEach(t),Ys=u(Gt),M(kt.$$.fragment,Gt),As=u(Gt),M(Ct.$$.fragment,Gt),Gt.forEach(t),st.forEach(t),Zn=u(o),ut=r(o,"H2",{class:!0});var es=l(ut);jt=r(es,"A",{id:!0,class:!0,href:!0});var il=l(jt);rn=r(il,"SPAN",{});var dl=l(rn);M(to.$$.fragment,dl),dl.forEach(t),il.forEach(t),Ps=u(es),ln=r(es,"SPAN",{});var cl=l(ln);Ds=s(cl,"HubertForCTC"),cl.forEach(t),es.forEach(t),Nn=u(o),he=r(o,"DIV",{class:!0});var at=l(he);M(oo.$$.fragment,at),Qs=u(at),ht=r(at,"P",{});var Do=l(ht);Ls=s(Do,"Hubert Model with a "),dn=r(Do,"CODE",{});var pl=l(dn);Os=s(pl,"language modeling"),pl.forEach(t),Ks=s(Do,` head on top for Connectionist Temporal Classification (CTC).
Hubert was proposed in `),no=r(Do,"A",{href:!0,rel:!0});var ul=l(no);ea=s(ul,`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),ul.forEach(t),ta=s(Do,` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),Do.forEach(t),oa=u(at),so=r(at,"P",{});var ts=l(so);na=s(ts,"This model inherits from "),Bo=r(ts,"A",{href:!0});var hl=l(Bo);sa=s(hl,"PreTrainedModel"),hl.forEach(t),aa=s(ts,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),ts.forEach(t),ra=u(at),ao=r(at,"P",{});var os=l(ao);la=s(os,"This model is a PyTorch "),ro=r(os,"A",{href:!0,rel:!0});var ml=l(ro);ia=s(ml,"torch.nn.Module"),ml.forEach(t),da=s(os,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),os.forEach(t),ca=u(at),Ue=r(at,"DIV",{class:!0});var Vt=l(Ue);M(lo.$$.fragment,Vt),pa=u(Vt),mt=r(Vt,"P",{});var Qo=l(mt);ua=s(Qo,"The "),Ro=r(Qo,"A",{href:!0});var fl=l(Ro);ha=s(fl,"HubertForCTC"),fl.forEach(t),ma=s(Qo," forward method, overrides the "),cn=r(Qo,"CODE",{});var gl=l(cn);fa=s(gl,"__call__"),gl.forEach(t),ga=s(Qo," special method."),Qo.forEach(t),_a=u(Vt),M(Et.$$.fragment,Vt),ba=u(Vt),M($t.$$.fragment,Vt),Vt.forEach(t),at.forEach(t),Wn=u(o),ft=r(o,"H2",{class:!0});var ns=l(ft);Ht=r(ns,"A",{id:!0,class:!0,href:!0});var _l=l(Ht);pn=r(_l,"SPAN",{});var bl=l(pn);M(io.$$.fragment,bl),bl.forEach(t),_l.forEach(t),va=u(ns),un=r(ns,"SPAN",{});var vl=l(un);ya=s(vl,"HubertForSequenceClassification"),vl.forEach(t),ns.forEach(t),Bn=u(o),A=r(o,"DIV",{class:!0});var Ne=l(A);M(co.$$.fragment,Ne),Ta=u(Ne),hn=r(Ne,"P",{});var yl=l(hn);wa=s(yl,`Hubert Model with a sequence classification head on top (a linear layer over the pooled output) for tasks like
SUPERB Keyword Spotting.`),yl.forEach(t),Ma=u(Ne),po=r(Ne,"P",{});var ss=l(po);ka=s(ss,"Hubert was proposed in "),uo=r(ss,"A",{href:!0,rel:!0});var Tl=l(uo);Ca=s(Tl,`HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden
Units`),Tl.forEach(t),ja=s(ss,` by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia,
Ruslan Salakhutdinov, Abdelrahman Mohamed.`),ss.forEach(t),Ea=u(Ne),ho=r(Ne,"P",{});var as=l(ho);$a=s(as,"This model inherits from "),zo=r(as,"A",{href:!0});var wl=l(zo);Ha=s(wl,"PreTrainedModel"),wl.forEach(t),Ja=s(as,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving etc.).`),as.forEach(t),Fa=u(Ne),mo=r(Ne,"P",{});var rs=l(mo);Ua=s(rs,"This model is a PyTorch "),fo=r(rs,"A",{href:!0,rel:!0});var Ml=l(fo);Ia=s(Ml,"torch.nn.Module"),Ml.forEach(t),xa=s(rs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),rs.forEach(t),Za=u(Ne),Ie=r(Ne,"DIV",{class:!0});var qt=l(Ie);M(go.$$.fragment,qt),Na=u(qt),gt=r(qt,"P",{});var Lo=l(gt);Wa=s(Lo,"The "),Go=r(Lo,"A",{href:!0});var kl=l(Go);Ba=s(kl,"HubertForSequenceClassification"),kl.forEach(t),Ra=s(Lo," forward method, overrides the "),mn=r(Lo,"CODE",{});var Cl=l(mn);za=s(Cl,"__call__"),Cl.forEach(t),Ga=s(Lo," special method."),Lo.forEach(t),Va=u(qt),M(Jt.$$.fragment,qt),qa=u(qt),M(Ft.$$.fragment,qt),qt.forEach(t),Ne.forEach(t),Rn=u(o),_t=r(o,"H2",{class:!0});var ls=l(_t);Ut=r(ls,"A",{id:!0,class:!0,href:!0});var jl=l(Ut);fn=r(jl,"SPAN",{});var El=l(fn);M(_o.$$.fragment,El),El.forEach(t),jl.forEach(t),Sa=u(ls),gn=r(ls,"SPAN",{});var $l=l(gn);Xa=s($l,"TFHubertModel"),$l.forEach(t),ls.forEach(t),zn=u(o),P=r(o,"DIV",{class:!0});var We=l(P);M(bo.$$.fragment,We),Ya=u(We),_n=r(We,"P",{});var Hl=l(_n);Aa=s(Hl,"The bare TFHubert Model transformer outputing raw hidden-states without any specific head on top."),Hl.forEach(t),Pa=u(We),vo=r(We,"P",{});var is=l(vo);Da=s(is,"This model inherits from "),Vo=r(is,"A",{href:!0});var Jl=l(Vo);Qa=s(Jl,"TFPreTrainedModel"),Jl.forEach(t),La=s(is,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),is.forEach(t),Oa=u(We),yo=r(We,"P",{});var ds=l(yo);Ka=s(ds,"This model is also a "),To=r(ds,"A",{href:!0,rel:!0});var Fl=l(To);er=s(Fl,"tf.keras.Model"),Fl.forEach(t),tr=s(ds,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),ds.forEach(t),or=u(We),M(It.$$.fragment,We),nr=u(We),xe=r(We,"DIV",{class:!0});var St=l(xe);M(wo.$$.fragment,St),sr=u(St),bt=r(St,"P",{});var Oo=l(bt);ar=s(Oo,"The "),qo=r(Oo,"A",{href:!0});var Ul=l(qo);rr=s(Ul,"TFHubertModel"),Ul.forEach(t),lr=s(Oo," forward method, overrides the "),bn=r(Oo,"CODE",{});var Il=l(bn);ir=s(Il,"__call__"),Il.forEach(t),dr=s(Oo," special method."),Oo.forEach(t),cr=u(St),M(xt.$$.fragment,St),pr=u(St),M(Zt.$$.fragment,St),St.forEach(t),We.forEach(t),Gn=u(o),vt=r(o,"H2",{class:!0});var cs=l(vt);Nt=r(cs,"A",{id:!0,class:!0,href:!0});var xl=l(Nt);vn=r(xl,"SPAN",{});var Zl=l(vn);M(Mo.$$.fragment,Zl),Zl.forEach(t),xl.forEach(t),ur=u(cs),yn=r(cs,"SPAN",{});var Nl=l(yn);hr=s(Nl,"TFHubertForCTC"),Nl.forEach(t),cs.forEach(t),Vn=u(o),D=r(o,"DIV",{class:!0});var Be=l(D);M(ko.$$.fragment,Be),mr=u(Be),Co=r(Be,"P",{});var ps=l(Co);fr=s(ps,"TFHubert Model with a "),Tn=r(ps,"CODE",{});var Wl=l(Tn);gr=s(Wl,"language modeling"),Wl.forEach(t),_r=s(ps," head on top for Connectionist Temporal Classification (CTC)."),ps.forEach(t),br=u(Be),jo=r(Be,"P",{});var us=l(jo);vr=s(us,"This model inherits from "),So=r(us,"A",{href:!0});var Bl=l(So);yr=s(Bl,"TFPreTrainedModel"),Bl.forEach(t),Tr=s(us,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),us.forEach(t),wr=u(Be),Eo=r(Be,"P",{});var hs=l(Eo);Mr=s(hs,"This model is also a "),$o=r(hs,"A",{href:!0,rel:!0});var Rl=l($o);kr=s(Rl,"tf.keras.Model"),Rl.forEach(t),Cr=s(hs,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),hs.forEach(t),jr=u(Be),M(Wt.$$.fragment,Be),Er=u(Be),Ze=r(Be,"DIV",{class:!0});var Xt=l(Ze);M(Ho.$$.fragment,Xt),$r=u(Xt),yt=r(Xt,"P",{});var Ko=l(yt);Hr=s(Ko,"The "),Xo=r(Ko,"A",{href:!0});var zl=l(Xo);Jr=s(zl,"TFHubertForCTC"),zl.forEach(t),Fr=s(Ko," forward method, overrides the "),wn=r(Ko,"CODE",{});var Gl=l(wn);Ur=s(Gl,"__call__"),Gl.forEach(t),Ir=s(Ko," special method."),Ko.forEach(t),xr=u(Xt),M(Bt.$$.fragment,Xt),Zr=u(Xt),M(Rt.$$.fragment,Xt),Xt.forEach(t),Be.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(li)),h(m,"id","hubert"),h(m,"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"),h(m,"href","#hubert"),h(f,"class","relative group"),h(Q,"id","overview"),h(Q,"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"),h(Q,"href","#overview"),h(Z,"class","relative group"),h(te,"href","https://arxiv.org/abs/2106.07447"),h(te,"rel","nofollow"),h(x,"href","/docs/transformers/v4.31.0/en/model_doc/wav2vec2#transformers.Wav2Vec2CTCTokenizer"),h(le,"href","https://huggingface.co/patrickvonplaten"),h(le,"rel","nofollow"),h(O,"id","documentation-resources"),h(O,"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"),h(O,"href","#documentation-resources"),h(W,"class","relative group"),h(He,"href","../tasks/audio_classification"),h(J,"href","../tasks/asr"),h(fe,"id","transformers.HubertConfig"),h(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(fe,"href","#transformers.HubertConfig"),h(de,"class","relative group"),h(Je,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertModel"),h(Yt,"href","https://huggingface.co/facebook/hubert-base-ls960"),h(Yt,"rel","nofollow"),h(xo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Zo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Mt,"id","transformers.HubertModel"),h(Mt,"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"),h(Mt,"href","#transformers.HubertModel"),h(ct,"class","relative group"),h(Qt,"href","https://arxiv.org/abs/2106.07447"),h(Qt,"rel","nofollow"),h(No,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(Kt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Kt,"rel","nofollow"),h(Wo,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertModel"),h(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(jt,"id","transformers.HubertForCTC"),h(jt,"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"),h(jt,"href","#transformers.HubertForCTC"),h(ut,"class","relative group"),h(no,"href","https://arxiv.org/abs/2106.07447"),h(no,"rel","nofollow"),h(Bo,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(ro,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ro,"rel","nofollow"),h(Ro,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertForCTC"),h(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ht,"id","transformers.HubertForSequenceClassification"),h(Ht,"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"),h(Ht,"href","#transformers.HubertForSequenceClassification"),h(ft,"class","relative group"),h(uo,"href","https://arxiv.org/abs/2106.07447"),h(uo,"rel","nofollow"),h(zo,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.PreTrainedModel"),h(fo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(fo,"rel","nofollow"),h(Go,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.HubertForSequenceClassification"),h(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ut,"id","transformers.TFHubertModel"),h(Ut,"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"),h(Ut,"href","#transformers.TFHubertModel"),h(_t,"class","relative group"),h(Vo,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),h(To,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(To,"rel","nofollow"),h(qo,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.TFHubertModel"),h(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Nt,"id","transformers.TFHubertForCTC"),h(Nt,"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"),h(Nt,"href","#transformers.TFHubertForCTC"),h(vt,"class","relative group"),h(So,"href","/docs/transformers/v4.31.0/en/main_classes/model#transformers.TFPreTrainedModel"),h($o,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h($o,"rel","nofollow"),h(Xo,"href","/docs/transformers/v4.31.0/en/model_doc/hubert#transformers.TFHubertForCTC"),h(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,_){e(document.head,d),g(o,y,_),g(o,f,_),e(f,m),e(m,v),k(i,v,null),e(f,c),e(f,H),e(H,Re),g(o,Te,_),g(o,Z,_),e(Z,Q),e(Q,ee),k(T,ee,null),e(Z,ze),e(Z,X),e(X,Ge),g(o,we,_),g(o,z,_),e(z,Ve),e(z,te),e(te,oe),e(z,qe),g(o,Me,_),g(o,q,_),e(q,Se),g(o,ke,_),g(o,S,_),e(S,ge),e(ge,Xe),g(o,me,_),g(o,U,_),e(U,N),g(o,Ce,_),g(o,G,_),e(G,_e),e(_e,Ye),e(G,ne),e(G,se),e(se,Ae),e(se,x),e(x,Pe),e(se,ae),g(o,je,_),g(o,L,_),e(L,re),e(L,le),e(le,De),e(L,Y),g(o,Ee,_),g(o,W,_),e(W,O),e(O,ie),k(I,ie,null),e(W,Qe),e(W,B),e(B,Le),g(o,$e,_),g(o,b,_),e(b,$),e($,He),e(He,be),e(b,rt),e(b,Oe),e(Oe,J),e(J,lt),g(o,nt,_),g(o,de,_),e(de,fe),e(fe,Ke),k(R,Ke,null),e(de,ce),e(de,et),e(et,it),g(o,K,_),g(o,V,_),k(ve,V,null),e(V,tt),e(V,pe),e(pe,ye),e(pe,Je),e(Je,ms),e(pe,fs),e(pe,Yt),e(Yt,gs),e(pe,_s),e(V,bs),e(V,dt),e(dt,vs),e(dt,xo),e(xo,ys),e(dt,Ts),e(dt,Zo),e(Zo,ws),e(dt,Ms),e(V,ks),k(wt,V,null),g(o,In,_),g(o,ct,_),e(ct,Mt),e(Mt,nn),k(At,nn,null),e(ct,Cs),e(ct,sn),e(sn,js),g(o,xn,_),g(o,ue,_),k(Pt,ue,null),e(ue,Es),e(ue,Dt),e(Dt,$s),e(Dt,Qt),e(Qt,Hs),e(Dt,Js),e(ue,Fs),e(ue,Lt),e(Lt,Us),e(Lt,No),e(No,Is),e(Lt,xs),e(ue,Zs),e(ue,Ot),e(Ot,Ns),e(Ot,Kt),e(Kt,Ws),e(Ot,Bs),e(ue,Rs),e(ue,Fe),k(eo,Fe,null),e(Fe,zs),e(Fe,pt),e(pt,Gs),e(pt,Wo),e(Wo,Vs),e(pt,qs),e(pt,an),e(an,Ss),e(pt,Xs),e(Fe,Ys),k(kt,Fe,null),e(Fe,As),k(Ct,Fe,null),g(o,Zn,_),g(o,ut,_),e(ut,jt),e(jt,rn),k(to,rn,null),e(ut,Ps),e(ut,ln),e(ln,Ds),g(o,Nn,_),g(o,he,_),k(oo,he,null),e(he,Qs),e(he,ht),e(ht,Ls),e(ht,dn),e(dn,Os),e(ht,Ks),e(ht,no),e(no,ea),e(ht,ta),e(he,oa),e(he,so),e(so,na),e(so,Bo),e(Bo,sa),e(so,aa),e(he,ra),e(he,ao),e(ao,la),e(ao,ro),e(ro,ia),e(ao,da),e(he,ca),e(he,Ue),k(lo,Ue,null),e(Ue,pa),e(Ue,mt),e(mt,ua),e(mt,Ro),e(Ro,ha),e(mt,ma),e(mt,cn),e(cn,fa),e(mt,ga),e(Ue,_a),k(Et,Ue,null),e(Ue,ba),k($t,Ue,null),g(o,Wn,_),g(o,ft,_),e(ft,Ht),e(Ht,pn),k(io,pn,null),e(ft,va),e(ft,un),e(un,ya),g(o,Bn,_),g(o,A,_),k(co,A,null),e(A,Ta),e(A,hn),e(hn,wa),e(A,Ma),e(A,po),e(po,ka),e(po,uo),e(uo,Ca),e(po,ja),e(A,Ea),e(A,ho),e(ho,$a),e(ho,zo),e(zo,Ha),e(ho,Ja),e(A,Fa),e(A,mo),e(mo,Ua),e(mo,fo),e(fo,Ia),e(mo,xa),e(A,Za),e(A,Ie),k(go,Ie,null),e(Ie,Na),e(Ie,gt),e(gt,Wa),e(gt,Go),e(Go,Ba),e(gt,Ra),e(gt,mn),e(mn,za),e(gt,Ga),e(Ie,Va),k(Jt,Ie,null),e(Ie,qa),k(Ft,Ie,null),g(o,Rn,_),g(o,_t,_),e(_t,Ut),e(Ut,fn),k(_o,fn,null),e(_t,Sa),e(_t,gn),e(gn,Xa),g(o,zn,_),g(o,P,_),k(bo,P,null),e(P,Ya),e(P,_n),e(_n,Aa),e(P,Pa),e(P,vo),e(vo,Da),e(vo,Vo),e(Vo,Qa),e(vo,La),e(P,Oa),e(P,yo),e(yo,Ka),e(yo,To),e(To,er),e(yo,tr),e(P,or),k(It,P,null),e(P,nr),e(P,xe),k(wo,xe,null),e(xe,sr),e(xe,bt),e(bt,ar),e(bt,qo),e(qo,rr),e(bt,lr),e(bt,bn),e(bn,ir),e(bt,dr),e(xe,cr),k(xt,xe,null),e(xe,pr),k(Zt,xe,null),g(o,Gn,_),g(o,vt,_),e(vt,Nt),e(Nt,vn),k(Mo,vn,null),e(vt,ur),e(vt,yn),e(yn,hr),g(o,Vn,_),g(o,D,_),k(ko,D,null),e(D,mr),e(D,Co),e(Co,fr),e(Co,Tn),e(Tn,gr),e(Co,_r),e(D,br),e(D,jo),e(jo,vr),e(jo,So),e(So,yr),e(jo,Tr),e(D,wr),e(D,Eo),e(Eo,Mr),e(Eo,$o),e($o,kr),e(Eo,Cr),e(D,jr),k(Wt,D,null),e(D,Er),e(D,Ze),k(Ho,Ze,null),e(Ze,$r),e(Ze,yt),e(yt,Hr),e(yt,Xo),e(Xo,Jr),e(yt,Fr),e(yt,wn),e(wn,Ur),e(yt,Ir),e(Ze,xr),k(Bt,Ze,null),e(Ze,Zr),k(Rt,Ze,null),qn=!0},p(o,[_]){const Jo={};_&2&&(Jo.$$scope={dirty:_,ctx:o}),wt.$set(Jo);const Mn={};_&2&&(Mn.$$scope={dirty:_,ctx:o}),kt.$set(Mn);const kn={};_&2&&(kn.$$scope={dirty:_,ctx:o}),Ct.$set(kn);const Cn={};_&2&&(Cn.$$scope={dirty:_,ctx:o}),Et.$set(Cn);const Fo={};_&2&&(Fo.$$scope={dirty:_,ctx:o}),$t.$set(Fo);const jn={};_&2&&(jn.$$scope={dirty:_,ctx:o}),Jt.$set(jn);const En={};_&2&&(En.$$scope={dirty:_,ctx:o}),Ft.$set(En);const $n={};_&2&&($n.$$scope={dirty:_,ctx:o}),It.$set($n);const Uo={};_&2&&(Uo.$$scope={dirty:_,ctx:o}),xt.$set(Uo);const Hn={};_&2&&(Hn.$$scope={dirty:_,ctx:o}),Zt.$set(Hn);const Jn={};_&2&&(Jn.$$scope={dirty:_,ctx:o}),Wt.$set(Jn);const Fn={};_&2&&(Fn.$$scope={dirty:_,ctx:o}),Bt.$set(Fn);const Un={};_&2&&(Un.$$scope={dirty:_,ctx:o}),Rt.$set(Un)},i(o){qn||(C(i.$$.fragment,o),C(T.$$.fragment,o),C(I.$$.fragment,o),C(R.$$.fragment,o),C(ve.$$.fragment,o),C(wt.$$.fragment,o),C(At.$$.fragment,o),C(Pt.$$.fragment,o),C(eo.$$.fragment,o),C(kt.$$.fragment,o),C(Ct.$$.fragment,o),C(to.$$.fragment,o),C(oo.$$.fragment,o),C(lo.$$.fragment,o),C(Et.$$.fragment,o),C($t.$$.fragment,o),C(io.$$.fragment,o),C(co.$$.fragment,o),C(go.$$.fragment,o),C(Jt.$$.fragment,o),C(Ft.$$.fragment,o),C(_o.$$.fragment,o),C(bo.$$.fragment,o),C(It.$$.fragment,o),C(wo.$$.fragment,o),C(xt.$$.fragment,o),C(Zt.$$.fragment,o),C(Mo.$$.fragment,o),C(ko.$$.fragment,o),C(Wt.$$.fragment,o),C(Ho.$$.fragment,o),C(Bt.$$.fragment,o),C(Rt.$$.fragment,o),qn=!0)},o(o){j(i.$$.fragment,o),j(T.$$.fragment,o),j(I.$$.fragment,o),j(R.$$.fragment,o),j(ve.$$.fragment,o),j(wt.$$.fragment,o),j(At.$$.fragment,o),j(Pt.$$.fragment,o),j(eo.$$.fragment,o),j(kt.$$.fragment,o),j(Ct.$$.fragment,o),j(to.$$.fragment,o),j(oo.$$.fragment,o),j(lo.$$.fragment,o),j(Et.$$.fragment,o),j($t.$$.fragment,o),j(io.$$.fragment,o),j(co.$$.fragment,o),j(go.$$.fragment,o),j(Jt.$$.fragment,o),j(Ft.$$.fragment,o),j(_o.$$.fragment,o),j(bo.$$.fragment,o),j(It.$$.fragment,o),j(wo.$$.fragment,o),j(xt.$$.fragment,o),j(Zt.$$.fragment,o),j(Mo.$$.fragment,o),j(ko.$$.fragment,o),j(Wt.$$.fragment,o),j(Ho.$$.fragment,o),j(Bt.$$.fragment,o),j(Rt.$$.fragment,o),qn=!1},d(o){t(d),o&&t(y),o&&t(f),E(i),o&&t(Te),o&&t(Z),E(T),o&&t(we),o&&t(z),o&&t(Me),o&&t(q),o&&t(ke),o&&t(S),o&&t(me),o&&t(U),o&&t(Ce),o&&t(G),o&&t(je),o&&t(L),o&&t(Ee),o&&t(W),E(I),o&&t($e),o&&t(b),o&&t(nt),o&&t(de),E(R),o&&t(K),o&&t(V),E(ve),E(wt),o&&t(In),o&&t(ct),E(At),o&&t(xn),o&&t(ue),E(Pt),E(eo),E(kt),E(Ct),o&&t(Zn),o&&t(ut),E(to),o&&t(Nn),o&&t(he),E(oo),E(lo),E(Et),E($t),o&&t(Wn),o&&t(ft),E(io),o&&t(Bn),o&&t(A),E(co),E(go),E(Jt),E(Ft),o&&t(Rn),o&&t(_t),E(_o),o&&t(zn),o&&t(P),E(bo),E(It),E(wo),E(xt),E(Zt),o&&t(Gn),o&&t(vt),E(Mo),o&&t(Vn),o&&t(D),E(ko),E(Wt),E(Ho),E(Bt),E(Rt)}}}const li={local:"hubert",sections:[{local:"overview",title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.HubertConfig",title:"HubertConfig"},{local:"transformers.HubertModel",title:"HubertModel"},{local:"transformers.HubertForCTC",title:"HubertForCTC"},{local:"transformers.HubertForSequenceClassification",title:"HubertForSequenceClassification"},{local:"transformers.TFHubertModel",title:"TFHubertModel"},{local:"transformers.TFHubertForCTC",title:"TFHubertForCTC"}],title:"Hubert"};function ii(F){return Yl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fi extends Vl{constructor(d){super();ql(this,d,ii,ri,Sl,{})}}export{fi as default,li as metadata};
