veeragoni commited on
Commit
5a79f70
·
verified ·
1 Parent(s): bac8455

Copy of Xenova/speecht5_hifigan @ cf980c3610 (unchanged, mit)

Browse files
Files changed (4) hide show
  1. README.md +22 -0
  2. UPSTREAM_README.md +67 -0
  3. config.json +48 -0
  4. onnx/model_quantized.onnx +3 -0
README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: microsoft/speecht5_hifigan
4
+ tags:
5
+ - chatpanel
6
+ - onnx
7
+ ---
8
+
9
+ # speecht5_hifigan
10
+
11
+ An unchanged copy of [Xenova/speecht5_hifigan](https://huggingface.co/Xenova/speecht5_hifigan) at commit `cf980c3610d7b7f20919960031066ef7905737bd`, hosted by ChatPanel so the ChatPanel gateway downloads the models it runs from one place.
12
+ Nothing here was retrained, converted or edited — the files are byte-for-byte the upstream ones.
13
+
14
+ - **Licence:** `mit`, the upstream licence, unchanged.
15
+ - **Base model:** [microsoft/speecht5_hifigan](https://huggingface.co/microsoft/speecht5_hifigan) — the credit for the model belongs to its authors.
16
+ - **Upstream:** [Xenova/speecht5_hifigan](https://huggingface.co/Xenova/speecht5_hifigan) at commit `cf980c3610d7b7f20919960031066ef7905737bd`.
17
+ - **Upstream model card:** `UPSTREAM_README.md`, kept as published.
18
+
19
+ Files (SHA-256):
20
+
21
+ - `config.json` — `ac281bbb65c617a3fe7c5c082c8106f5a35b14d236b6a12f99cbbb12e576ab96`
22
+ - `onnx/model_quantized.onnx` — `d092ea63bbc7839f7317657b5f531ebb68377ee05ec866ec096dba25911f9feb`
UPSTREAM_README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: microsoft/speecht5_hifigan
3
+ library_name: transformers.js
4
+ ---
5
+
6
+ https://huggingface.co/microsoft/speecht5_hifigan with ONNX weights to be compatible with Transformers.js.
7
+
8
+ ## Usage (Transformers.js)
9
+
10
+ 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/@huggingface/transformers) using:
11
+ ```bash
12
+ npm i @huggingface/transformers
13
+ ```
14
+
15
+ **Example:** Generate speech from text.
16
+ ```js
17
+ import { AutoTokenizer, AutoProcessor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, Tensor } from '@huggingface/transformers';
18
+
19
+ // Load the tokenizer and processor
20
+ const tokenizer = await AutoTokenizer.from_pretrained('Xenova/speecht5_tts');
21
+ const processor = await AutoProcessor.from_pretrained('Xenova/speecht5_tts');
22
+
23
+ // Load the models
24
+ // NOTE: We use the unquantized versions as they are more accurate
25
+ const model = await SpeechT5ForTextToSpeech.from_pretrained('Xenova/speecht5_tts', { dtype: "fp32" }); // Options: "fp32", "fp16", "q8", "q4"
26
+ const vocoder = await SpeechT5HifiGan.from_pretrained('Xenova/speecht5_hifigan', { dtype: "fp32" }); // Options: "fp32", "fp16", "q8", "q4"
27
+
28
+ // Load speaker embeddings from URL
29
+ const speaker_embeddings_data = new Float32Array(
30
+ await (await fetch('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin')).arrayBuffer()
31
+ );
32
+ const speaker_embeddings = new Tensor(
33
+ 'float32',
34
+ speaker_embeddings_data,
35
+ [1, speaker_embeddings_data.length]
36
+ )
37
+
38
+ // Run tokenization
39
+ const { input_ids } = tokenizer('Hello, my dog is cute');
40
+
41
+ // Generate waveform
42
+ const { waveform } = await model.generate_speech(input_ids, speaker_embeddings, { vocoder });
43
+ console.log(waveform);
44
+ // Tensor {
45
+ // dims: [ 26112 ],
46
+ // type: 'float32',
47
+ // size: 26112,
48
+ // data: Float32Array(26112) [ -0.00043630177970044315, -0.00018082228780258447, ... ],
49
+ // }
50
+ ```
51
+
52
+ Optionally, save the audio to a wav file (Node.js):
53
+ ```js
54
+ // Write to file (Node.js)
55
+ import wavefile from 'wavefile';
56
+ import fs from 'fs';
57
+
58
+ const wav = new wavefile.WaveFile();
59
+ wav.fromScratch(1, processor.feature_extractor.config.sampling_rate, '32f', waveform.data);
60
+ fs.writeFileSync('out.wav', wav.toBuffer());
61
+ ```
62
+
63
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/on1ij9Y269ne9zlYN9mdb.wav"></audio>
64
+
65
+ ---
66
+
67
+ 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`).
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SpeechT5HifiGan"
4
+ ],
5
+ "initializer_range": 0.01,
6
+ "leaky_relu_slope": 0.1,
7
+ "model_in_dim": 80,
8
+ "model_type": "hifigan",
9
+ "normalize_before": true,
10
+ "resblock_dilation_sizes": [
11
+ [
12
+ 1,
13
+ 3,
14
+ 5
15
+ ],
16
+ [
17
+ 1,
18
+ 3,
19
+ 5
20
+ ],
21
+ [
22
+ 1,
23
+ 3,
24
+ 5
25
+ ]
26
+ ],
27
+ "resblock_kernel_sizes": [
28
+ 3,
29
+ 7,
30
+ 11
31
+ ],
32
+ "sampling_rate": 16000,
33
+ "torch_dtype": "float32",
34
+ "transformers_version": "4.27.0.dev0",
35
+ "upsample_initial_channel": 512,
36
+ "upsample_kernel_sizes": [
37
+ 8,
38
+ 8,
39
+ 8,
40
+ 8
41
+ ],
42
+ "upsample_rates": [
43
+ 4,
44
+ 4,
45
+ 4,
46
+ 4
47
+ ]
48
+ }
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d092ea63bbc7839f7317657b5f531ebb68377ee05ec866ec096dba25911f9feb
3
+ size 18251672