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="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6595em;"></span><span class="mord mathnormal">i</span></span></span></span>',Xn,On,of='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo>+</mo><mn>1</mn></mrow><annotation encoding="application/x-tex"> i + 1 </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7429em;vertical-align:-0.0833em;"></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span>',zn,pl,fc,yc,Pn,rf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo>+</mo><mn>1</mn></mrow><annotation encoding="application/x-tex"> i + 1 </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7429em;vertical-align:-0.0833em;"></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span>',Dn,Ln,pf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex"> i </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6595em;"></span><span class="mord mathnormal">i</span></span></span></span>',Kn,hl,wc,Mc,Et,Tc,gc,eo,Ee,bc,cl,Uc,Ec,to,ve,vc,dl,Jc,jc,so,vt,ao,as,ml,kc,lo,Jt,no,ls,Ic,oo,Je,Sc,ul,_c,Bc,ro,je,Rc,fl,Gc,Wc,io,jt,po,ns,yl,Vc,ho,kt,co,os,Cc,mo,ne,ke,wl,It,$c,Ml,xc,uo,z,Fc,Tl,Ac,Nc,gl,Zc,Yc,fo,P,Hc,bl,qc,Qc,St,Xc,Oc,yo,Ie,zc,Ul,Pc,Dc,wo;return Be=new El({}),We=new El({}),Ve=new T({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMEElMjAlMjAlMjAlMjAlMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGbGlicmlzcGVlY2hfYXNyX2R1bW15JTIyJTJDJTIwJTIyY2xlYW4lMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIlMEEpJTBBZGF0YXNldA==",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

dataset = load_dataset(
    <span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>
)
dataset`}}),Ce=new T({props:{code:"RGF0YXNldCglN0IlMEElMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1QidmaWxlJyUyQyUyMCdhdWRpbyclMkMlMjAndGV4dCclMkMlMjAnc3BlYWtlcl9pZCclMkMlMjAnY2hhcHRlcl9pZCclMkMlMjAnaWQnJTVEJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3Jvd3MlM0ElMjA3MyUwQSU3RCk=",highlighted:`<span class="hljs-built_in">Dataset</span>({
    features: <span class="hljs-selector-attr">[<span class="hljs-string">&#x27;file&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;text&#x27;</span>, <span class="hljs-string">&#x27;speaker_id&#x27;</span>, <span class="hljs-string">&#x27;chapter_id&#x27;</span>, <span class="hljs-string">&#x27;id&#x27;</span>]</span>,
    num_rows: <span class="hljs-number">73</span>
})`}}),$e=new T({props:{code:"ZnJvbSUyMElQeXRob24uZGlzcGxheSUyMGltcG9ydCUyMEF1ZGlvJTBBJTBBc2FtcGxlJTIwJTNEJTIwZGF0YXNldCU1QjIlNUQlMEElMEFwcmludChzYW1wbGUlNUIlMjJ0ZXh0JTIyJTVEKSUwQUF1ZGlvKHNhbXBsZSU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyYXJyYXklMjIlNUQlMkMlMjByYXRlJTNEc2FtcGxlJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJzYW1wbGluZ19yYXRlJTIyJTVEKQ==",highlighted:`<span class="hljs-keyword">from</span> IPython.display <span class="hljs-keyword">import</span> Audio

sample = dataset[<span class="hljs-number">2</span>]

<span class="hljs-built_in">print</span>(sample[<span class="hljs-string">&quot;text&quot;</span>])
Audio(sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], rate=sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;sampling_rate&quot;</span>])`}}),xe=new T({props:{code:"SEUlMjBURUxMUyUyMFVTJTIwVEhBVCUyMEFUJTIwVEhJUyUyMEZFU1RJVkUlMjBTRUFTT04lMjBPRiUyMFRIRSUyMFlFQVIlMjBXSVRIJTIwQ0hSSVNUTUFTJTIwQU5EJTIwUk9BU1QlMjBCRUVGJTIwTE9PTUlORyUyMEJFRk9SRSUyMFVTJTIwU0lNSUxFUyUyMERSQVdOJTIwRlJPTSUyMEVBVElORyUyMEFORCUyMElUUyUyMFJFU1VMVFMlMjBPQ0NVUiUyME1PU1QlMjBSRUFESUxZJTIwVE8lMjBUSEUlMjBNSU5E",highlighted:'HE TELLS US THAT <span class="hljs-built_in">AT</span> THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAS <span class="hljs-keyword">AND </span>ROAST <span class="hljs-keyword">BEEF </span>LOOMING <span class="hljs-keyword">BEFORE </span>US SIMILES DRAWN FROM EATING <span class="hljs-keyword">AND </span>ITS RESULTS OCCUR MOST READILY TO THE MIND'}}),Fe=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKCUyMmF1dG9tYXRpYy1zcGVlY2gtcmVjb2duaXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMmZhY2Vib29rJTJGd2F2MnZlYzItYmFzZS0xMDBoJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe = pipeline(<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;facebook/wav2vec2-base-100h&quot;</span>)`}}),Ae=new T({props:{code:"cGlwZShzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RC5jb3B5KCkp",highlighted:'pipe(sample[<span class="hljs-string">&quot;audio&quot;</span>].copy())'}}),Ne=new T({props:{code:"JTdCJTIydGV4dCUyMiUzQSUyMCUyMkhFJTIwVEVMTFMlMjBVUyUyMFRIQVQlMjBBVCUyMFRISVMlMjBGRVNUSVZFJTIwU0VBU09OJTIwT0YlMjBUSEUlMjBZRUFSJTIwV0lUSCUyMENIUklTVE1BVVMlMjBBTkQlMjBST1NFJTIwQkVFRiUyMExPT01JTkclMjBCRUZPUkUlMjBVUyUyMFNJTUFMWUlTJTIwRFJBV04lMjBGUk9NJTIwRUFUSU5HJTIwQU5EJTIwSVRTJTIwUkVTVUxUUyUyME9DQ1VSJTIwTU9TVCUyMFJFQURJTFklMjBUTyUyMFRIRSUyME1JTkQlMjIlN0Q=",highlighted:'<span class="hljs-comment">{&quot;text&quot;: &quot;HE TELLS US THAT AT THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAUS AND ROSE BEEF LOOMING BEFORE US SIMALYIS DRAWN FROM EATING AND ITS RESULTS OCCUR MOST READILY TO THE MIND&quot;}</span>'}}),Ze=new T({props:{code:"VGFyZ2V0JTNBJTIwJTIwJTIwJTIwJTIwJTIwSEUlMjBURUxMUyUyMFVTJTIwVEhBVCUyMEFUJTIwVEhJUyUyMEZFU1RJVkUlMjBTRUFTT04lMjBPRiUyMFRIRSUyMFlFQVIlMjBXSVRIJTIwQ0hSSVNUTUFTJTIwQU5EJTIwUk9BU1QlMjBCRUVGJTIwTE9PTUlORyUyMEJFRk9SRSUyMFVTJTIwU0lNSUxFUyUyMERSQVdOJTIwRlJPTSUyMEVBVElORyUyMEFORCUyMElUUyUyMFJFU1VMVFMlMjBPQ0NVUiUyME1PU1QlMjBSRUFESUxZJTIwVE8lMjBUSEUlMjBNSU5EJTBBUHJlZGljdGlvbiUzQSUyMCUyMEhFJTIwVEVMTFMlMjBVUyUyMFRIQVQlMjBBVCUyMFRISVMlMjBGRVNUSVZFJTIwU0VBU09OJTIwT0YlMjBUSEUlMjBZRUFSJTIwV0lUSCUyMCoqQ0hSSVNUTUFVUyoqJTIwQU5EJTIwKipST1NFKiolMjBCRUVGJTIwTE9PTUlORyUyMEJFRk9SRSUyMFVTJTIwKipTSU1BTFlJUyoqJTIwRFJBV04lMjBGUk9NJTIwRUFUSU5HJTIwQU5EJTIwSVRTJTIwUkVTVUxUUyUyME9DQ1VSJTIwTU9TVCUyMFJFQURJTFklMjBUTyUyMFRIRSUyME1JTkQ=",highlighted:`<span class="hljs-symbol">Target:</span>      HE TELLS US THAT <span class="hljs-built_in">AT</span> THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAS <span class="hljs-keyword">AND </span>ROAST <span class="hljs-keyword">BEEF </span>LOOMING <span class="hljs-keyword">BEFORE </span>US SIMILES DRAWN FROM EATING <span class="hljs-keyword">AND </span>ITS RESULTS OCCUR MOST READILY TO THE MIND
<span class="hljs-symbol">Prediction:</span>  HE TELLS US THAT <span class="hljs-built_in">AT</span> THIS FESTIVE SEASON OF THE YEAR WITH **CHRISTMAUS** <span class="hljs-keyword">AND </span>**ROSE** <span class="hljs-keyword">BEEF </span>LOOMING <span class="hljs-keyword">BEFORE </span>US **SIMALYIS** DRAWN FROM EATING <span class="hljs-keyword">AND </span>ITS RESULTS OCCUR MOST READILY TO THE MIND`}}),Qe=new El({}),ot=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTNBMCUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEFwaXBlJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwJTIyYXV0b21hdGljLXNwZWVjaC1yZWNvZ25pdGlvbiUyMiUyQyUyMG1vZGVsJTNEJTIyb3BlbmFpJTJGd2hpc3Blci1iYXNlJTIyJTJDJTIwZGV2aWNlJTNEZGV2aWNlJTBBKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

