elloza commited on
Commit
c5e8937
·
verified ·
1 Parent(s): e2141cd

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -0
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: facebook/mms-tts-mlg
3
+ library_name: transformers.js
4
+ pipeline_tag: text-to-speech
5
+ tags:
6
+ - text-to-audio
7
+ ---
8
+
9
+ https://huggingface.co/facebook/mms-tts-mlg with ONNX weights to be compatible with Transformers.js.
10
+
11
+ ## Usage (Transformers.js)
12
+
13
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@xenova/transformers) using:
14
+ ```bash
15
+ npm i @xenova/transformers
16
+ ```
17
+
18
+ **Example:** Generate Malagasy speech with `elloza/mms-tts-mlg`.
19
+ ```js
20
+ import { pipeline } from '@xenova/transformers';
21
+
22
+ // Create a text-to-speech pipeline
23
+ const synthesizer = await pipeline('text-to-speech', 'elloza/mms-tts-mlg', {
24
+ quantized: false, // Remove this line to use the quantized version (default)
25
+ });
26
+
27
+ // Generate speech
28
+ const output = await synthesizer('manao ahoana');
29
+ console.log(output);
30
+ // {
31
+ // audio: Float32Array(10752) [ ... ],
32
+ // sampling_rate: 16000
33
+ // }
34
+ ```
35
+
36
+ Optionally, save the audio to a wav file (Node.js):
37
+ ```js
38
+ import wavefile from 'wavefile';
39
+ import fs from 'fs';
40
+
41
+ const wav = new wavefile.WaveFile();
42
+ wav.fromScratch(1, output.sampling_rate, '32f', output.audio);
43
+ fs.writeFileSync('out.wav', wav.toBuffer());
44
+ ```
45
+
46
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/-6E56kNCnXUQrLAkR7fuZ.wav"></audio>
47
+
48
+ ---
49
+
50
+ Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).