Skip to content

Commit

Permalink
Add speecht5 unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Dec 21, 2023
1 parent 381b5eb commit 5da17e0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/pipelines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,14 +912,29 @@ describe('Pipelines', () => {
describe('Text-to-speech generation', () => {

// List all models which will be tested
// TODO: add speecht5 test
const models = [
'Xenova/speecht5_tts',
'facebook/mms-tts-fra',
];

it(models[0], async () => {
let synthesizer = await pipeline('text-to-speech', m(models[0]));

let speaker_embeddings = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin';

{ // Generate English speech
let output = await synthesizer('Hello, my dog is cute', { speaker_embeddings });
expect(output.audio.length).toBeGreaterThan(0);
expect(output.sampling_rate).toEqual(16000);
}

await transcriber.dispose();

}, MAX_TEST_EXECUTION_TIME);

it(models[1], async () => {
let synthesizer = await pipeline('text-to-speech', m(models[1]));

{ // Generate French speech
let output = await synthesizer('Bonjour');
expect(output.audio.length).toBeGreaterThan(0);
Expand Down

0 comments on commit 5da17e0

Please sign in to comment.