device = <span class="hljs-string">&quot;cuda:0&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
pipe = pipeline(
    <span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;openai/whisper-base&quot;</span>, device=device
)`}}),rt=new T({props:{code:"cGlwZShzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMjU2KQ==",highlighted:'pipe(sample[<span class="hljs-string">&quot;audio&quot;</span>], max_new_tokens=<span class="hljs-number">256</span>)'}}),it=new T({props:{code:"JTdCJ3RleHQnJTNBJTIwJyUyMEhlJTIwdGVsbHMlMjB1cyUyMHRoYXQlMjBhdCUyMHRoaXMlMjBmZXN0aXZlJTIwc2Vhc29uJTIwb2YlMjB0aGUlMjB5ZWFyJTJDJTIwd2l0aCUyMENocmlzdG1hcyUyMGFuZCUyMHJvYXN0JTIwYmVlZiUyMGxvb21pbmclMjBiZWZvcmUlMjB1cyUyQyUyMHNpbWlsYXJseSUyMGlzJTIwZHJhd24lMjBmcm9tJTIwZWF0aW5nJTIwYW5kJTIwaXRzJTIwcmVzdWx0cyUyMG9jY3VyJTIwbW9zdCUyMHJlYWRpbHklMjB0byUyMHRoZSUyMG1pbmQuJyU3RA==",highlighted:'{&#x27;<span class="hljs-built_in">text</span>&#x27;: &#x27; He tells us <span class="hljs-keyword">that</span> <span class="hljs-keyword">at</span> this festive season <span class="hljs-keyword">of</span> <span class="hljs-keyword">the</span> <span class="hljs-built_in">year</span>, <span class="hljs-keyword">with</span> Christmas <span class="hljs-keyword">and</span> roast beef looming <span class="hljs-keyword">before</span> us, similarly <span class="hljs-keyword">is</span> drawn <span class="hljs-keyword">from</span> eating <span class="hljs-keyword">and</span> <span class="hljs-keyword">its</span> results occur most readily <span class="hljs-keyword">to</span> <span class="hljs-keyword">the</span> mind.&#x27;}'}}),pt=new T({props:{code:"VGFyZ2V0JTNBJTIwJTIwJTIwJTIwJTIwSEUlMjBURUxMUyUyMFVTJTIwVEhBVCUyMEFUJTIwVEhJUyUyMEZFU1RJVkUlMjBTRUFTT04lMjBPRiUyMFRIRSUyMFlFQVIlMjBXSVRIJTIwQ0hSSVNUTUFTJTIwQU5EJTIwUk9BU1QlMjBCRUVGJTIwTE9PTUlORyUyMEJFRk9SRSUyMFVTJTIwU0lNSUxFUyUyMERSQVdOJTIwRlJPTSUyMEVBVElORyUyMEFORCUyMElUUyUyMFJFU1VMVFMlMjBPQ0NVUiUyME1PU1QlMjBSRUFESUxZJTIwVE8lMjBUSEUlMjBNSU5EJTBBUHJlZGljdGlvbiUzQSUyMEhlJTIwdGVsbHMlMjB1cyUyMHRoYXQlMjBhdCUyMHRoaXMlMjBmZXN0aXZlJTIwc2Vhc29uJTIwb2YlMjB0aGUlMjB5ZWFyJTJDJTIwd2l0aCUyMCoqQ2hyaXN0bWFzKiolMjBhbmQlMjAqKnJvYXN0KiolMjBiZWVmJTIwbG9vbWluZyUyMGJlZm9yZSUyMHVzJTJDJTIwKipzaW1pbGFybHkqKiUyMGlzJTIwZHJhd24lMjBmcm9tJTIwZWF0aW5nJTIwYW5kJTIwaXRzJTIwcmVzdWx0cyUyMG9jY3VyJTIwbW9zdCUyMHJlYWRpbHklMjB0byUyMHRoZSUyMG1pbmQu",highlighted:`<span class="hljs-symbol">Target:</span>     HE TELLS US THAT <span class="hljs-built_in">AT</span> THIS FESTIVE SEASON OF THE YEAR WITH CHRISTMAS <span class="hljs-keyword">AND </span>ROAST <span class="hljs-keyword">BEEF </span>LOOMING <span class="hljs-keyword">BEFORE </span>US SIMILES DRAWN FROM EATING <span class="hljs-keyword">AND </span>ITS RESULTS OCCUR MOST READILY TO THE MIND
<span class="hljs-symbol">Prediction:</span> He tells us that <span class="hljs-built_in">at</span> this festive season of the year, with **Christmas** <span class="hljs-keyword">and </span>**roast** <span class="hljs-keyword">beef </span>looming <span class="hljs-keyword">before </span>us, **similarly** is drawn from eating <span class="hljs-keyword">and </span>its results occur most readily to the mind.`}}),ct=new T({props:{code:"ZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRm11bHRpbGluZ3VhbF9saWJyaXNwZWVjaCUyMiUyQyUyMCUyMnNwYW5pc2glMjIlMkMlMjBzcGxpdCUzRCUyMnZhbGlkYXRpb24lMjIlMkMlMjBzdHJlYW1pbmclM0RUcnVlJTBBKSUwQXNhbXBsZSUyMCUzRCUyMG5leHQoaXRlcihkYXRhc2V0KSk=",highlighted:`dataset = load_dataset(
    <span class="hljs-string">&quot;facebook/multilingual_librispeech&quot;</span>, <span class="hljs-string">&quot;spanish&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>, streaming=<span class="hljs-literal">True</span>
)
sample = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataset))`}}),dt=new T({props:{code:"cHJpbnQoc2FtcGxlJTVCJTIydGV4dCUyMiU1RCklMEFBdWRpbyhzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVEJTJDJTIwcmF0ZSUzRHNhbXBsZSU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIyc2FtcGxpbmdfcmF0ZSUyMiU1RCk=",highlighted:`<span class="hljs-built_in">print</span>(sample[<span class="hljs-string">&quot;text&quot;</span>])
Audio(sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], rate=sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;sampling_rate&quot;</span>])`}}),mt=new T({props:{code:"ZW50b25jZXMlMjB0ZSUyMGRlbGVsaXRhciVDMyVBMXMlMjBlbiUyMGplaG92JUMzJUExJTIweSUyMHlvJTIwdGUlMjBoYXIlQzMlQTklMjBzdWJpciUyMHNvYnJlJTIwbGFzJTIwYWx0dXJhcyUyMGRlJTIwbGElMjB0aWVycmElMjB5JTIwdGUlMjBkYXIlQzMlQTklMjAlQzMlQTElMjBjb21lciUyMGxhJTIwaGVyZWRhZCUyMGRlJTIwamFjb2IlMjB0dSUyMHBhZHJlJTIwcG9ycXVlJTIwbGElMjBib2NhJTIwZGUlMjBqZWhvdiVDMyVBMSUyMGxvJTIwaGElMjBoYWJsYWRv",highlighted:'entonces <span class="hljs-keyword">te</span> delelitar\xE1s <span class="hljs-keyword">en</span> jehov\xE1 y yo <span class="hljs-keyword">te</span> har\xE9 subir sobre las alturas <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> tierra y <span class="hljs-keyword">te</span> dar\xE9 \xE1 comer <span class="hljs-keyword">la</span> heredad <span class="hljs-keyword">de</span> jacob tu padre porque <span class="hljs-keyword">la</span> boca <span class="hljs-keyword">de</span> jehov\xE1 lo ha hablado'}}),ut=new T({props:{code:"cGlwZShzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RC5jb3B5KCklMkMlMjBtYXhfbmV3X3Rva2VucyUzRDI1NiUyQyUyMGdlbmVyYXRlX2t3YXJncyUzRCU3QiUyMnRhc2slMjIlM0ElMjAlMjJ0cmFuc2NyaWJlJTIyJTdEKQ==",highlighted:'pipe(sample[<span class="hljs-string">&quot;audio&quot;</span>].copy(), max_new_tokens=<span class="hljs-number">256</span>, generate_kwargs={<span class="hljs-string">&quot;task&quot;</span>: <span class="hljs-string">&quot;transcribe&quot;</span>})'}}),ft=new T({props:{code:"JTdCJ3RleHQnJTNBJTIwJyUyMEVudG9uY2VzJTIwdGUlMjBkZWxlaXRhciVDMyVBMXMlMjBlbiUyMEplaG92JUMzJUExJTIweSUyMHlvJTIwdGUlMjBoYXIlQzMlQTklMjBzdWJpciUyMHNvYnJlJTIwbGFzJTIwYWx0dXJhcyUyMGRlJTIwbGElMjB0aWVycmElMjB5JTIwdGUlMjBkYXIlQzMlQTklMjBhJTIwY29tZXIlMjBsYSUyMGhlcmVkYWQlMjBkZSUyMEphY29iJTIwdHUlMjBwYWRyZSUyMHBvcnF1ZSUyMGxhJTIwYm9jYSUyMGRlJTIwSmVob3YlQzMlQTElMjBsbyUyMGhhJTIwaGFibGFkby4nJTdE",highlighted:'{&#x27;text&#x27;: &#x27; Entonces <span class="hljs-keyword">te</span> deleitar\xE1s <span class="hljs-keyword">en</span> Jehov\xE1 y yo <span class="hljs-keyword">te</span> har\xE9 subir sobre las alturas <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> tierra y <span class="hljs-keyword">te</span> dar\xE9 a comer <span class="hljs-keyword">la</span> heredad <span class="hljs-keyword">de</span> Jacob tu padre porque <span class="hljs-keyword">la</span> boca <span class="hljs-keyword">de</span> Jehov\xE1 lo ha hablado.&#x27;}'}}),yt=new T({props:{code:"cGlwZShzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMjU2JTJDJTIwZ2VuZXJhdGVfa3dhcmdzJTNEJTdCJTIydGFzayUyMiUzQSUyMCUyMnRyYW5zbGF0ZSUyMiU3RCk=",highlighted:'pipe(sample[<span class="hljs-string">&quot;audio&quot;</span>], max_new_tokens=<span class="hljs-number">256</span>, generate_kwargs={<span class="hljs-string">&quot;task&quot;</span>: <span class="hljs-string">&quot;translate&quot;</span>})'}}),wt=new T({props:{code:"JTdCJ3RleHQnJTNBJTIwJyUyMFNvJTIweW91JTIwd2lsbCUyMGNob29zZSUyMGluJTIwSmVob3ZhaCUyMGFuZCUyMEklMjB3aWxsJTIwcmFpc2UlMjB5b3UlMjBvbiUyMHRoZSUyMGhlaWdodHMlMjBvZiUyMHRoZSUyMGVhcnRoJTIwYW5kJTIwSSUyMHdpbGwlMjBnaXZlJTIweW91JTIwdGhlJTIwaG9ub3IlMjBvZiUyMEphY29iJTIwdG8lMjB5b3VyJTIwZmF0aGVyJTIwYmVjYXVzZSUyMHRoZSUyMHZvaWNlJTIwb2YlMjBKZWhvdmFoJTIwaGFzJTIwc3Bva2VuJTIwdG8lMjB5b3UuJyU3RA==",highlighted:'<span class="hljs-comment">{&#x27;text&#x27;:</span> <span class="hljs-comment">&#x27;</span> <span class="hljs-comment">So you will choose in Jehovah and I will raise you on the</span> <span class="hljs-comment">heights</span> <span class="hljs-comment">of the earth and I will give you the</span> <span class="hljs-comment">honor</span> <span class="hljs-comment">of Jacob to your father because the voice of Jehovah has spoken to</span> <span class="hljs-comment">you</span><span class="hljs-string">.</span><span class="hljs-comment">&#x27;}</span>'}}),Tt=new El({}),gt=new T({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBdGFyZ2V0X2xlbmd0aF9pbl9tJTIwJTNEJTIwNSUwQSUwQSUyMyUyMGNvbnZlcnQlMjBmcm9tJTIwbWludXRlcyUyMHRvJTIwc2Vjb25kcyUyMCgqJTIwNjApJTIwdG8lMjBudW0lMjBzYW1wbGVzJTIwKColMjBzYW1wbGluZyUyMHJhdGUpJTBBc2FtcGxpbmdfcmF0ZSUyMCUzRCUyMHBpcGUuZmVhdHVyZV9leHRyYWN0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= <span class="hljs-number">5</span>

<span class="hljs-comment"># convert from minutes to seconds (* 60) to num samples (* sampling rate)</span>
sampling_rate = pipe.feature_extractor.sampling_rate
target_length_in_samples = target_length_in_m * <span class="hljs-number">60</span> * sampling_rate

<span class="hljs-comment"># iterate over our streaming dataset, concatenating samples until we hit our target</span>
long_audio = []
<span class="hljs-keyword">for</span> sample <span class="hljs-keyword">in</span> dataset:
    long_audio.extend(sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>])
    <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(long_audio) &gt; target_length_in_samples:
        <span class="hljs-keyword">break</span>

long_audio = np.asarray(long_audio)

<span class="hljs-comment"># how did we do?</span>
seconds = <span class="hljs-built_in">len</span>(long_audio) / <span class="hljs-number">16000</span>
minutes, seconds = <span class="hljs-built_in">divmod</span>(seconds, <span class="hljs-number">60</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Length of audio sample is <span class="hljs-subst">{minutes}</span> minutes <span class="hljs-subst">{seconds:<span class="hljs-number">.2</span>f}</span> seconds&quot;</span>)`}}),bt=new T({props:{code:"TGVuZ3RoJTIwb2YlMjBhdWRpbyUyMHNhbXBsZSUyMGlzJTIwNS4wJTIwbWludXRlcyUyMDE3LjIyJTIwc2Vjb25kcw==",highlighted:'<span class="hljs-attribute">Length</span> of audio sample is <span class="hljs-number">5</span>.<span class="hljs-number">0</span> minutes <span class="hljs-number">17</span>.<span class="hljs-number">22</span> seconds'}}),vt=new T({props:{code:"cGlwZSglMEElMjAlMjAlMjAlMjBsb25nX2F1ZGlvJTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QyNTYlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0ZV9rd2FyZ3MlM0QlN0IlMjJ0YXNrJTIyJTNBJTIwJTIydHJhbnNjcmliZSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMGNodW5rX2xlbmd0aF9zJTNEMzAlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEOCUyQyUwQSk=",highlighted:`pipe(
    long_audio,
    max_new_tokens=<span class="hljs-number">256</span>,
    generate_kwargs={<span class="hljs-string">&quot;task&quot;</span>: <span class="hljs-string">&quot;transcribe&quot;</span>},
    chunk_length_s=<span class="hljs-number">30</span>,
    batch_size=<span class="hljs-number">8</span>,
)`}}),Jt=new T({props:{code:"JTdCJ3RleHQnJTNBJTIwJyUyMEVudG9uY2VzJTIwdGUlMjBkZWxlaXRhciVDMyVBMXMlMjBlbiUyMEplaG92JUMzJUExJTJDJTIweSUyMHlvJTIwdGUlMjBoYXIlQzMlQTklMjBzdWJpciUyMHNvYnJlJTIwbGFzJTIwYWx0dXJhcyUyMGRlJTIwbGElMjB0aWVycmElMkMlMjB5JTIwdGUlMjBkYXIlQzMlQTklMjBhJTIwY29tZXIlMjBsYSUwQWhlcmVkYWQlMjBkZSUyMEphY29iJTIwdHUlMjBwYWRyZSUyQyUyMHBvcnF1ZSUyMGxhJTIwYm9jYSUyMGRlJTIwSmVob3YlQzMlQTElMjBsbyUyMGhhJTIwaGFibGFkby4lMjBub3NvdHJvcyUyMGN1cmFkb3MuJTIwVG9kb3MlMjBub3NvdHJvcyUyMG5vcyUyMGRlc2NhcnJpYW1vcyUwQWNvbW8lMjBiZWphcyUyQyUyMGNhZGElMjBjdWFsJTIwc2UlMjBhcGFydCVDMyVCMyUyMHBvciUyMHN1JTIwY2FtaW5vJTJDJTIwbWFzJTIwSmVob3YlQzMlQTElMjBjYXJnJUMzJUIzJTIwZW4lMjAlQzMlQTlsJTIwZWwlMjBwZWNhZG8lMjBkZSUyMHRvZG9zJTIwbm9zb3Ryb3MuLi4=",highlighted:`{&#x27;text&#x27;: &#x27; Entonces <span class="hljs-keyword">te</span> deleitar\xE1s <span class="hljs-keyword">en</span> Jehov\xE1, y yo <span class="hljs-keyword">te</span> har\xE9 subir sobre las alturas <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> tierra, y <span class="hljs-keyword">te</span> dar\xE9 a comer <span class="hljs-keyword">la</span>
heredad <span class="hljs-keyword">de</span> Jacob tu padre, porque <span class="hljs-keyword">la</span> boca <span class="hljs-keyword">de</span> Jehov\xE1 lo ha hablado. nosotros curados. Todos nosotros nos descarriamos
como bejas, cada cual <span class="hljs-keyword">se</span> apart\xF3 por <span class="hljs-keyword">su</span> camino, mas Jehov\xE1 carg\xF3 <span class="hljs-keyword">en</span> \xE9<span class="hljs-keyword">l</span> el pecado <span class="hljs-keyword">de</span> todos nosotros...`}}),jt=new T({props:{code:"cGlwZSglMEElMjAlMjAlMjAlMjBsb25nX2F1ZGlvJTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0QyNTYlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0ZV9rd2FyZ3MlM0QlN0IlMjJ0YXNrJTIyJTNBJTIwJTIydHJhbnNjcmliZSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMGNodW5rX2xlbmd0aF9zJTNEMzAlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEOCUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl90aW1lc3RhbXBzJTNEVHJ1ZSUyQyUwQSklNUIlMjJjaHVua3MlMjIlNUQ=",highlighted:`pipe(
    long_audio,
    max_new_tokens=<span class="hljs-number">256</span>,
    generate_kwargs={<span class="hljs-string">&quot;task&quot;</span>: <span class="hljs-string">&quot;transcribe&quot;</span>},
    chunk_length_s=<span class="hljs-number">30</span>,
    batch_size=<span class="hljs-number">8</span>,
    return_timestamps=<span class="hljs-literal">True</span>,
)[<span class="hljs-string">&quot;chunks&quot;</span>]`}}),kt=new T({props:{code:"JTVCJTdCJ3RpbWVzdGFtcCclM0ElMjAoMC4wJTJDJTIwMjYuNCklMkMlMEElMjAlMjAndGV4dCclM0ElMjAnJTIwRW50b25jZXMlMjB0ZSUyMGRlbGVpdGFyJUMzJUExcyUyMGVuJTIwSmVob3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UwQSUyMC4uLg==",highlighted:`[{<span class="hljs-symbol">&#x27;timestamp</span><span class="hljs-symbol">&#x27;:</span> (<span class="hljs-name">0.0</span>, <span class="hljs-number">26.4</span>),
  <span class="hljs-symbol">&#x27;text</span><span class="hljs-symbol">&#x27;:</span> &#x27; Entonces te deleitar\xE1s en Jehov\xE1, y yo te har\xE9 subir sobre las alturas de la tierra, y te dar\xE9 a comer la heredad de Jacob tu padre, porque la boca de Jehov\xE1 lo ha hablado. nosotros curados. Todos nosotros nos descarriamos como bejas, cada cual se apart\xF3 por su camino,&#x27;},
 {<span class="hljs-symbol">&#x27;timestamp</span><span class="hljs-symbol">&#x27;:</span> (<span class="hljs-name">26.4</span>, <span class="hljs-number">32.48</span>),
  <span class="hljs-symbol">&#x27;text</span><span class="hljs-symbol">&#x27;:</span> &#x27; mas Jehov\xE1 carg\xF3 en \xE9l el pecado de todos nosotros. No es que partas tu pan con el&#x27;},
 {<span class="hljs-symbol">&#x27;timestamp</span><span class="hljs-symbol">&#x27;:</span> (<span class="hljs-name">32.48</span>, <span class="hljs-number">38.4</span>),
  <span class="hljs-symbol">&#x27;text</span><span class="hljs-symbol">&#x27;:</span> &#x27; hambriento y a los hombres herrantes metas en casa, que cuando vieres al desnudo lo cubras y no&#x27;},
 ...`}}),It=new El({}),{c(){ee=n("meta"),vl=h(),te=n("h1"),oe=n("a"),ws=n("span"),m(Be.$$.fragment),Oo=h(),Ms=n("span"),zo=a("Pre-trained models for automatic speech recognition"),Jl=h(),G=n("p"),Po=a("In this section, we\u2019ll cover how to use the "),Ts=n("code"),Do=a("pipeline()"),Lo=a(" to leverage pre-trained models for speech recognition. In "),_t=n("a"),Ko=a("Unit 2"),er=a(`,
we introduced the `),gs=n("code"),tr=a("pipeline()"),sr=a(` as an easy way of running speech recognition tasks, with all pre- and post-processing handled under-the-hood
and the flexibility to quickly experiment with any pre-trained checkpoint on the Hugging Face Hub. In this Unit, we\u2019ll go a
level deeper and explore the different attributes of speech recognition models and how we can use them to tackle a range
of different tasks.`),jl=h(),Bt=n("p"),ar=a("As detailed in Unit 3, speech recognition model broadly fall into one of two categories:"),kl=h(),re=n("ol"),Re=n("li"),lr=a("Connectionist Temporal Classification (CTC): "),bs=n("em"),nr=a("encoder-only"),or=a(" models with a linear classification (CTC) head on top"),rr=h(),Ge=n("li"),ir=a("Sequence-to-sequence (Seq2Seq): "),Us=n("em"),pr=a("encoder-decoder"),hr=a(" models, with a cross-attention mechanism between the encoder and decoder"),Il=h(),ie=n("p"),cr=a(`Prior to 2022, CTC was the more popular of the two architectures, with encoder-only models such as Wav2Vec2, HuBERT and XLSR achieving
breakthoughs in the pre-training / fine-tuning paradigm for speech. Big corporations, such as Meta and Microsoft, pre-trained
the encoder on vast amounts of unlabelled audio data for many days or weeks. Users could then take a pre-trained checkpoint, and
fine-tune it with a CTC head on as little as `),Es=n("strong"),dr=a("10 minutes"),mr=a(` of labelled speech data to achieve strong performance on a downstream
speech recognition task.`),Sl=h(),Rt=n("p"),ur=a(`However, CTC models have their shortcomings. Appending a simple linear layer to an encoder gives a small, fast overall model, but can
be prone to phonetic spelling errors. We\u2019ll demonstrate this for the Wav2Vec2 model below.`),_l=h(),se=n("h2"),pe=n("a"),vs=n("span"),m(We.$$.fragment),fr=h(),Js=n("span"),yr=a("Probing CTC Models"),Bl=h(),he=n("p"),wr=a("Let\u2019s load a small excerpt of the "),Gt=n("a"),Mr=a("LibriSpeech ASR"),Tr=a(` dataset to demonstrate
Wav2Vec2\u2019s speech transcription capabilities:`),Rl=h(),m(Ve.$$.fragment),Gl=h(),Wt=n("p"),js=n("strong"),gr=a("Output:"),Wl=h(),m(Ce.$$.fragment),Vl=h(),Vt=n("p"),br=a("We can pick one of the 73 audio samples and inspect the audio sample as well as the transcription:"),Cl=h(),m($e.$$.fragment),$l=h(),Ct=n("p"),ks=n("strong"),Ur=a("Output:"),xl=h(),m(xe.$$.fragment),Fl=h(),N=n("p"),Er=a(`Alright! Christmas and roast beef, sounds great! \u{1F384} Having chosen a data sample, we now load a fine-tuned checkpoint into
the `),Is=n("code"),vr=a("pipeline()"),Jr=a(". For this, we\u2019ll use the official "),$t=n("a"),jr=a("Wav2Vec2 base"),kr=a(` checkpoint fine-tuned on
100 hours of LibriSpeech data:`),Al=h(),m(Fe.$$.fragment),Nl=h(),Z=n("p"),Ir=a("Next, we\u2019ll take an example from the dataset and pass its raw data to the pipeline. Since the "),Ss=n("code"),Sr=a("pipeline"),_r=h(),_s=n("em"),Br=a("consumes"),Rr=a(` any
dictionary that we pass it (meaning it cannot be re-used), we\u2019ll pass a copy of the data. This way, we can safely re-use
the same audio sample in the following examples:`),Zl=h(),m(Ae.$$.fragment),Yl=h(),xt=n("p"),Bs=n("strong"),Gr=a("Output:"),Hl=h(),m(Ne.$$.fragment),ql=h(),Ft=n("p"),Wr=a(`We can see that the Wav2Vec2 model does a pretty good job at transcribing this sample - at a first glance it looks generally correct.
Let\u2019s put the target and prediction side-by-side and highlight the differences:`),Ql=h(),m(Ze.$$.fragment),Xl=h(),ce=n("p"),Vr=a("Comparing the target text to the predicted transcription, we can see that all words "),Rs=n("em"),Cr=a("sound"),$r=a(" correct, but some are not spelled accurately. For example:"),Ol=h(),Y=n("ul"),Ye=n("li"),Gs=n("em"),xr=a("CHRISTMAUS"),Fr=a(" vs. "),Ws=n("em"),Ar=a("CHRISTMAS"),Nr=h(),He=n("li"),Vs=n("em"),Zr=a("ROSE"),Yr=a(" vs. "),Cs=n("em"),Hr=a("ROAST"),qr=h(),qe=n("li"),$s=n("em"),Qr=a("SIMALYIS"),Xr=a(" vs. "),xs=n("em"),Or=a("SIMILES"),zl=h(),At=n("p"),zr=a(`This highlights the shortcoming of a CTC model. A CTC model is essentially an \u2018acoustic-only\u2019 model: it consists of an encoder
which forms hidden-state representations from the audio inputs, and a linear layer which maps the hidden-states to characters:`),Pl=h(),W=n("p"),Pr=a(`This means that the system almost entirely bases its prediction on the acoustic input it was given (the phonetic sounds of the audio),
and so has a tendency to transcribe the audio in a phonetic way (e.g. `),Fs=n("em"),Dr=a("CHRISTMAUS"),Lr=a(`). It gives less importance to the
language modelling context of previous and successive letters, and so is prone to phonetic spelling errors. A more intelligent model
would identify that `),As=n("em"),Kr=a("CHRISTMAUS"),ei=a(" is not a valid word in the English vocabulary, and correct it to "),Ns=n("em"),ti=a("CHRISTMAS"),si=a(` when making
its predictions. We\u2019re also missing two big features in our prediction - casing and punctuation - which limits the usefulness of
the model\u2019s transcriptions to real-world applications.`),Dl=h(),ae=n("h2"),de=n("a"),Zs=n("span"),m(Qe.$$.fragment),ai=h(),Ys=n("span"),li=a("Graduation to Seq2Seq"),Ll=h(),me=n("p"),ni=a(`Cue Seq2Seq models! As outlined in Unit 3, Seq2Seq models are formed of an encoder and decoder linked via a cross-attention
mechanism. The encoder plays the same role as before, computing hidden-state representations of the audio inputs, while the decoder
plays the role of a `),Hs=n("strong"),oi=a("language model"),ri=a(`. The decoder processes the entire sequence of hidden-state representations
from the encoder and generates the corresponding text transcriptions. With global context of the audio input, the decoder
is able to use language modelling context as it makes its predictions, correcting for spelling mistakes on-the-fly and thus
circumventing the issue of phonetic predictions.`),Kl=h(),Nt=n("p"),ii=a("There are two downsides to Seq2Seq models:"),en=h(),ue=n("ol"),qs=n("li"),pi=a("They are inherently slower at decoding, since the decoding process happens one step at a time, rather than all at once"),hi=h(),Qs=n("li"),ci=a("They are more data hungry, requiring significantly more training data to reach convergence"),tn=h(),_=n("p"),di=a(`In particular, the need for large amounts of training data has been a bottleneck in the advancement of Seq2Seq architectures for
speech. Labelled speech data is difficult to come by, with the largest annotated datasets at the time clocking in at just
10,000 hours. This all changed in 2022 upon the release of `),Xs=n("strong"),mi=a("Whisper"),ui=a(`. Whisper is a pre-trained model for speech recognition
published in `),Xe=n("a"),fi=a("September 2022"),yi=a(` by the authors Alec Radford et al. from OpenAI. Unlike
its CTC predecessors, which were pre-trained entirely on `),Os=n("strong"),wi=a("un-labelled"),Mi=a(` audio data, Whisper is pre-trained on a vast quantity of
`),zs=n("strong"),Ti=a("labelled"),gi=a(" audio-transcription data, 680,000 hours to be precise."),sn=h(),fe=n("p"),bi=a(`This is an order of magnitude more data than the un-labelled audio data used to train Wav2Vec 2.0 (60,000 hours). What is
more, 117,000 hours of this pre-training data is multilingual (or \u201Cnon-English\u201D) data. This results in checkpoints that can be applied to
over 96 languages, many of which are considered `),Ps=n("em"),Ui=a("low-resource"),Ei=a(", meaning the language lacks a large corpus of data suitable for training."),an=h(),H=n("p"),vi=a(`When scaled to 680,000 hours of labelled pre-training data, Whisper models demonstrate a strong ability to generalise to
many datasets and domains. The pre-trained checkpoints achieve competitive results to state-of-the-art pipe systems, with
near 3% word error rate (WER) on the test-clean subset of LibriSpeech pipe and a new state-of-the-art on TED-LIUM with
4.7% WER (`),Ds=n("em"),Ji=a("c.f."),ji=a(" Table 8 of the "),Oe=n("a"),ki=a("Whisper paper"),Ii=a(")."),ln=h(),Zt=n("p"),Si=a(`Of particular importance is Whisper\u2019s ability to handle long-form audio samples, its robustness to input noise and ability
to predict cased and punctuated transcriptions. This makes it a viable candidate for real-world speech recognition systems.`),nn=h(),ye=n("p"),_i=a(`The remainder of this section will show you how to use the pre-trained Whisper models for speech recognition using \u{1F917}
Transformers. In many situations, the pre-trained Whisper checkpoints are extremely performant and give great results,
thus we encourage you to try using the pre-trained checkpoints as a first step to solving any speech recognition problem.
Through fine-tuning, the pre-trained checkpoints can be adapted for specific datasets and languages to further improve
upon these results. We\u2019ll demonstrate how to do this in the upcoming subsection on `),Yt=n("a"),Bi=a("fine-tuning"),Ri=a("."),on=h(),we=n("p"),Gi=a(`The Whisper checkpoints come in five configurations of varying model sizes. The smallest four are trained on either
English-only or multilingual data. The largest checkpoint is multilingual only. All nine of the pre-trained checkpoints
are available on the `),ze=n("a"),Wi=a("Hugging Face Hub"),Vi=a(`. The checkpoints are
summarised in the following table with links to the models on the Hub. \u201CVRAM\u201D denotes the required GPU memory to run the
model with the minimum batch size of 1. \u201CRel Speed\u201D is the relative speed of a checkpoint compared to the largest model.
Based on this information, you can select a checkpoint that is best suited to your hardware.`),rn=h(),Me=n("table"),Ls=n("thead"),v=n("tr"),Ks=n("th"),Ci=a("Size"),$i=h(),ea=n("th"),xi=a("Parameters"),Fi=h(),ta=n("th"),Ai=a("VRAM / GB"),Ni=h(),sa=n("th"),Zi=a("Rel Speed"),Yi=h(),aa=n("th"),Hi=a("English-only"),qi=h(),la=n("th"),Qi=a("Multilingual"),Xi=h(),R=n("tbody"),J=n("tr"),na=n("td"),Oi=a("tiny"),zi=h(),oa=n("td"),Pi=a("39 M"),Di=h(),ra=n("td"),Li=a("1.4"),Ki=h(),ia=n("td"),ep=a("32"),tp=h(),pa=n("td"),Pe=n("a"),sp=a("\u2713"),ap=h(),ha=n("td"),De=n("a"),lp=a("\u2713"),np=h(),j=n("tr"),ca=n("td"),op=a("base"),rp=h(),da=n("td"),ip=a("74 M"),pp=h(),ma=n("td"),hp=a("1.5"),cp=h(),ua=n("td"),dp=a("16"),mp=h(),fa=n("td"),Le=n("a"),up=a("\u2713"),fp=h(),ya=n("td"),Ke=n("a"),yp=a("\u2713"),wp=h(),k=n("tr"),wa=n("td"),Mp=a("small"),Tp=h(),Ma=n("td"),gp=a("244 M"),bp=h(),Ta=n("td"),Up=a("2.3"),Ep=h(),ga=n("td"),vp=a("6"),Jp=h(),ba=n("td"),et=n("a"),jp=a("\u2713"),kp=h(),Ua=n("td"),tt=n("a"),Ip=a("\u2713"),Sp=h(),I=n("tr"),Ea=n("td"),_p=a("medium"),Bp=h(),va=n("td"),Rp=a("769 M"),Gp=h(),Ja=n("td"),Wp=a("4.2"),Vp=h(),ja=n("td"),Cp=a("2"),$p=h(),ka=n("td"),st=n("a"),xp=a("\u2713"),Fp=h(),Ia=n("td"),at=n("a"),Ap=a("\u2713"),Np=h(),S=n("tr"),Sa=n("td"),Zp=a("large"),Yp=h(),_a=n("td"),Hp=a("1550 M"),qp=h(),Ba=n("td"),Qp=a("7.5"),Xp=h(),Ra=n("td"),Op=a("1"),zp=h(),Ga=n("td"),Pp=a("x"),Dp=h(),Wa=n("td"),lt=n("a"),Lp=a("\u2713"),pn=h(),q=n("p"),Kp=a("Let\u2019s load the "),nt=n("a"),eh=a("Whisper Base"),th=a(` checkpoint, which is of comparable size to the
Wav2Vec2 checkpoint we used previously. Preempting our move to multilingual speech recognition, we\u2019ll load the multilingual
variant of the base checkpoint. We\u2019ll also load the model on the GPU if available, or CPU otherwise. The `),Va=n("code"),sh=a("pipeline()"),ah=a(` will
subsequently take care of moving all inputs / outputs from the CPU to the GPU as required:`),hn=h(),m(ot.$$.fragment),cn=h(),Te=n("p"),lh=a("Great! Now let\u2019s transcribe the audio as before. The only change we make is passing an extra argument, "),Ca=n("code"),nh=a("max_new_tokens"),oh=a(`,
which tells the model the maximum number of tokens to generate when making its prediction:`),dn=h(),m(rt.$$.fragment),mn=h(),Ht=n("p"),$a=n("strong"),rh=a("Output:"),un=h(),m(it.$$.fragment),fn=h(),qt=n("p"),ih=a(`Easy enough! The first thing you\u2019ll notice is the presence of both casing and punctuation. Immediately this makes the
transcription easier to read compared to the un-cased and un-punctuated transcription from Wav2Vec2. Let\u2019s put the transcription
side-by-side with the target:`),yn=h(),m(pt.$$.fragment),wn=h(),B=n("p"),ph=a("Whisper has done a great job at correcting the phonetic errors we saw from Wav2Vec2 - both "),xa=n("em"),hh=a("Christmas"),ch=a(" and "),Fa=n("em"),dh=a("roast"),mh=a(` are
spelled correctly. We see that the model still struggles with `),Aa=n("em"),uh=a("SIMILES"),fh=a(", being incorrectly transcribed as "),Na=n("em"),yh=a("similarly"),wh=a(`, but
this time the prediction is a valid word from the English vocabulary. Using a larger Whisper checkpoint can help further
reduce transcription errors, at the expense of requiring more compute and a longer transcription time.`),Mn=h(),Q=n("p"),Mh=a(`We\u2019ve been promised a model that can handle 96 languages, so lets leave English speech recognition for now and go global \u{1F30E}!
The `),ht=n("a"),Th=a("Multilingual LibriSpeech"),gh=a(` (MLS) dataset is
the multilingual equivalent of the LibriSpeech dataset, with labelled audio data in six languages. We\u2019ll load one sample
from the Spanish split of the MLS dataset, making use of `),Za=n("em"),bh=a("streaming"),Uh=a(" mode so that we don\u2019t have to download the entire dataset:"),Tn=h(),m(ct.$$.fragment),gn=h(),Qt=n("p"),Eh=a("Again, we\u2019ll inspect the text transcription and take a listen to the audio segment:"),bn=h(),m(dt.$$.fragment),Un=h(),Xt=n("p"),Ya=n("strong"),vh=a("Output:"),En=h(),m(mt.$$.fragment),vn=h(),X=n("p"),Jh=a(`This is the target text that we\u2019re aiming for with our Whisper transcription. Although we now know that we can
probably do better this, since our model is also going to predict punctuation and casing, neither of which are present in the
reference. Let\u2019s forward the audio sample to the pipeline to get our text prediction. One thing to note is that the
pipeline `),Ha=n("em"),jh=a("consumes"),kh=a(` the dictionary of audio inputs that we input, meaning the dictionary can\u2019t be re-used. To circumvent
this, we\u2019ll pass a `),qa=n("em"),Ih=a("copy"),Sh=a(" of the audio sample, so that we can re-use the same audio sample in the proceeding code examples:"),Jn=h(),m(ut.$$.fragment),jn=h(),Ot=n("p"),Qa=n("strong"),_h=a("Output:"),kn=h(),m(ft.$$.fragment),In=h(),g=n("p"),Bh=a(`Great - this looks very similar to our reference text (arguably better since it has punctuation and casing!). You\u2019ll notice
that we forwarded the `),Xa=n("code"),Rh=a('"task"'),Gh=a(" as a "),Oa=n("em"),Wh=a("generate key-word argument"),Vh=a(" (generate kwarg). Setting the "),za=n("code"),Ch=a('"task"'),$h=a(" to "),Pa=n("code"),xh=a('"transcribe"'),Fh=a(`
forces Whisper to perform the task of `),Da=n("em"),Ah=a("speech recognition"),Nh=a(`, where the audio is transcribed in the same language that the
speech was spoken in. Whisper is also capable of performing the closely related task of `),La=n("em"),Zh=a("speech translation"),Yh=a(`, where the
audio in Spanish can be translated to text in English. To achieve this, we set the `),Ka=n("code"),Hh=a('"task"'),qh=a(" to "),el=n("code"),Qh=a('"translate"'),Xh=a(":"),Sn=h(),m(yt.$$.fragment),_n=h(),zt=n("p"),tl=n("strong"),Oh=a("Output:"),Bn=h(),m(wt.$$.fragment),Rn=h(),Pt=n("p"),zh=a(`Now that we know we can toggle between speech recognition and speech translation, we can pick our task depending on our
needs. Either we recognise from audio in language X to text in the same language X (e.g. Spanish audio to Spanish text),
or we translate from audio in any language X to text in English (e.g. Spanish audio to English text).`),Gn=h(),O=n("p"),Ph=a("To read more about how the "),sl=n("code"),Dh=a('"task"'),Lh=a(` argument is used to control the properties of the generated text, refer to the
`),Mt=n("a"),Kh=a("model card"),ec=a(" for the Whisper base model."),Wn=h(),le=n("h2"),ge=n("a"),al=n("span"),m(Tt.$$.fragment),tc=h(),ll=n("span"),sc=a("Long-Form Transcription and Timestamps"),Vn=h(),Dt=n("p"),ac=a(`So far, we\u2019ve focussed on transcribing short audio samples of less than 30 seconds. We mentioned that one of the appeals
of Whisper was its ability to work on long audio samples. We\u2019ll tackle this task here!`),Cn=h(),Lt=n("p"),lc=a(`Let\u2019s create a long audio file by concatenating sequential samples from the MLS dataset. Since the MLS dataset is
curated by splitting long audiobook recordings into shorter segments, concatenating samples is one way of reconstructing
longer audiobook passages. Consequently, the resulting audio should be coherent across the entire sample.`),$n=h(),Kt=n("p"),nc=a("We\u2019ll set our target audio length to 5 minutes, and stop concatenating samples once we hit this value:"),xn=h(),m(gt.$$.fragment),Fn=h(),es=n("p"),nl=n("strong"),oc=a("Output:"),An=h(),m(bt.$$.fragment),Nn=h(),ts=n("p"),rc=a(`Alright! 5 minutes and 17 seconds of audio to transcribe. There are two problems with forwarding this long audio sample
directly to the model:`),Zn=h(),be=n("ol"),ol=n("li"),ic=a("Whisper is inherently designed to work with 30 second samples: anything shorter than 30s is padded to 30s with silence, anything longer than 30s is truncated to 30s by cutting of the extra audio, so if we pass our audio directly we\u2019ll only get the transcription for the first 30s"),pc=h(),rl=n("li"),hc=a("Memory in a transformer network scales with the sequence length squared: doubling the input length quadruples the memory requirement, so passing super long audio files is bound to lead to an out-of-memory (OOM) error"),Yn=h(),Ue=n("p"),cc=a("The way long-form transcription works in \u{1F917} Transformers is by "),il=n("em"),dc=a("chunking"),mc=a(` the input audio into smaller, more manageable segments.
Each segment has a small amount of overlap with the previous one. This allows us to accurately stitch the segments back together
at the boundaries, since we can find the overlap between segments and merge the transcriptions accordingly:`),Hn=h(),Ut=n("div"),ss=n("img"),qn=h(),b=n("p"),uc=a("The advantage of chunking the samples is that we don\u2019t need the result of chunk "),Qn=new Qo,Xn=a(` to transcribe the subsequent
chunk `),On=new Qo,zn=a(`. The stitching is done after we have transcribed all the chunks at the chunk boundaries, so it doesn\u2019t
matter which order we transcribe chunks in. The algorithm is entirely `),pl=n("strong"),fc=a("stateless"),yc=a(", so we can even do chunk "),Pn=new Qo,Dn=a(`
at the same time as chunk `),Ln=new Qo,Kn=a("! This allows us to "),hl=n("em"),wc=a("batch"),Mc=a(` the chunks and run them through the model in parallel,
providing a large computational speed-up compared to transcribing them sequentially. To read more about chunking in \u{1F917} Transformers,
you can refer to this `),Et=n("a"),Tc=a("blog post"),gc=a("."),eo=h(),Ee=n("p"),bc=a(`To activate long-form transcriptions, we have to add one additional argument when we call the pipeline. This argument,
`),cl=n("code"),Uc=a("chunk_length_s"),Ec=a(`, controls the length of the chunked segments in seconds. For Whisper, 30 second chunks are optimal,
since this matches the input length Whisper expects.`),to=h(),ve=n("p"),vc=a("To activate batching, we need to pass the argument "),dl=n("code"),Jc=a("batch_size"),jc=a(` to the pipeline. Putting it all together, we can transcribe the
long audio sample with chunking and batching as follows:`),so=h(),m(vt.$$.fragment),ao=h(),as=n("p"),ml=n("strong"),kc=a("Output:"),lo=h(),m(Jt.$$.fragment),no=h(),ls=n("p"),Ic=a(`We won\u2019t print the entire output here since it\u2019s pretty long (312 words total)! On a 16GB V100 GPU, you can expect the above
line to take approximately 3.45 seconds to run, which is pretty good for a 317 second audio sample. On a CPU, expect
closer to 30 seconds.`),oo=h(),Je=n("p"),Sc=a("Whisper is also able to predict segment-level "),ul=n("em"),_c=a("timestamps"),Bc=a(` for the audio data. These timestamps indicate the start and end
time for a short passage of audio, and are particularly useful for aligning a transcription with the input audio. Suppose
we want to provide closed captions for a video - we need these timestamps to know which part of the transcription corresponds
to a certain segment of video, in order to display the correct transcription for that time.`),ro=h(),je=n("p"),Rc=a("Activating timestamp prediction is straightforward, we just need to set the argument "),fl=n("code"),Gc=a("return_timestamps=True"),Wc=a(`. Timestamps
are compatible with both the chunking and batching methods we used previously, so we can simply append the timestamp
argument to our previous call:`),io=h(),m(jt.$$.fragment),po=h(),ns=n("p"),yl=n("strong"),Vc=a("Output:"),ho=h(),m(kt.$$.fragment),co=h(),os=n("p"),Cc=a("And voila! We have our predicted text as well as corresponding timestamps."),mo=h(),ne=n("h2"),ke=n("a"),wl=n("span"),m(It.$$.fragment),$c=h(),Ml=n("span"),xc=a("Summary"),uo=h(),z=n("p"),Fc=a(`Whisper is a strong pre-trained model for speech recognition and translation. Compared to Wav2Vec2, it has higher
transcription accuracy, with outputs that contain punctuation and casing. It can be used to transcribe speech in English
as well as 96 other languages, both on short audio segments and longer ones through `),Tl=n("em"),Ac=a("chunking"),Nc=a(`. These attributes make it
a viable model for many speech recognition and translation tasks without the need for fine-tuning. The `),gl=n("code"),Zc=a("pipeline()"),Yc=a(` method
provides an easy way of running inference in one-line API calls with control over the generated predictions.`),fo=h(),P=n("p"),Hc=a(`While the Whisper model performs extremely well on many high-resource languages, it has lower transcription and translation
accuracy on low-resource languages, i.e. those with less readily available training data. There is also varying performance
across different accents and dialects of certain languages, including lower accuracy for speakers of different genders,
races, ages or other demographic criteria (`),bl=n("em"),qc=a("c.f."),Qc=h(),St=n("a"),Xc=a("Whisper paper"),Oc=a(")."),yo=h(),Ie=n("p"),zc=a(`To boost the performance on low-resource languages, accents or dialects, we can take the pre-trained Whisper model and
train it on a small corpus of appropriately selected data, in a process called `),Ul=n("em"),Pc=a("fine-tuning"),Dc=a(`. We\u2019ll show that with
as little of ten hours of additional data, we can improve the performance of the Whisper model by over 100% on a low-resource
language. In the next section, we\u2019ll cover the process behind selecting a dataset for fine-tuning.`),this.h()},l(e){const i=mf('[data-svelte="svelte-1phssyn"]',document.head);ee=o(i,"META",{name:!0,content:!0}),i.forEach(s),vl=c(e),te=o(e,"H1",{class:!0});var Mo=r(te);oe=o(Mo,"A",{id:!0,class:!0,href:!0});var ed=r(oe);ws=o(ed,"SPAN",{});var td=r(ws);u(Be.$$.fragment,td),td.forEach(s),ed.forEach(s),Oo=c(Mo),Ms=o(Mo,"SPAN",{});var sd=r(Ms);zo=l(sd,"Pre-trained models for automatic speech recognition"),sd.forEach(s),Mo.forEach(s),Jl=c(e),G=o(e,"P",{});var Se=r(G);Po=l(Se,"In this section, we\u2019ll cover how to use the "),Ts=o(Se,"CODE",{});var ad=r(Ts);Do=l(ad,"pipeline()"),ad.forEach(s),Lo=l(Se," to leverage pre-trained models for speech recognition. In "),_t=o(Se,"A",{href:!0});var ld=r(_t);Ko=l(ld,"Unit 2"),ld.forEach(s),er=l(Se,`,
we introduced the `),gs=o(Se,"CODE",{});var nd=r(gs);tr=l(nd,"pipeline()"),nd.forEach(s),sr=l(Se,` as an easy way of running speech recognition tasks, with all pre- and post-processing handled under-the-hood
and the flexibility to quickly experiment with any pre-trained checkpoint on the Hugging Face Hub. In this Unit, we\u2019ll go a
level deeper and explore the different attributes of speech recognition models and how we can use them to tackle a range
of different tasks.`),Se.forEach(s),jl=c(e),Bt=o(e,"P",{});var od=r(Bt);ar=l(od,"As detailed in Unit 3, speech recognition model broadly fall into one of two categories:"),od.forEach(s),kl=c(e),re=o(e,"OL",{});var To=r(re);Re=o(To,"LI",{});var go=r(Re);lr=l(go,"Connectionist Temporal Classification (CTC): "),bs=o(go,"EM",{});var rd=r(bs);nr=l(rd,"encoder-only"),rd.forEach(s),or=l(go," models with a linear classification (CTC) head on top"),go.forEach(s),rr=c(To),Ge=o(To,"LI",{});var bo=r(Ge);ir=l(bo,"Sequence-to-sequence (Seq2Seq): "),Us=o(bo,"EM",{});var id=r(Us);pr=l(id,"encoder-decoder"),id.forEach(s),hr=l(bo," models, with a cross-attention mechanism between the encoder and decoder"),bo.forEach(s),To.forEach(s),Il=c(e),ie=o(e,"P",{});var Uo=r(ie);cr=l(Uo,`Prior to 2022, CTC was the more popular of the two architectures, with encoder-only models such as Wav2Vec2, HuBERT and XLSR achieving
breakthoughs in the pre-training / fine-tuning paradigm for speech. Big corporations, such as Meta and Microsoft, pre-trained
the encoder on vast amounts of unlabelled audio data for many days or weeks. Users could then take a pre-trained checkpoint, and
fine-tune it with a CTC head on as little as `),Es=o(Uo,"STRONG",{});var pd=r(Es);dr=l(pd,"10 minutes"),pd.forEach(s),mr=l(Uo,` of labelled speech data to achieve strong performance on a downstream
speech recognition task.`),Uo.forEach(s),Sl=c(e),Rt=o(e,"P",{});var hd=r(Rt);ur=l(hd,`However, CTC models have their shortcomings. Appending a simple linear layer to an encoder gives a small, fast overall model, but can
be prone to phonetic spelling errors. We\u2019ll demonstrate this for the Wav2Vec2 model below.`),hd.forEach(s),_l=c(e),se=o(e,"H2",{class:!0});var Eo=r(se);pe=o(Eo,"A",{id:!0,class:!0,href:!0});var cd=r(pe);vs=o(cd,"SPAN",{});var dd=r(vs);u(We.$$.fragment,dd),dd.forEach(s),cd.forEach(s),fr=c(Eo),Js=o(Eo,"SPAN",{});var md=r(Js);yr=l(md,"Probing CTC Models"),md.forEach(s),Eo.forEach(s),Bl=c(e),he=o(e,"P",{});var vo=r(he);wr=l(vo,"Let\u2019s load a small excerpt of the "),Gt=o(vo,"A",{href:!0});var ud=r(Gt);Mr=l(ud,"LibriSpeech ASR"),ud.forEach(s),Tr=l(vo,` dataset to demonstrate
Wav2Vec2\u2019s speech transcription capabilities:`),vo.forEach(s),Rl=c(e),u(Ve.$$.fragment,e),Gl=c(e),Wt=o(e,"P",{});var fd=r(Wt);js=o(fd,"STRONG",{});var yd=r(js);gr=l(yd,"Output:"),yd.forEach(s),fd.forEach(s),Wl=c(e),u(Ce.$$.fragment,e),Vl=c(e),Vt=o(e,"P",{});var wd=r(Vt);br=l(wd,"We can pick one of the 73 audio samples and inspect the audio sample as well as the transcription:"),wd.forEach(s),Cl=c(e),u($e.$$.fragment,e),$l=c(e),Ct=o(e,"P",{});var Md=r(Ct);ks=o(Md,"STRONG",{});var Td=r(ks);Ur=l(Td,"Output:"),Td.forEach(s),Md.forEach(s),xl=c(e),u(xe.$$.fragment,e),Fl=c(e),N=o(e,"P",{});var rs=r(N);Er=l(rs,`Alright! Christmas and roast beef, sounds great! \u{1F384} Having chosen a data sample, we now load a fine-tuned checkpoint into
the `),Is=o(rs,"CODE",{});var gd=r(Is);vr=l(gd,"pipeline()"),gd.forEach(s),Jr=l(rs,". For this, we\u2019ll use the official "),$t=o(rs,"A",{href:!0});var bd=r($t);jr=l(bd,"Wav2Vec2 base"),bd.forEach(s),kr=l(rs,` checkpoint fine-tuned on
100 hours of LibriSpeech data:`),rs.forEach(s),Al=c(e),u(Fe.$$.fragment,e),Nl=c(e),Z=o(e,"P",{});var is=r(Z);Ir=l(is,"Next, we\u2019ll take an example from the dataset and pass its raw data to the pipeline. Since the "),Ss=o(is,"CODE",{});var Ud=r(Ss);Sr=l(Ud,"pipeline"),Ud.forEach(s),_r=c(is),_s=o(is,"EM",{});var Ed=r(_s);Br=l(Ed,"consumes"),Ed.forEach(s),Rr=l(is,` any
dictionary that we pass it (meaning it cannot be re-used), we\u2019ll pass a copy of the data. This way, we can safely re-use
the same audio sample in the following examples:`),is.forEach(s),Zl=c(e),u(Ae.$$.fragment,e),Yl=c(e),xt=o(e,"P",{});var vd=r(xt);Bs=o(vd,"STRONG",{});var Jd=r(Bs);Gr=l(Jd,"Output:"),Jd.forEach(s),vd.forEach(s),Hl=c(e),u(Ne.$$.fragment,e),ql=c(e),Ft=o(e,"P",{});var jd=r(Ft);Wr=l(jd,`We can see that the Wav2Vec2 model does a pretty good job at transcribing this sample - at a first glance it looks generally correct.
Let\u2019s put the target and prediction side-by-side and highlight the differences:`),jd.forEach(s),Ql=c(e),u(Ze.$$.fragment,e),Xl=c(e),ce=o(e,"P",{});var Jo=r(ce);Vr=l(Jo,"Comparing the target text to the predicted transcription, we can see that all words "),Rs=o(Jo,"EM",{});var kd=r(Rs);Cr=l(kd,"sound"),kd.forEach(s),$r=l(Jo," correct, but some are not spelled accurately. For example:"),Jo.forEach(s),Ol=c(e),Y=o(e,"UL",{});var ps=r(Y);Ye=o(ps,"LI",{});var jo=r(Ye);Gs=o(jo,"EM",{});var Id=r(Gs);xr=l(Id,"CHRISTMAUS"),Id.forEach(s),Fr=l(jo," vs. "),Ws=o(jo,"EM",{});var Sd=r(Ws);Ar=l(Sd,"CHRISTMAS"),Sd.forEach(s),jo.forEach(s),Nr=c(ps),He=o(ps,"LI",{});var ko=r(He);Vs=o(ko,"EM",{});var _d=r(Vs);Zr=l(_d,"ROSE"),_d.forEach(s),Yr=l(ko," vs. "),Cs=o(ko,"EM",{});var Bd=r(Cs);Hr=l(Bd,"ROAST"),Bd.forEach(s),ko.forEach(s),qr=c(ps),qe=o(ps,"LI",{});var Io=r(qe);$s=o(Io,"EM",{});var Rd=r($s);Qr=l(Rd,"SIMALYIS"),Rd.forEach(s),Xr=l(Io," vs. "),xs=o(Io,"EM",{});var Gd=r(xs);Or=l(Gd,"SIMILES"),Gd.forEach(s),Io.forEach(s),ps.forEach(s),zl=c(e),At=o(e,"P",{});var Wd=r(At);zr=l(Wd,`This highlights the shortcoming of a CTC model. A CTC model is essentially an \u2018acoustic-only\u2019 model: it consists of an encoder
which forms hidden-state representations from the audio inputs, and a linear layer which maps the hidden-states to characters:`),Wd.forEach(s),Pl=c(e),W=o(e,"P",{});var _e=r(W);Pr=l(_e,`This means that the system almost entirely bases its prediction on the acoustic input it was given (the phonetic sounds of the audio),
and so has a tendency to transcribe the audio in a phonetic way (e.g. `),Fs=o(_e,"EM",{});var Vd=r(Fs);Dr=l(Vd,"CHRISTMAUS"),Vd.forEach(s),Lr=l(_e,`). It gives less importance to the
language modelling context of previous and successive letters, and so is prone to phonetic spelling errors. A more intelligent model
would identify that `),As=o(_e,"EM",{});var Cd=r(As);Kr=l(Cd,"CHRISTMAUS"),Cd.forEach(s),ei=l(_e," is not a valid word in the English vocabulary, and correct it to "),Ns=o(_e,"EM",{});var $d=r(Ns);ti=l($d,"CHRISTMAS"),$d.forEach(s),si=l(_e,` when making
its predictions. We\u2019re also missing two big features in our prediction - casing and punctuation - which limits the usefulness of
the model\u2019s transcriptions to real-world applications.`),_e.forEach(s),Dl=c(e),ae=o(e,"H2",{class:!0});var So=r(ae);de=o(So,"A",{id:!0,class:!0,href:!0});var xd=r(de);Zs=o(xd,"SPAN",{});var Fd=r(Zs);u(Qe.$$.fragment,Fd),Fd.forEach(s),xd.forEach(s),ai=c(So),Ys=o(So,"SPAN",{});var Ad=r(Ys);li=l(Ad,"Graduation to Seq2Seq"),Ad.forEach(s),So.forEach(s),Ll=c(e),me=o(e,"P",{});var _o=r(me);ni=l(_o,`Cue Seq2Seq models! As outlined in Unit 3, Seq2Seq models are formed of an encoder and decoder linked via a cross-attention
mechanism. The encoder plays the same role as before, computing hidden-state representations of the audio inputs, while the decoder
plays the role of a `),Hs=o(_o,"STRONG",{});var Nd=r(Hs);oi=l(Nd,"language model"),Nd.forEach(s),ri=l(_o,`. The decoder processes the entire sequence of hidden-state representations
from the encoder and generates the corresponding text transcriptions. With global context of the audio input, the decoder
is able to use language modelling context as it makes its predictions, correcting for spelling mistakes on-the-fly and thus
circumventing the issue of phonetic predictions.`),_o.forEach(s),Kl=c(e),Nt=o(e,"P",{});var Zd=r(Nt);ii=l(Zd,"There are two downsides to Seq2Seq models:"),Zd.forEach(s),en=c(e),ue=o(e,"OL",{});var Bo=r(ue);qs=o(Bo,"LI",{});var Yd=r(qs);pi=l(Yd,"They are inherently slower at decoding, since the decoding process happens one step at a time, rather than all at once"),Yd.forEach(s),hi=c(Bo),Qs=o(Bo,"LI",{});var Hd=r(Qs);ci=l(Hd,"They are more data hungry, requiring significantly more training data to reach convergence"),Hd.forEach(s),Bo.forEach(s),tn=c(e),_=o(e,"P",{});var D=r(_);di=l(D,`In particular, the need for large amounts of training data has been a bottleneck in the advancement of Seq2Seq architectures for
speech. Labelled speech data is difficult to come by, with the largest annotated datasets at the time clocking in at just
10,000 hours. This all changed in 2022 upon the release of `),Xs=o(D,"STRONG",{});var qd=r(Xs);mi=l(qd,"Whisper"),qd.forEach(s),ui=l(D,`. Whisper is a pre-trained model for speech recognition
published in `),Xe=o(D,"A",{href:!0,rel:!0});var Qd=r(Xe);fi=l(Qd,"September 2022"),Qd.forEach(s),yi=l(D,` by the authors Alec Radford et al. from OpenAI. Unlike
its CTC predecessors, which were pre-trained entirely on `),Os=o(D,"STRONG",{});var Xd=r(Os);wi=l(Xd,"un-labelled"),Xd.forEach(s),Mi=l(D,` audio data, Whisper is pre-trained on a vast quantity of
`),zs=o(D,"STRONG",{});var Od=r(zs);Ti=l(Od,"labelled"),Od.forEach(s),gi=l(D," audio-transcription data, 680,000 hours to be precise."),D.forEach(s),sn=c(e),fe=o(e,"P",{});var Ro=r(fe);bi=l(Ro,`This is an order of magnitude more data than the un-labelled audio data used to train Wav2Vec 2.0 (60,000 hours). What is
more, 117,000 hours of this pre-training data is multilingual (or \u201Cnon-English\u201D) data. This results in checkpoints that can be applied to
over 96 languages, many of which are considered `),Ps=o(Ro,"EM",{});var zd=r(Ps);Ui=l(zd,"low-resource"),zd.forEach(s),Ei=l(Ro,", meaning the language lacks a large corpus of data suitable for training."),Ro.forEach(s),an=c(e),H=o(e,"P",{});var hs=r(H);vi=l(hs,`When scaled to 680,000 hours of labelled pre-training data, Whisper models demonstrate a strong ability to generalise to
many datasets and domains. The pre-trained checkpoints achieve competitive results to state-of-the-art pipe systems, with
near 3% word error rate (WER) on the test-clean subset of LibriSpeech pipe and a new state-of-the-art on TED-LIUM with
4.7% WER (`),Ds=o(hs,"EM",{});var Pd=r(Ds);Ji=l(Pd,"c.f."),Pd.forEach(s),ji=l(hs," Table 8 of the "),Oe=o(hs,"A",{href:!0,rel:!0});var Dd=r(Oe);ki=l(Dd,"Whisper paper"),Dd.forEach(s),Ii=l(hs,")."),hs.forEach(s),ln=c(e),Zt=o(e,"P",{});var Ld=r(Zt);Si=l(Ld,`Of particular importance is Whisper\u2019s ability to handle long-form audio samples, its robustness to input noise and ability
to predict cased and punctuated transcriptions. This makes it a viable candidate for real-world speech recognition systems.`),Ld.forEach(s),nn=c(e),ye=o(e,"P",{});var Go=r(ye);_i=l(Go,`The remainder of this section will show you how to use the pre-trained Whisper models for speech recognition using \u{1F917}
Transformers. In many situations, the pre-trained Whisper checkpoints are extremely performant and give great results,
thus we encourage you to try using the pre-trained checkpoints as a first step to solving any speech recognition problem.
Through fine-tuning, the pre-trained checkpoints can be adapted for specific datasets and languages to further improve
upon these results. We\u2019ll demonstrate how to do this in the upcoming subsection on `),Yt=o(Go,"A",{href:!0});var Kd=r(Yt);Bi=l(Kd,"fine-tuning"),Kd.forEach(s),Ri=l(Go,"."),Go.forEach(s),on=c(e),we=o(e,"P",{});var Wo=r(we);Gi=l(Wo,`The Whisper checkpoints come in five configurations of varying model sizes. The smallest four are trained on either
English-only or multilingual data. The largest checkpoint is multilingual only. All nine of the pre-trained checkpoints
are available on the `),ze=o(Wo,"A",{href:!0,rel:!0});var em=r(ze);Wi=l(em,"Hugging Face Hub"),em.forEach(s),Vi=l(Wo,`. The checkpoints are
summarised in the following table with links to the models on the Hub. \u201CVRAM\u201D denotes the required GPU memory to run the
model with the minimum batch size of 1. \u201CRel Speed\u201D is the relative speed of a checkpoint compared to the largest model.
Based on this information, you can select a checkpoint that is best suited to your hardware.`),Wo.forEach(s),rn=c(e),Me=o(e,"TABLE",{});var Vo=r(Me);Ls=o(Vo,"THEAD",{});var tm=r(Ls);v=o(tm,"TR",{});var V=r(v);Ks=o(V,"TH",{});var sm=r(Ks);Ci=l(sm,"Size"),sm.forEach(s),$i=c(V),ea=o(V,"TH",{});var am=r(ea);xi=l(am,"Parameters"),am.forEach(s),Fi=c(V),ta=o(V,"TH",{});var lm=r(ta);Ai=l(lm,"VRAM / GB"),lm.forEach(s),Ni=c(V),sa=o(V,"TH",{});var nm=r(sa);Zi=l(nm,"Rel Speed"),nm.forEach(s),Yi=c(V),aa=o(V,"TH",{});var om=r(aa);Hi=l(om,"English-only"),om.forEach(s),qi=c(V),la=o(V,"TH",{});var rm=r(la);Qi=l(rm,"Multilingual"),rm.forEach(s),V.forEach(s),tm.forEach(s),Xi=c(Vo),R=o(Vo,"TBODY",{});var L=r(R);J=o(L,"TR",{});var C=r(J);na=o(C,"TD",{});var im=r(na);Oi=l(im,"tiny"),im.forEach(s),zi=c(C),oa=o(C,"TD",{});var pm=r(oa);Pi=l(pm,"39 M"),pm.forEach(s),Di=c(C),ra=o(C,"TD",{});var hm=r(ra);Li=l(hm,"1.4"),hm.forEach(s),Ki=c(C),ia=o(C,"TD",{});var cm=r(ia);ep=l(cm,"32"),cm.forEach(s),tp=c(C),pa=o(C,"TD",{});var dm=r(pa);Pe=o(dm,"A",{href:!0,rel:!0});var mm=r(Pe);sp=l(mm,"\u2713"),mm.forEach(s),dm.forEach(s),ap=c(C),ha=o(C,"TD",{});var um=r(ha);De=o(um,"A",{href:!0,rel:!0});var fm=r(De);lp=l(fm,"\u2713"),fm.forEach(s),um.forEach(s),C.forEach(s),np=c(L),j=o(L,"TR",{});var $=r(j);ca=o($,"TD",{});var ym=r(ca);op=l(ym,"base"),ym.forEach(s),rp=c($),da=o($,"TD",{});var wm=r(da);ip=l(wm,"74 M"),wm.forEach(s),pp=c($),ma=o($,"TD",{});var Mm=r(ma);hp=l(Mm,"1.5"),Mm.forEach(s),cp=c($),ua=o($,"TD",{});var Tm=r(ua);dp=l(Tm,"16"),Tm.forEach(s),mp=c($),fa=o($,"TD",{});var gm=r(fa);Le=o(gm,"A",{href:!0,rel:!0});var bm=r(Le);up=l(bm,"\u2713"),bm.forEach(s),gm.forEach(s),fp=c($),ya=o($,"TD",{});var Um=r(ya);Ke=o(Um,"A",{href:!0,rel:!0});var Em=r(Ke);yp=l(Em,"\u2713"),Em.forEach(s),Um.forEach(s),$.forEach(s),wp=c(L),k=o(L,"TR",{});var x=r(k);wa=o(x,"TD",{});var vm=r(wa);Mp=l(vm,"small"),vm.forEach(s),Tp=c(x),Ma=o(x,"TD",{});var Jm=r(Ma);gp=l(Jm,"244 M"),Jm.forEach(s),bp=c(x),Ta=o(x,"TD",{});var jm=r(Ta);Up=l(jm,"2.3"),jm.forEach(s),Ep=c(x),ga=o(x,"TD",{});var km=r(ga);vp=l(km,"6"),km.forEach(s),Jp=c(x),ba=o(x,"TD",{});var Im=r(ba);et=o(Im,"A",{href:!0,rel:!0});var Sm=r(et);jp=l(Sm,"\u2713"),Sm.forEach(s),Im.forEach(s),kp=c(x),Ua=o(x,"TD",{});var _m=r(Ua);tt=o(_m,"A",{href:!0,rel:!0});var Bm=r(tt);Ip=l(Bm,"\u2713"),Bm.forEach(s),_m.forEach(s),x.forEach(s),Sp=c(L),I=o(L,"TR",{});var F=r(I);Ea=o(F,"TD",{});var Rm=r(Ea);_p=l(Rm,"medium"),Rm.forEach(s),Bp=c(F),va=o(F,"TD",{});var Gm=r(va);Rp=l(Gm,"769 M"),Gm.forEach(s),Gp=c(F),Ja=o(F,"TD",{});var Wm=r(Ja);Wp=l(Wm,"4.2"),Wm.forEach(s),Vp=c(F),ja=o(F,"TD",{});var Vm=r(ja);Cp=l(Vm,"2"),Vm.forEach(s),$p=c(F),ka=o(F,"TD",{});var Cm=r(ka);st=o(Cm,"A",{href:!0,rel:!0});var $m=r(st);xp=l($m,"\u2713"),$m.forEach(s),Cm.forEach(s),Fp=c(F),Ia=o(F,"TD",{});var xm=r(Ia);at=o(xm,"A",{href:!0,rel:!0});var Fm=r(at);Ap=l(Fm,"\u2713"),Fm.forEach(s),xm.forEach(s),F.forEach(s),Np=c(L),S=o(L,"TR",{});var A=r(S);Sa=o(A,"TD",{});var Am=r(Sa);Zp=l(Am,"large"),Am.forEach(s),Yp=c(A),_a=o(A,"TD",{});var Nm=r(_a);Hp=l(Nm,"1550 M"),Nm.forEach(s),qp=c(A),Ba=o(A,"TD",{});var Zm=r(Ba);Qp=l(Zm,"7.5"),Zm.forEach(s),Xp=c(A),Ra=o(A,"TD",{});var Ym=r(Ra);Op=l(Ym,"1"),Ym.forEach(s),zp=c(A),Ga=o(A,"TD",{});var Hm=r(Ga);Pp=l(Hm,"x"),Hm.forEach(s),Dp=c(A),Wa=o(A,"TD",{});var qm=r(Wa);lt=o(qm,"A",{href:!0,rel:!0});var Qm=r(lt);Lp=l(Qm,"\u2713"),Qm.forEach(s),qm.forEach(s),A.forEach(s),L.forEach(s),Vo.forEach(s),pn=c(e),q=o(e,"P",{});var cs=r(q);Kp=l(cs,"Let\u2019s load the "),nt=o(cs,"A",{href:!0,rel:!0});var Xm=r(nt);eh=l(Xm,"Whisper Base"),Xm.forEach(s),th=l(cs,` checkpoint, which is of comparable size to the
Wav2Vec2 checkpoint we used previously. Preempting our move to multilingual speech recognition, we\u2019ll load the multilingual
variant of the base checkpoint. We\u2019ll also load the model on the GPU if available, or CPU otherwise. The `),Va=o(cs,"CODE",{});var Om=r(Va);sh=l(Om,"pipeline()"),Om.forEach(s),ah=l(cs,` will
subsequently take care of moving all inputs / outputs from the CPU to the GPU as required:`),cs.forEach(s),hn=c(e),u(ot.$$.fragment,e),cn=c(e),Te=o(e,"P",{});var Co=r(Te);lh=l(Co,"Great! Now let\u2019s transcribe the audio as before. The only change we make is passing an extra argument, "),Ca=o(Co,"CODE",{});var zm=r(Ca);nh=l(zm,"max_new_tokens"),zm.forEach(s),oh=l(Co,`,
which tells the model the maximum number of tokens to generate when making its prediction:`),Co.forEach(s),dn=c(e),u(rt.$$.fragment,e),mn=c(e),Ht=o(e,"P",{});var Pm=r(Ht);$a=o(Pm,"STRONG",{});var Dm=r($a);rh=l(Dm,"Output:"),Dm.forEach(s),Pm.forEach(s),un=c(e),u(it.$$.fragment,e),fn=c(e),qt=o(e,"P",{});var Lm=r(qt);ih=l(Lm,`Easy enough! The first thing you\u2019ll notice is the presence of both casing and punctuation. Immediately this makes the
transcription easier to read compared to the un-cased and un-punctuated transcription from Wav2Vec2. Let\u2019s put the transcription
side-by-side with the target:`),Lm.forEach(s),yn=c(e),u(pt.$$.fragment,e),wn=c(e),B=o(e,"P",{});var K=r(B);ph=l(K,"Whisper has done a great job at correcting the phonetic errors we saw from Wav2Vec2 - both "),xa=o(K,"EM",{});var Km=r(xa);hh=l(Km,"Christmas"),Km.forEach(s),ch=l(K," and "),Fa=o(K,"EM",{});var eu=r(Fa);dh=l(eu,"roast"),eu.forEach(s),mh=l(K,` are
spelled correctly. We see that the model still struggles with `),Aa=o(K,"EM",{});var tu=r(Aa);uh=l(tu,"SIMILES"),tu.forEach(s),fh=l(K,", being incorrectly transcribed as "),Na=o(K,"EM",{});var su=r(Na);yh=l(su,"similarly"),su.forEach(s),wh=l(K,`, but
this time the prediction is a valid word from the English vocabulary. Using a larger Whisper checkpoint can help further
reduce transcription errors, at the expense of requiring more compute and a longer transcription time.`),K.forEach(s),Mn=c(e),Q=o(e,"P",{});var ds=r(Q);Mh=l(ds,`We\u2019ve been promised a model that can handle 96 languages, so lets leave English speech recognition for now and go global \u{1F30E}!
The `),ht=o(ds,"A",{href:!0,rel:!0});var au=r(ht);Th=l(au,"Multilingual LibriSpeech"),au.forEach(s),gh=l(ds,` (MLS) dataset is
the multilingual equivalent of the LibriSpeech dataset, with labelled audio data in six languages. We\u2019ll load one sample
from the Spanish split of the MLS dataset, making use of `),Za=o(ds,"EM",{});var lu=r(Za);bh=l(lu,"streaming"),lu.forEach(s),Uh=l(ds," mode so that we don\u2019t have to download the entire dataset:"),ds.forEach(s),Tn=c(e),u(ct.$$.fragment,e),gn=c(e),Qt=o(e,"P",{});var nu=r(Qt);Eh=l(nu,"Again, we\u2019ll inspect the text transcription and take a listen to the audio segment:"),nu.forEach(s),bn=c(e),u(dt.$$.fragment,e),Un=c(e),Xt=o(e,"P",{});var ou=r(Xt);Ya=o(ou,"STRONG",{});var ru=r(Ya);vh=l(ru,"Output:"),ru.forEach(s),ou.forEach(s),En=c(e),u(mt.$$.fragment,e),vn=c(e),X=o(e,"P",{});var ms=r(X);Jh=l(ms,`This is the target text that we\u2019re aiming for with our Whisper transcription. Although we now know that we can
probably do better this, since our model is also going to predict punctuation and casing, neither of which are present in the
reference. Let\u2019s forward the audio sample to the pipeline to get our text prediction. One thing to note is that the
pipeline `),Ha=o(ms,"EM",{});var iu=r(Ha);jh=l(iu,"consumes"),iu.forEach(s),kh=l(ms,` the dictionary of audio inputs that we input, meaning the dictionary can\u2019t be re-used. To circumvent
this, we\u2019ll pass a `),qa=o(ms,"EM",{});var pu=r(qa);Ih=l(pu,"copy"),pu.forEach(s),Sh=l(ms," of the audio sample, so that we can re-use the same audio sample in the proceeding code examples:"),ms.forEach(s),Jn=c(e),u(ut.$$.fragment,e),jn=c(e),Ot=o(e,"P",{});var hu=r(Ot);Qa=o(hu,"STRONG",{});var cu=r(Qa);_h=l(cu,"Output:"),cu.forEach(s),hu.forEach(s),kn=c(e),u(ft.$$.fragment,e),In=c(e),g=o(e,"P",{});var U=r(g);Bh=l(U,`Great - this looks very similar to our reference text (arguably better since it has punctuation and casing!). You\u2019ll notice
that we forwarded the `),Xa=o(U,"CODE",{});var du=r(Xa);Rh=l(du,'"task"'),du.forEach(s),Gh=l(U," as a "),Oa=o(U,"EM",{});var mu=r(Oa);Wh=l(mu,"generate key-word argument"),mu.forEach(s),Vh=l(U," (generate kwarg). Setting the "),za=o(U,"CODE",{});var uu=r(za);Ch=l(uu,'"task"'),uu.forEach(s),$h=l(U," to "),Pa=o(U,"CODE",{});var fu=r(Pa);xh=l(fu,'"transcribe"'),fu.forEach(s),Fh=l(U,`
forces Whisper to perform the task of `),Da=o(U,"EM",{});var yu=r(Da);Ah=l(yu,"speech recognition"),yu.forEach(s),Nh=l(U,`, where the audio is transcribed in the same language that the
speech was spoken in. Whisper is also capable of performing the closely related task of `),La=o(U,"EM",{});var wu=r(La);Zh=l(wu,"speech translation"),wu.forEach(s),Yh=l(U,`, where the
audio in Spanish can be translated to text in English. To achieve this, we set the `),Ka=o(U,"CODE",{});var Mu=r(Ka);Hh=l(Mu,'"task"'),Mu.forEach(s),qh=l(U," to "),el=o(U,"CODE",{});var Tu=r(el);Qh=l(Tu,'"translate"'),Tu.forEach(s),Xh=l(U,":"),U.forEach(s),Sn=c(e),u(yt.$$.fragment,e),_n=c(e),zt=o(e,"P",{});var gu=r(zt);tl=o(gu,"STRONG",{});var bu=r(tl);Oh=l(bu,"Output:"),bu.forEach(s),gu.forEach(s),Bn=c(e),u(wt.$$.fragment,e),Rn=c(e),Pt=o(e,"P",{});var Uu=r(Pt);zh=l(Uu,`Now that we know we can toggle between speech recognition and speech translation, we can pick our task depending on our
needs. Either we recognise from audio in language X to text in the same language X (e.g. Spanish audio to Spanish text),
or we translate from audio in any language X to text in English (e.g. Spanish audio to English text).`),Uu.forEach(s),Gn=c(e),O=o(e,"P",{});var us=r(O);Ph=l(us,"To read more about how the "),sl=o(us,"CODE",{});var Eu=r(sl);Dh=l(Eu,'"task"'),Eu.forEach(s),Lh=l(us,` argument is used to control the properties of the generated text, refer to the
`),Mt=o(us,"A",{href:!0,rel:!0});var vu=r(Mt);Kh=l(vu,"model card"),vu.forEach(s),ec=l(us," for the Whisper base model."),us.forEach(s),Wn=c(e),le=o(e,"H2",{class:!0});var $o=r(le);ge=o($o,"A",{id:!0,class:!0,href:!0});var Ju=r(ge);al=o(Ju,"SPAN",{});var ju=r(al);u(Tt.$$.fragment,ju),ju.forEach(s),Ju.forEach(s),tc=c($o),ll=o($o,"SPAN",{});var ku=r(ll);sc=l(ku,"Long-Form Transcription and Timestamps"),ku.forEach(s),$o.forEach(s),Vn=c(e),Dt=o(e,"P",{});var Iu=r(Dt);ac=l(Iu,`So far, we\u2019ve focussed on transcribing short audio samples of less than 30 seconds. We mentioned that one of the appeals
of Whisper was its ability to work on long audio samples. We\u2019ll tackle this task here!`),Iu.forEach(s),Cn=c(e),Lt=o(e,"P",{});var Su=r(Lt);lc=l(Su,`Let\u2019s create a long audio file by concatenating sequential samples from the MLS dataset. Since the MLS dataset is
curated by splitting long audiobook recordings into shorter segments, concatenating samples is one way of reconstructing
longer audiobook passages. Consequently, the resulting audio should be coherent across the entire sample.`),Su.forEach(s),$n=c(e),Kt=o(e,"P",{});var _u=r(Kt);nc=l(_u,"We\u2019ll set our target audio length to 5 minutes, and stop concatenating samples once we hit this value:"),_u.forEach(s),xn=c(e),u(gt.$$.fragment,e),Fn=c(e),es=o(e,"P",{});var Bu=r(es);nl=o(Bu,"STRONG",{});var Ru=r(nl);oc=l(Ru,"Output:"),Ru.forEach(s),Bu.forEach(s),An=c(e),u(bt.$$.fragment,e),Nn=c(e),ts=o(e,"P",{});var Gu=r(ts);rc=l(Gu,`Alright! 5 minutes and 17 seconds of audio to transcribe. There are two problems with forwarding this long audio sample
directly to the model:`),Gu.forEach(s),Zn=c(e),be=o(e,"OL",{});var xo=r(be);ol=o(xo,"LI",{});var Wu=r(ol);ic=l(Wu,"Whisper is inherently designed to work with 30 second samples: anything shorter than 30s is padded to 30s with silence, anything longer than 30s is truncated to 30s by cutting of the extra audio, so if we pass our audio directly we\u2019ll only get the transcription for the first 30s"),Wu.forEach(s),pc=c(xo),rl=o(xo,"LI",{});var Vu=r(rl);hc=l(Vu,"Memory in a transformer network scales with the sequence length squared: doubling the input length quadruples the memory requirement, so passing super long audio files is bound to lead to an out-of-memory (OOM) error"),Vu.forEach(s),xo.forEach(s),Yn=c(e),Ue=o(e,"P",{});var Fo=r(Ue);cc=l(Fo,"The way long-form transcription works in \u{1F917} Transformers is by "),il=o(Fo,"EM",{});var Cu=r(il);dc=l(Cu,"chunking"),Cu.forEach(s),mc=l(Fo,` the input audio into smaller, more manageable segments.
Each segment has a small amount of overlap with the previous one. This allows us to accurately stitch the segments back together
at the boundaries, since we can find the overlap between segments and merge the transcriptions accordingly:`),Fo.forEach(s),Hn=c(e),Ut=o(e,"DIV",{class:!0});var $u=r(Ut);ss=o($u,"IMG",{src:!0,alt:!0}),$u.forEach(s),qn=c(e),b=o(e,"P",{});var E=r(b);uc=l(E,"The advantage of chunking the samples is that we don\u2019t need the result of chunk "),Qn=Xo(E),Xn=l(E,` to transcribe the subsequent
chunk `),On=Xo(E),zn=l(E,`. The stitching is done after we have transcribed all the chunks at the chunk boundaries, so it doesn\u2019t
matter which order we transcribe chunks in. The algorithm is entirely `),pl=o(E,"STRONG",{});var xu=r(pl);fc=l(xu,"stateless"),xu.forEach(s),yc=l(E,", so we can even do chunk "),Pn=Xo(E),Dn=l(E,`
at the same time as chunk `),Ln=Xo(E),Kn=l(E,"! This allows us to "),hl=o(E,"EM",{});var Fu=r(hl);wc=l(Fu,"batch"),Fu.forEach(s),Mc=l(E,` the chunks and run them through the model in parallel,
providing a large computational speed-up compared to transcribing them sequentially. To read more about chunking in \u{1F917} Transformers,
you can refer to this `),Et=o(E,"A",{href:!0,rel:!0});var Au=r(Et);Tc=l(Au,"blog post"),Au.forEach(s),gc=l(E,"."),E.forEach(s),eo=c(e),Ee=o(e,"P",{});var Ao=r(Ee);bc=l(Ao,`To activate long-form transcriptions, we have to add one additional argument when we call the pipeline. This argument,
`),cl=o(Ao,"CODE",{});var Nu=r(cl);Uc=l(Nu,"chunk_length_s"),Nu.forEach(s),Ec=l(Ao,`, controls the length of the chunked segments in seconds. For Whisper, 30 second chunks are optimal,
since this matches the input length Whisper expects.`),Ao.forEach(s),to=c(e),ve=o(e,"P",{});var No=r(ve);vc=l(No,"To activate batching, we need to pass the argument "),dl=o(No,"CODE",{});var Zu=r(dl);Jc=l(Zu,"batch_size"),Zu.forEach(s),jc=l(No,` to the pipeline. Putting it all together, we can transcribe the
long audio sample with chunking and batching as follows:`),No.forEach(s),so=c(e),u(vt.$$.fragment,e),ao=c(e),as=o(e,"P",{});var Yu=r(as);ml=o(Yu,"STRONG",{});var Hu=r(ml);kc=l(Hu,"Output:"),Hu.forEach(s),Yu.forEach(s),lo=c(e),u(Jt.$$.fragment,e),no=c(e),ls=o(e,"P",{});var qu=r(ls);Ic=l(qu,`We won\u2019t print the entire output here since it\u2019s pretty long (312 words total)! On a 16GB V100 GPU, you can expect the above
line to take approximately 3.45 seconds to run, which is pretty good for a 317 second audio sample. On a CPU, expect
closer to 30 seconds.`),qu.forEach(s),oo=c(e),Je=o(e,"P",{});var Zo=r(Je);Sc=l(Zo,"Whisper is also able to predict segment-level "),ul=o(Zo,"EM",{});var Qu=r(ul);_c=l(Qu,"timestamps"),Qu.forEach(s),Bc=l(Zo,` for the audio data. These timestamps indicate the start and end
time for a short passage of audio, and are particularly useful for aligning a transcription with the input audio. Suppose
we want to provide closed captions for a video - we need these timestamps to know which part of the transcription corresponds
to a certain segment of video, in order to display the correct transcription for that time.`),Zo.forEach(s),ro=c(e),je=o(e,"P",{});var Yo=r(je);Rc=l(Yo,"Activating timestamp prediction is straightforward, we just need to set the argument "),fl=o(Yo,"CODE",{});var Xu=r(fl);Gc=l(Xu,"return_timestamps=True"),Xu.forEach(s),Wc=l(Yo,`. Timestamps
are compatible with both the chunking and batching methods we used previously, so we can simply append the timestamp
argument to our previous call:`),Yo.forEach(s),io=c(e),u(jt.$$.fragment,e),po=c(e),ns=o(e,"P",{});var Ou=r(ns);yl=o(Ou,"STRONG",{});var zu=r(yl);Vc=l(zu,"Output:"),zu.forEach(s),Ou.forEach(s),ho=c(e),u(kt.$$.fragment,e),co=c(e),os=o(e,"P",{});var Pu=r(os);Cc=l(Pu,"And voila! We have our predicted text as well as corresponding timestamps."),Pu.forEach(s),mo=c(e),ne=o(e,"H2",{class:!0});var Ho=r(ne);ke=o(Ho,"A",{id:!0,class:!0,href:!0});var Du=r(ke);wl=o(Du,"SPAN",{});var Lu=r(wl);u(It.$$.fragment,Lu),Lu.forEach(s),Du.forEach(s),$c=c(Ho),Ml=o(Ho,"SPAN",{});var Ku=r(Ml);xc=l(Ku,"Summary"),Ku.forEach(s),Ho.forEach(s),uo=c(e),z=o(e,"P",{});var fs=r(z);Fc=l(fs,`Whisper is a strong pre-trained model for speech recognition and translation. Compared to Wav2Vec2, it has higher
transcription accuracy, with outputs that contain punctuation and casing. It can be used to transcribe speech in English
as well as 96 other languages, both on short audio segments and longer ones through `),Tl=o(fs,"EM",{});var ef=r(Tl);Ac=l(ef,"chunking"),ef.forEach(s),Nc=l(fs,`. These attributes make it
a viable model for many speech recognition and translation tasks without the need for fine-tuning. The `),gl=o(fs,"CODE",{});var tf=r(gl);Zc=l(tf,"pipeline()"),tf.forEach(s),Yc=l(fs,` method
provides an easy way of running inference in one-line API calls with control over the generated predictions.`),fs.forEach(s),fo=c(e),P=o(e,"P",{});var ys=r(P);Hc=l(ys,`While the Whisper model performs extremely well on many high-resource languages, it has lower transcription and translation
accuracy on low-resource languages, i.e. those with less readily available training data. There is also varying performance
across different accents and dialects of certain languages, including lower accuracy for speakers of different genders,
races, ages or other demographic criteria (`),bl=o(ys,"EM",{});var sf=r(bl);qc=l(sf,"c.f."),sf.forEach(s),Qc=c(ys),St=o(ys,"A",{href:!0,rel:!0});var af=r(St);Xc=l(af,"Whisper paper"),af.forEach(s),Oc=l(ys,")."),ys.forEach(s),yo=c(e),Ie=o(e,"P",{});var qo=r(Ie);zc=l(qo,`To boost the performance on low-resource languages, accents or dialects, we can take the pre-trained Whisper model and
train it on a small corpus of appropriately selected data, in a process called `),Ul=o(qo,"EM",{});var lf=r(Ul);Pc=l(lf,"fine-tuning"),lf.forEach(s),Dc=l(qo,`. We\u2019ll show that with
as little of ten hours of additional data, we can improve the performance of the Whisper model by over 100% on a low-resource
language. In the next section, we\u2019ll cover the process behind selecting a dataset for fine-tuning.`),qo.forEach(s),this.h()},h(){d(ee,"name","hf:doc:metadata"),d(ee,"content",JSON.stringify(Mf)),d(oe,"id","pretrained-models-for-automatic-speech-recognition"),d(oe,"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"),d(oe,"href","#pretrained-models-for-automatic-speech-recognition"),d(te,"class","relative group"),d(_t,"href","../chapter2/asr_pipeline"),d(pe,"id","probing-ctc-models"),d(pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(pe,"href","#probing-ctc-models"),d(se,"class","relative group"),d(Gt,"href","hf-internal-testing/librispeech_asr_dummy"),d($t,"href","facebook/wav2vec2-base-100h"),d(de,"id","graduation-to-seq2seq"),d(de,"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"),d(de,"href","#graduation-to-seq2seq"),d(ae,"class","relative group"),d(Xe,"href","https://openai.com/blog/whisper/"),d(Xe,"rel","nofollow"),d(Oe,"href","https://cdn.openai.com/papers/whisper.pdf"),d(Oe,"rel","nofollow"),d(Yt,"href","fine-tuning"),d(ze,"href","https://huggingface.co/models?search=openai/whisper"),d(ze,"rel","nofollow"),d(Pe,"href","https://huggingface.co/openai/whisper-tiny.en"),d(Pe,"rel","nofollow"),d(De,"href","https://huggingface.co/openai/whisper-tiny"),d(De,"rel","nofollow"),d(Le,"href","https://huggingface.co/openai/whisper-base.en"),d(Le,"rel","nofollow"),d(Ke,"href","https://huggingface.co/openai/whisper-base"),d(Ke,"rel","nofollow"),d(et,"href","https://huggingface.co/openai/whisper-small.en"),d(et,"rel","nofollow"),d(tt,"href","https://huggingface.co/openai/whisper-small"),d(tt,"rel","nofollow"),d(st,"href","https://huggingface.co/openai/whisper-medium.en"),d(st,"rel","nofollow"),d(at,"href","https://huggingface.co/openai/whisper-medium"),d(at,"rel","nofollow"),d(lt,"href","https://huggingface.co/openai/whisper-large-v2"),d(lt,"rel","nofollow"),d(nt,"href","https://huggingface.co/openai/whisper-base"),d(nt,"rel","nofollow"),d(ht,"href","https://huggingface.co/datasets/facebook/multilingual_librispeech"),d(ht,"rel","nofollow"),d(Mt,"href","https://huggingface.co/openai/whisper-base#usage"),d(Mt,"rel","nofollow"),d(ge,"id","longform-transcription-and-timestamps"),d(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ge,"href","#longform-transcription-and-timestamps"),d(le,"class","relative group"),uf(ss.src,Kc="https://huggingface.co/blog/assets/49_asr_chunking/Striding.png")||d(ss,"src",Kc),d(ss,"alt","\u{1F917} Transformers chunking algorithm. Source: https://huggingface.co/blog/asr-chunking."),d(Ut,"class","flex justify-center"),Qn.a=Xn,On.a=zn,Pn.a=Dn,Ln.a=Kn,d(Et,"href","https://huggingface.co/blog/asr-chunking"),d(Et,"rel","nofollow"),d(ke,"id","summary"),d(ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ke,"href","#summary"),d(ne,"class","relative group"),d(St,"href","https://arxiv.org/pdf/2212.04356.pdf"),d(St,"rel","nofollow")},m(e,i){t(document.head,ee),p(e,vl,i),p(e,te,i),t(te,oe),t(oe,ws),f(Be,ws,null),t(te,Oo),t(te,Ms),t(Ms,zo),p(e,Jl,i),p(e,G,i),t(G,Po),t(G,Ts),t(Ts,Do),t(G,Lo),t(G,_t),t(_t,Ko),t(G,er),t(G,gs),t(gs,tr),t(G,sr),p(e,jl,i),p(e,Bt,i),t(Bt,ar),p(e,kl,i),p(e,re,i),t(re,Re),t(Re,lr),t(Re,bs),t(bs,nr),t(Re,or),t(re,rr),t(re,Ge),t(Ge,ir),t(Ge,Us),t(Us,pr),t(Ge,hr),p(e,Il,i),p(e,ie,i),t(ie,cr),t(ie,Es),t(Es,dr),t(ie,mr),p(e,Sl,i),p(e,Rt,i),t(Rt,ur),p(e,_l,i),p(e,se,i),t(se,pe),t(pe,vs),f(We,vs,null),t(se,fr),t(se,Js),t(Js,yr),p(e,Bl,i),p(e,he,i),t(he,wr),t(he,Gt),t(Gt,Mr),t(he,T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Ee,Ec),p(e,to,i),p(e,ve,i),t(ve,vc),t(ve,dl),t(dl,Jc),t(ve,jc),p(e,so,i),f(vt,e,i),p(e,ao,i),p(e,as,i),t(as,ml),t(ml,kc),p(e,lo,i),f(Jt,e,i),p(e,no,i),p(e,ls,i),t(ls,Ic),p(e,oo,i),p(e,Je,i),t(Je,Sc),t(Je,ul),t(ul,_c),t(Je,Bc),p(e,ro,i),p(e,je,i),t(je,Rc),t(je,fl),t(fl,Gc),t(je,Wc),p(e,io,i),f(jt,e,i),p(e,po,i),p(e,ns,i),t(ns,yl),t(yl,Vc),p(e,ho,i),f(kt,e,i),p(e,co,i),p(e,os,i),t(os,Cc),p(e,mo,i),p(e,ne,i),t(ne,ke),t(ke,wl),f(It,wl,null),t(ne,$c),t(ne,Ml),t(Ml,xc),p(e,uo,i),p(e,z,i),t(z,Fc),t(z,Tl),t(Tl,Ac),t(z,Nc),t(z,gl),t(gl,Zc),t(z,Yc),p(e,fo,i),p(e,P,i),t(P,Hc),t(P,bl),t(bl,qc),t(P,Qc),t(P,St),t(St,Xc),t(P,Oc),p(e,yo,i),p(e,Ie,i),t(Ie,zc),t(Ie,Ul),t(Ul,Pc),t(Ie,Dc),wo=!0},p:ff,i(e){wo||(y(Be.$$.fragment,e),y(We.$$.fragment,e),y(Ve.$$.fragment,e),y(Ce.$$.fragment,e),y($e.$$.fragment,e),y(xe.$$.fragment,e),y(Fe.$$.fragment,e),y(Ae.$$.fragment,e),y(Ne.$$.fragment,e),y(Ze.$$.fragment,e),y(Qe.$$.fragment,e),y(ot.$$.fragment,e),y(rt.$$.fragment,e),y(it.$$.fragment,e),y(pt.$$.fragment,e),y(ct.$$.fragment,e),y(dt.$$.fragment,e),y(mt.$$.fragment,e),y(ut.$$.fragment,e),y(ft.$$.fragment,e),y(yt.$$.fragment,e),y(wt.$$.fragment,e),y(Tt.$$.fragment,e),y(gt.$$.fragment,e),y(bt.$$.fragment,e),y(vt.$$.fragment,e),y(Jt.$$.fragment,e),y(jt.$$.fragment,e),y(kt.$$.fragment,e),y(It.$$.fragment,e),wo=!0)},o(e){w(Be.$$.fragment,e),w(We.$$.fragment,e),w(Ve.$$.fragment,e),w(Ce.$$.fragment,e),w($e.$$.fragment,e),w(xe.$$.fragment,e),w(Fe.$$.fragment,e),w(Ae.$$.fragment,e),w(Ne.$$.fragment,e),w(Ze.$$.fragment,e),w(Qe.$$.fragment,e),w(ot.$$.fragment,e),w(rt.$$.fragment,e),w(it.$$.fragment,e),w(pt.$$.fragment,e),w(ct.$$.fragment,e),w(dt.$$.fragment,e),w(mt.$$.fragment,e),w(ut.$$.fragment,e),w(ft.$$.fragment,e),w(yt.$$.fragment,e),w(wt.$$.fragment,e),w(Tt.$$.fragment,e),w(gt.$$.fragment,e),w(bt.$$.fragment,e),w(vt.$$.fragment,e),w(Jt.$$.fragment,e),w(jt.$$.fragment,e),w(kt.$$.fragment,e),w(It.$$.fragment,e),wo=!1},d(e){s(ee),e&&s(vl),e&&s(te),M(Be),e&&s(Jl),e&&s(G),e&&s(jl),e&&s(Bt),e&&s(kl),e&&s(re),e&&s(Il),e&&s(ie),e&&s(Sl),e&&s(Rt),e&&s(_l),e&&s(se),M(We),e&&s(Bl),e&&s(he),e&&s(Rl),M(Ve,e),e&&s(Gl),e&&s(Wt),e&&s(Wl),M(Ce,e),e&&s(Vl),e&&s(Vt),e&&s(Cl),M($e,e),e&&s($l),e&&s(Ct),e&&s(xl),M(xe,e),e&&s(Fl),e&&s(N),e&&s(Al),M(Fe,e),e&&s(Nl),e&&s(Z),e&&s(Zl),M(Ae,e),e&&s(Yl),e&&s(xt),e&&s(Hl),M(Ne,e),e&&s(ql),e&&s(Ft),e&&s(Ql),M(Ze,e),e&&s(Xl),e&&s(ce),e&&s(Ol),e&&s(Y),e&&s(zl),e&&s(At),e&&s(Pl),e&&s(W),e&&s(Dl),e&&s(ae),M(Qe),e&&s(Ll),e&&s(me),e&&s(Kl),e&&s(Nt),e&&s(en),e&&s(ue),e&&s(tn),e&&s(_),e&&s(sn),e&&s(fe),e&&s(an),e&&s(H),e&&s(ln),e&&s(Zt),e&&s(nn),e&&s(ye),e&&s(on),e&&s(we),e&&s(rn),e&&s(Me),e&&s(pn),e&&s(q),e&&s(hn),M(ot,e),e&&s(cn),e&&s(Te),e&&s(dn),M(rt,e),e&&s(mn),e&&s(Ht),e&&s(un),M(it,e),e&&s(fn),e&&s(qt),e&&s(yn),M(pt,e),e&&s(wn),e&&s(B),e&&s(Mn),e&&s(Q),e&&s(Tn),M(ct,e),e&&s(gn),e&&s(Qt),e&&s(bn),M(dt,e),e&&s(Un),e&&s(Xt),e&&s(En),M(mt,e),e&&s(vn),e&&s(X),e&&s(Jn),M(ut,e),e&&s(jn),e&&s(Ot),e&&s(kn),M(ft,e),e&&s(In),e&&s(g),e&&s(Sn),M(yt,e),e&&s(_n),e&&s(zt),e&&s(Bn),M(wt,e),e&&s(Rn),e&&s(Pt),e&&s(Gn),e&&s(O),e&&s(Wn),e&&s(le),M(Tt),e&&s(Vn),e&&s(Dt),e&&s(Cn),e&&s(Lt),e&&s($n),e&&s(Kt),e&&s(xn),M(gt,e),e&&s(Fn),e&&s(es),e&&s(An),M(bt,e),e&&s(Nn),e&&s(ts),e&&s(Zn),e&&s(be),e&&s(Yn),e&&s(Ue),e&&s(Hn),e&&s(Ut),e&&s(qn),e&&s(b),e&&s(eo),e&&s(Ee),e&&s(to),e&&s(ve),e&&s(so),M(vt,e),e&&s(ao),e&&s(as),e&&s(lo),M(Jt,e),e&&s(no),e&&s(ls),e&&s(oo),e&&s(Je),e&&s(ro),e&&s(je),e&&s(io),M(jt,e),e&&s(po),e&&s(ns),e&&s(ho),M(kt,e),e&&s(co),e&&s(os),e&&s(mo),e&&s(ne),M(It),e&&s(uo),e&&s(z),e&&s(fo),e&&s(P),e&&s(yo),e&&s(Ie)}}}const Mf={local:"pretrained-models-for-automatic-speech-recognition",sections:[{local:"probing-ctc-models",title:"Probing CTC Models"},{local:"graduation-to-seq2seq",title:"Graduation to Seq2Seq"},{local:"longform-transcription-and-timestamps",title:"Long-Form Transcription and Timestamps"},{local:"summary",title:"Summary"}],title:"Pre-trained models for automatic speech recognition"};function Tf(Lc){return yf(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ef extends hf{constructor(ee){super();cf(this,ee,Tf,wf,df,{})}}export{Ef as default,Mf as metadata};
