import{S as ft,i as mt,s as gt,e as s,k as $,w as lt,t as n,M as yt,c as i,d as o,m as P,a as r,x as ht,h as a,b as h,G as e,g as u,y as ct,q as ut,o as pt,B as dt,v as vt}from"../../chunks/vendor-hf-doc-builder.js";import{T as _t}from"../../chunks/Tip-hf-doc-builder.js";import{I as bt}from"../../chunks/IconCopyLink-hf-doc-builder.js";function wt(te){let d,v,m,g,_,T,A,b,S,Y;return{c(){d=n(`In our experience experimenting with the Dutch language, using an MMS TTS checkpoint results in better performance than a
    fine-tuned SpeechT5 one, but you might find that your fine-tuned TTS checkpoint is preferable in your language.
    If you decide to use an MMS TTS checkpoint, you will need to update the `),v=s("a"),m=n("requirements.txt"),g=n(`
    file of your demo to install `),_=s("code"),T=n("transformers"),A=n(` from the PR branch:
    `),b=s("p"),S=s("code"),Y=n("git+https://github.com/hollance/transformers.git@6900e8ba6532162a8613d2270ec2286c3f58f57b"),this.h()},l(l){d=a(l,`In our experience experimenting with the Dutch language, using an MMS TTS checkpoint results in better performance than a
    fine-tuned SpeechT5 one, but you might find that your fine-tuned TTS checkpoint is preferable in your language.
    If you decide to use an MMS TTS checkpoint, you will need to update the `),v=i(l,"A",{href:!0});var y=r(v);m=a(y,"requirements.txt"),y.forEach(o),g=a(l,`
    file of your demo to install `),_=i(l,"CODE",{});var C=r(_);T=a(C,"transformers"),C.forEach(o),A=a(l,` from the PR branch:
    `),b=i(l,"P",{});var p=r(b);S=i(p,"CODE",{});var X=r(S);Y=a(X,"git+https://github.com/hollance/transformers.git@6900e8ba6532162a8613d2270ec2286c3f58f57b"),X.forEach(o),p.forEach(o),this.h()},h(){h(v,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/requirements.txt#L2")},m(l,y){u(l,d,y),u(l,v,y),e(v,m),u(l,g,y),u(l,_,y),e(_,T),u(l,A,y),u(l,b,y),e(b,S),e(S,Y)},d(l){l&&o(d),l&&o(v),l&&o(g),l&&o(_),l&&o(A),l&&o(b)}}}function Tt(te){let d,v,m,g,_,T,A,b,S,Y,l,y,C,p,X,O,he,ce,K,ue,pe,U,de,fe,z,me,ge,oe,M,ye,B,ve,_e,ne,w,be,D,we,Te,I,ke,Ee,V,xe,Se,ae,H,se,f,$e,G,Q,Pe,Ae,W,Ye,Me,F,Z,He,qe,L,ee,Ce,Oe,ie,k,Ue,N,De,Ie,R,Ge,Fe,re;return T=new bt({}),H=new _t({props:{$$slots:{default:[wt]},$$scope:{ctx:te}}}),{c(){d=s("meta"),v=$(),m=s("h1"),g=s("a"),_=s("span"),lt(T.$$.fragment),A=$(),b=s("span"),S=n("Hands-on exercise"),Y=$(),l=s("p"),y=n(`In this Unit, we consolidated the material covered in the previous six units of the course to build three integrated
audio applications. As you\u2019ve experienced, building more involved audio tools is fully within reach by using the
foundational skills you\u2019ve acquired in this course.`),C=$(),p=s("p"),X=n(`The hands-on exercise takes one of the applications covered in this Unit, and extends it with a few multilingual
tweaks \u{1F30D} Your objective is to take the `),O=s("a"),he=n("cascaded speech-to-speech translation Gradio demo"),ce=n(`
from the first section in this Unit, and update it to translate to any `),K=s("strong"),ue=n("non-English"),pe=n(` language. That is to say, the
demo should take speech in language X, and translate it to speech in language Y, where the target language Y is not
English. You should start by `),U=s("a"),de=n("duplicating"),fe=n(`
the template under your Hugging Face namespace. There\u2019s no requirement to use a GPU accelerator device - the free CPU
tier works just fine \u{1F917} However, you should ensure that the visibility of your demo is set to `),z=s("strong"),me=n("public"),ge=n(`. This is required
such that your demo is accessible to us and can thus be checked for correctness.`),oe=$(),M=s("p"),ye=n(`Tips for updating the speech translation function to perform multilingual speech translation are provided in the
section on `),B=s("a"),ve=n("speech-to-speech translation"),_e=n(`. By following these instructions, you should be able
to update the demo to translate from speech in language X to text in language Y, which is half of the task!`),ne=$(),w=s("p"),be=n(`To synthesise from text in language Y to speech in language Y, where Y is a multilingual language, you will need
to use a multilingual TTS checkpoint. For this, you can either use the SpeechT5 TTS checkpoint that you fine-tuned
in the previous hands-on exercise, or a pre-trained multilingual TTS checkpoint. There are two options for pre-trained
checkpoints, either the checkpoint `),D=s("a"),we=n("sanchit-gandhi/speecht5_tts_vox_nl"),Te=n(`,
which is a SpeechT5 checkpoint fine-tuned on the Dutch split of the `),I=s("a"),ke=n("VoxPopuli"),Ee=n(`
dataset, or an MMS TTS checkpoint (see section on `),V=s("a"),xe=n("pretrained models for TTS"),Se=n(")."),ae=$(),lt(H.$$.fragment),se=$(),f=s("p"),$e=n(`Your demo should take as input an audio file, and return as output another audio file, matching the signature of the
`),G=s("a"),Q=s("code"),Pe=n("speech_to_speech_translation"),Ae=n(`
function in the template demo. Therefore, we recommend that you leave the main function `),W=s("code"),Ye=n("speech_to_speech_translation"),Me=n(`
as is, and only update the `),F=s("a"),Z=s("code"),He=n("translate"),qe=n(`
and `),L=s("a"),ee=s("code"),Ce=n("synthesise"),Oe=n(`
functions as required.`),ie=$(),k=s("p"),Ue=n(`Once you have built your demo as a Gradio demo on the Hugging Face Hub, you can submit it for assessment. Head to the
Space `),N=s("a"),De=n("audio-course-u7-assessment"),Ie=n(` and
provide the repository id of your demo when prompted. This Space will check that your demo has been built correctly by
sending a sample audio file to your demo and checking that the returned audio file is indeed non-English. If your demo
works correctly, you\u2019ll get a green tick next to your name on the overall `),R=s("a"),Ge=n("progress space"),Fe=n(" \u2705"),this.h()},l(t){const c=yt('[data-svelte="svelte-1phssyn"]',document.head);d=i(c,"META",{name:!0,content:!0}),c.forEach(o),v=P(t),m=i(t,"H1",{class:!0});var j=r(m);g=i(j,"A",{id:!0,class:!0,href:!0});var Le=r(g);_=i(Le,"SPAN",{});var Ne=r(_);ht(T.$$.fragment,Ne),Ne.forEach(o),Le.forEach(o),A=P(j),b=i(j,"SPAN",{});var Re=r(b);S=a(Re,"Hands-on exercise"),Re.forEach(o),j.forEach(o),Y=P(t),l=i(t,"P",{});var je=r(l);y=a(je,`In this Unit, we consolidated the material covered in the previous six units of the course to build three integrated
audio applications. As you\u2019ve experienced, building more involved audio tools is fully within reach by using the
foundational skills you\u2019ve acquired in this course.`),je.forEach(o),C=P(t),p=i(t,"P",{});var E=r(p);X=a(E,`The hands-on exercise takes one of the applications covered in this Unit, and extends it with a few multilingual
tweaks \u{1F30D} Your objective is to take the `),O=i(E,"A",{href:!0,rel:!0});var Xe=r(O);he=a(Xe,"cascaded speech-to-speech translation Gradio demo"),Xe.forEach(o),ce=a(E,`
from the first section in this Unit, and update it to translate to any `),K=i(E,"STRONG",{});var Be=r(K);ue=a(Be,"non-English"),Be.forEach(o),pe=a(E,` language. That is to say, the
demo should take speech in language X, and translate it to speech in language Y, where the target language Y is not
English. You should start by `),U=i(E,"A",{href:!0,rel:!0});var Ve=r(U);de=a(Ve,"duplicating"),Ve.forEach(o),fe=a(E,`
the template under your Hugging Face namespace. There\u2019s no requirement to use a GPU accelerator device - the free CPU
tier works just fine \u{1F917} However, you should ensure that the visibility of your demo is set to `),z=i(E,"STRONG",{});var Je=r(z);me=a(Je,"public"),Je.forEach(o),ge=a(E,`. This is required
such that your demo is accessible to us and can thus be checked for correctness.`),E.forEach(o),oe=P(t),M=i(t,"P",{});var le=r(M);ye=a(le,`Tips for updating the speech translation function to perform multilingual speech translation are provided in the
section on `),B=i(le,"A",{href:!0});var Ke=r(B);ve=a(Ke,"speech-to-speech translation"),Ke.forEach(o),_e=a(le,`. By following these instructions, you should be able
to update the demo to translate from speech in language X to text in language Y, which is half of the task!`),le.forEach(o),ne=P(t),w=i(t,"P",{});var q=r(w);be=a(q,`To synthesise from text in language Y to speech in language Y, where Y is a multilingual language, you will need
to use a multilingual TTS checkpoint. For this, you can either use the SpeechT5 TTS checkpoint that you fine-tuned
in the previous hands-on exercise, or a pre-trained multilingual TTS checkpoint. There are two options for pre-trained
checkpoints, either the checkpoint `),D=i(q,"A",{href:!0,rel:!0});var ze=r(D);we=a(ze,"sanchit-gandhi/speecht5_tts_vox_nl"),ze.forEach(o),Te=a(q,`,
which is a SpeechT5 checkpoint fine-tuned on the Dutch split of the `),I=i(q,"A",{href:!0,rel:!0});var Qe=r(I);ke=a(Qe,"VoxPopuli"),Qe.forEach(o),Ee=a(q,`
dataset, or an MMS TTS checkpoint (see section on `),V=i(q,"A",{href:!0});var We=r(V);xe=a(We,"pretrained models for TTS"),We.forEach(o),Se=a(q,")."),q.forEach(o),ae=P(t),ht(H.$$.fragment,t),se=P(t),f=i(t,"P",{});var x=r(f);$e=a(x,`Your demo should take as input an audio file, and return as output another audio file, matching the signature of the
`),G=i(x,"A",{href:!0,rel:!0});var Ze=r(G);Q=i(Ze,"CODE",{});var et=r(Q);Pe=a(et,"speech_to_speech_translation"),et.forEach(o),Ze.forEach(o),Ae=a(x,`
function in the template demo. Therefore, we recommend that you leave the main function `),W=i(x,"CODE",{});var tt=r(W);Ye=a(tt,"speech_to_speech_translation"),tt.forEach(o),Me=a(x,`
as is, and only update the `),F=i(x,"A",{href:!0,rel:!0});var ot=r(F);Z=i(ot,"CODE",{});var nt=r(Z);He=a(nt,"translate"),nt.forEach(o),ot.forEach(o),qe=a(x,`
and `),L=i(x,"A",{href:!0,rel:!0});var at=r(L);ee=i(at,"CODE",{});var st=r(ee);Ce=a(st,"synthesise"),st.forEach(o),at.forEach(o),Oe=a(x,`
functions as required.`),x.forEach(o),ie=P(t),k=i(t,"P",{});var J=r(k);Ue=a(J,`Once you have built your demo as a Gradio demo on the Hugging Face Hub, you can submit it for assessment. Head to the
Space `),N=i(J,"A",{href:!0,rel:!0});var it=r(N);De=a(it,"audio-course-u7-assessment"),it.forEach(o),Ie=a(J,` and
provide the repository id of your demo when prompted. This Space will check that your demo has been built correctly by
sending a sample audio file to your demo and checking that the returned audio file is indeed non-English. If your demo
works correctly, you\u2019ll get a green tick next to your name on the overall `),R=i(J,"A",{href:!0,rel:!0});var rt=r(R);Ge=a(rt,"progress space"),rt.forEach(o),Fe=a(J," \u2705"),J.forEach(o),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(kt)),h(g,"id","handson-exercise"),h(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(g,"href","#handson-exercise"),h(m,"class","relative group"),h(O,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation"),h(O,"rel","nofollow"),h(U,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation?duplicate=true"),h(U,"rel","nofollow"),h(B,"href","speech-to-speech"),h(D,"href","https://huggingface.co/sanchit-gandhi/speecht5_tts_vox_nl"),h(D,"rel","nofollow"),h(I,"href","https://huggingface.co/datasets/facebook/voxpopuli"),h(I,"rel","nofollow"),h(V,"href","../chapter6/pre-trained_models"),h(G,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/3946ba6705a6632a63de8672ac52a482ab74b3fc/app.py#L35"),h(G,"rel","nofollow"),h(F,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/app.py#L24"),h(F,"rel","nofollow"),h(L,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/app.py#L29"),h(L,"rel","nofollow"),h(N,"href","https://huggingface.co/spaces/huggingface-course/audio-course-u7-assessment"),h(N,"rel","nofollow"),h(R,"href","https://huggingface.co/spaces/MariaK/Check-my-progress-Audio-Course"),h(R,"rel","nofollow")},m(t,c){e(document.head,d),u(t,v,c),u(t,m,c),e(m,g),e(g,_),ct(T,_,null),e(m,A),e(m,b),e(b,S),u(t,Y,c),u(t,l,c),e(l,y),u(t,C,c),u(t,p,c),e(p,X),e(p,O),e(O,he),e(p,ce),e(p,K),e(K,ue),e(p,pe),e(p,U),e(U,de),e(p,fe),e(p,z),e(z,me),e(p,ge),u(t,oe,c),u(t,M,c),e(M,ye),e(M,B),e(B,ve),e(M,_e),u(t,ne,c),u(t,w,c),e(w,be),e(w,D),e(D,we),e(w,Te),e(w,I),e(I,ke),e(w,Ee),e(w,V),e(V,xe),e(w,Se),u(t,ae,c),ct(H,t,c),u(t,se,c),u(t,f,c),e(f,$e),e(f,G),e(G,Q),e(Q,Pe),e(f,Ae),e(f,W),e(W,Ye),e(f,Me),e(f,F),e(F,Z),e(Z,He),e(f,qe),e(f,L),e(L,ee),e(ee,Ce),e(f,Oe),u(t,ie,c),u(t,k,c),e(k,Ue),e(k,N),e(N,De),e(k,Ie),e(k,R),e(R,Ge),e(k,Fe),re=!0},p(t,[c]){const j={};c&2&&(j.$$scope={dirty:c,ctx:t}),H.$set(j)},i(t){re||(ut(T.$$.fragment,t),ut(H.$$.fragment,t),re=!0)},o(t){pt(T.$$.fragment,t),pt(H.$$.fragment,t),re=!1},d(t){o(d),t&&o(v),t&&o(m),dt(T),t&&o(Y),t&&o(l),t&&o(C),t&&o(p),t&&o(oe),t&&o(M),t&&o(ne),t&&o(w),t&&o(ae),dt(H,t),t&&o(se),t&&o(f),t&&o(ie),t&&o(k)}}}const kt={local:"handson-exercise",title:"Hands-on exercise"};function Et(te){return vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pt extends ft{constructor(d){super();mt(this,d,Et,Tt,gt,{})}}export{Pt as default,kt as metadata};
