model repo created
Browse files- README.md +247 -0
- added_tokens.json +4 -0
- config.json +91 -0
- female_2.npy +3 -0
- generation_config.json +9 -0
- handler.py +111 -0
- model.safetensors +3 -0
- onnx/decoder_model.onnx +3 -0
- onnx/decoder_model_bnb4.onnx +3 -0
- onnx/decoder_model_fp16.onnx +3 -0
- onnx/decoder_model_int8.onnx +3 -0
- onnx/decoder_model_merged.onnx +3 -0
- onnx/decoder_model_q4.onnx +3 -0
- onnx/decoder_model_q4f16.onnx +3 -0
- onnx/decoder_model_quantized.onnx +3 -0
- onnx/decoder_model_uint8.onnx +3 -0
- onnx/decoder_postnet_and_vocoder.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_bnb4.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_fp16.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_int8.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_q4.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_q4f16.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_quantized.onnx +3 -0
- onnx/decoder_postnet_and_vocoder_uint8.onnx +3 -0
- onnx/decoder_with_past_model.onnx +3 -0
- onnx/decoder_with_past_model_bnb4.onnx +3 -0
- onnx/decoder_with_past_model_fp16.onnx +3 -0
- onnx/decoder_with_past_model_int8.onnx +3 -0
- onnx/decoder_with_past_model_q4.onnx +3 -0
- onnx/decoder_with_past_model_q4f16.onnx +3 -0
- onnx/decoder_with_past_model_quantized.onnx +3 -0
- onnx/decoder_with_past_model_uint8.onnx +3 -0
- onnx/encoder_model.onnx +3 -0
- onnx/encoder_model_bnb4.onnx +3 -0
- onnx/encoder_model_fp16.onnx +3 -0
- onnx/encoder_model_int8.onnx +3 -0
- onnx/encoder_model_q4.onnx +3 -0
- onnx/encoder_model_q4f16.onnx +3 -0
- onnx/encoder_model_quantized.onnx +3 -0
- onnx/encoder_model_uint8.onnx +3 -0
- preprocessor_config.json +19 -0
- pytorch_model.bin +3 -0
- quantize_config.json +17 -0
- requirements.txt +10 -0
- special_tokens_map.json +13 -0
- spm_char.model +3 -0
- tokenizer.json +231 -0
- tokenizer_config.json +63 -0
README.md
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
tags:
|
4 |
+
- audio
|
5 |
+
- text-to-speech
|
6 |
+
datasets:
|
7 |
+
- libritts
|
8 |
+
---
|
9 |
+
|
10 |
+
# SpeechT5 (TTS task)
|
11 |
+
|
12 |
+
SpeechT5 model fine-tuned for speech synthesis (text-to-speech) on LibriTTS.
|
13 |
+
|
14 |
+
This model was introduced in [SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing](https://arxiv.org/abs/2110.07205) by Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
|
15 |
+
|
16 |
+
SpeechT5 was first released in [this repository](https://github.com/microsoft/SpeechT5/), [original weights](https://huggingface.co/mechanicalsea/speecht5-tts). The license used is [MIT](https://github.com/microsoft/SpeechT5/blob/main/LICENSE).
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
## Model Description
|
21 |
+
|
22 |
+
Motivated by the success of T5 (Text-To-Text Transfer Transformer) in pre-trained natural language processing models, we propose a unified-modal SpeechT5 framework that explores the encoder-decoder pre-training for self-supervised speech/text representation learning. The SpeechT5 framework consists of a shared encoder-decoder network and six modal-specific (speech/text) pre/post-nets. After preprocessing the input speech/text through the pre-nets, the shared encoder-decoder network models the sequence-to-sequence transformation, and then the post-nets generate the output in the speech/text modality based on the output of the decoder.
|
23 |
+
|
24 |
+
Leveraging large-scale unlabeled speech and text data, we pre-train SpeechT5 to learn a unified-modal representation, hoping to improve the modeling capability for both speech and text. To align the textual and speech information into this unified semantic space, we propose a cross-modal vector quantization approach that randomly mixes up speech/text states with latent units as the interface between encoder and decoder.
|
25 |
+
|
26 |
+
Extensive evaluations show the superiority of the proposed SpeechT5 framework on a wide variety of spoken language processing tasks, including automatic speech recognition, speech synthesis, speech translation, voice conversion, speech enhancement, and speaker identification.
|
27 |
+
|
28 |
+
- **Developed by:** Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
|
29 |
+
- **Shared by [optional]:** [Matthijs Hollemans](https://huggingface.co/Matthijs)
|
30 |
+
- **Model type:** text-to-speech
|
31 |
+
- **Language(s) (NLP):** [More Information Needed]
|
32 |
+
- **License:** [MIT](https://github.com/microsoft/SpeechT5/blob/main/LICENSE)
|
33 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
34 |
+
|
35 |
+
|
36 |
+
## Model Sources [optional]
|
37 |
+
|
38 |
+
<!-- Provide the basic links for the model. -->
|
39 |
+
|
40 |
+
- **Repository:** [https://github.com/microsoft/SpeechT5/]
|
41 |
+
- **Paper:** [https://arxiv.org/pdf/2110.07205.pdf]
|
42 |
+
- **Blog Post:** [https://huggingface.co/blog/speecht5]
|
43 |
+
- **Demo:** [https://huggingface.co/spaces/Matthijs/speecht5-tts-demo]
|
44 |
+
|
45 |
+
|
46 |
+
# Uses
|
47 |
+
|
48 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
49 |
+
|
50 |
+
## Direct Use
|
51 |
+
|
52 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
53 |
+
|
54 |
+
You can use this model for speech synthesis. See the [model hub](https://huggingface.co/models?search=speecht5) to look for fine-tuned versions on a task that interests you.
|
55 |
+
|
56 |
+
## Downstream Use [optional]
|
57 |
+
|
58 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
59 |
+
|
60 |
+
[More Information Needed]
|
61 |
+
|
62 |
+
## Out-of-Scope Use
|
63 |
+
|
64 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
65 |
+
|
66 |
+
[More Information Needed]
|
67 |
+
|
68 |
+
# Bias, Risks, and Limitations
|
69 |
+
|
70 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
71 |
+
|
72 |
+
[More Information Needed]
|
73 |
+
|
74 |
+
## Recommendations
|
75 |
+
|
76 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
77 |
+
|
78 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
79 |
+
|
80 |
+
|
81 |
+
## How to Get Started With the Model
|
82 |
+
|
83 |
+
Use the code below to convert text into a mono 16 kHz speech waveform.
|
84 |
+
|
85 |
+
```python
|
86 |
+
# Following pip packages need to be installed:
|
87 |
+
# !pip install git+https://github.com/huggingface/transformers sentencepiece datasets
|
88 |
+
|
89 |
+
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
|
90 |
+
from datasets import load_dataset
|
91 |
+
import torch
|
92 |
+
import soundfile as sf
|
93 |
+
from datasets import load_dataset
|
94 |
+
|
95 |
+
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
96 |
+
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|
97 |
+
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
98 |
+
|
99 |
+
inputs = processor(text="Hello, my dog is cute", return_tensors="pt")
|
100 |
+
|
101 |
+
# load xvector containing speaker's voice characteristics from a dataset
|
102 |
+
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
103 |
+
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
104 |
+
|
105 |
+
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
106 |
+
|
107 |
+
sf.write("speech.wav", speech.numpy(), samplerate=16000)
|
108 |
+
```
|
109 |
+
|
110 |
+
### Fine-tuning the Model
|
111 |
+
|
112 |
+
Refer to [this Colab notebook](https://colab.research.google.com/drive/1i7I5pzBcU3WDFarDnzweIj4-sVVoIUFJ) for an example of how to fine-tune SpeechT5 for TTS on a different dataset or a new language.
|
113 |
+
|
114 |
+
# Training Details
|
115 |
+
|
116 |
+
## Training Data
|
117 |
+
|
118 |
+
<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
119 |
+
|
120 |
+
LibriTTS
|
121 |
+
|
122 |
+
## Training Procedure
|
123 |
+
|
124 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
125 |
+
|
126 |
+
### Preprocessing [optional]
|
127 |
+
|
128 |
+
Leveraging large-scale unlabeled speech and text data, we pre-train SpeechT5 to learn a unified-modal representation, hoping to improve the modeling capability for both speech and text.
|
129 |
+
|
130 |
+
|
131 |
+
### Training hyperparameters
|
132 |
+
- **Precision:** [More Information Needed] <!--fp16, bf16, fp8, fp32 -->
|
133 |
+
- **Regime:** [More Information Needed] <!--mixed precision or not -->
|
134 |
+
|
135 |
+
### Speeds, Sizes, Times [optional]
|
136 |
+
|
137 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
# Evaluation
|
142 |
+
|
143 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
144 |
+
|
145 |
+
## Testing Data, Factors & Metrics
|
146 |
+
|
147 |
+
### Testing Data
|
148 |
+
|
149 |
+
<!-- This should link to a Data Card if possible. -->
|
150 |
+
|
151 |
+
[More Information Needed]
|
152 |
+
|
153 |
+
### Factors
|
154 |
+
|
155 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
156 |
+
|
157 |
+
[More Information Needed]
|
158 |
+
|
159 |
+
### Metrics
|
160 |
+
|
161 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
162 |
+
|
163 |
+
[More Information Needed]
|
164 |
+
|
165 |
+
## Results
|
166 |
+
|
167 |
+
[More Information Needed]
|
168 |
+
|
169 |
+
### Summary
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
# Model Examination [optional]
|
174 |
+
|
175 |
+
<!-- Relevant interpretability work for the model goes here -->
|
176 |
+
|
177 |
+
Extensive evaluations show the superiority of the proposed SpeechT5 framework on a wide variety of spoken language processing tasks, including automatic speech recognition, speech synthesis, speech translation, voice conversion, speech enhancement, and speaker identification.
|
178 |
+
|
179 |
+
# Environmental Impact
|
180 |
+
|
181 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
182 |
+
|
183 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
184 |
+
|
185 |
+
- **Hardware Type:** [More Information Needed]
|
186 |
+
- **Hours used:** [More Information Needed]
|
187 |
+
- **Cloud Provider:** [More Information Needed]
|
188 |
+
- **Compute Region:** [More Information Needed]
|
189 |
+
- **Carbon Emitted:** [More Information Needed]
|
190 |
+
|
191 |
+
# Technical Specifications [optional]
|
192 |
+
|
193 |
+
## Model Architecture and Objective
|
194 |
+
|
195 |
+
The SpeechT5 framework consists of a shared encoder-decoder network and six modal-specific (speech/text) pre/post-nets.
|
196 |
+
|
197 |
+
After preprocessing the input speech/text through the pre-nets, the shared encoder-decoder network models the sequence-to-sequence transformation, and then the post-nets generate the output in the speech/text modality based on the output of the decoder.
|
198 |
+
|
199 |
+
## Compute Infrastructure
|
200 |
+
|
201 |
+
[More Information Needed]
|
202 |
+
|
203 |
+
### Hardware
|
204 |
+
|
205 |
+
[More Information Needed]
|
206 |
+
|
207 |
+
### Software
|
208 |
+
|
209 |
+
[More Information Needed]
|
210 |
+
|
211 |
+
# Citation [optional]
|
212 |
+
|
213 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
214 |
+
|
215 |
+
**BibTeX:**
|
216 |
+
|
217 |
+
```bibtex
|
218 |
+
@inproceedings{ao-etal-2022-speecht5,
|
219 |
+
title = {{S}peech{T}5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing},
|
220 |
+
author = {Ao, Junyi and Wang, Rui and Zhou, Long and Wang, Chengyi and Ren, Shuo and Wu, Yu and Liu, Shujie and Ko, Tom and Li, Qing and Zhang, Yu and Wei, Zhihua and Qian, Yao and Li, Jinyu and Wei, Furu},
|
221 |
+
booktitle = {Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
|
222 |
+
month = {May},
|
223 |
+
year = {2022},
|
224 |
+
pages={5723--5738},
|
225 |
+
}
|
226 |
+
```
|
227 |
+
|
228 |
+
# Glossary [optional]
|
229 |
+
|
230 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
231 |
+
|
232 |
+
- **text-to-speech** to synthesize audio
|
233 |
+
|
234 |
+
# More Information [optional]
|
235 |
+
|
236 |
+
[More Information Needed]
|
237 |
+
|
238 |
+
# Model Card Authors [optional]
|
239 |
+
|
240 |
+
Disclaimer: The team releasing SpeechT5 did not write a model card for this model so this model card has been written by the Hugging Face team.
|
241 |
+
|
242 |
+
# Model Card Contact
|
243 |
+
|
244 |
+
[More Information Needed]
|
245 |
+
|
246 |
+
|
247 |
+
|
added_tokens.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<ctc_blank>": 80,
|
3 |
+
"<mask>": 79
|
4 |
+
}
|
config.json
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "openpecha/speecht5-tts-01",
|
3 |
+
"activation_dropout": 0.1,
|
4 |
+
"apply_spec_augment": true,
|
5 |
+
"architectures": [
|
6 |
+
"SpeechT5ForTextToSpeech"
|
7 |
+
],
|
8 |
+
"attention_dropout": 0.1,
|
9 |
+
"bos_token_id": 0,
|
10 |
+
"conv_bias": false,
|
11 |
+
"conv_dim": [
|
12 |
+
512,
|
13 |
+
512,
|
14 |
+
512,
|
15 |
+
512,
|
16 |
+
512,
|
17 |
+
512,
|
18 |
+
512
|
19 |
+
],
|
20 |
+
"conv_kernel": [
|
21 |
+
10,
|
22 |
+
3,
|
23 |
+
3,
|
24 |
+
3,
|
25 |
+
3,
|
26 |
+
2,
|
27 |
+
2
|
28 |
+
],
|
29 |
+
"conv_stride": [
|
30 |
+
5,
|
31 |
+
2,
|
32 |
+
2,
|
33 |
+
2,
|
34 |
+
2,
|
35 |
+
2,
|
36 |
+
2
|
37 |
+
],
|
38 |
+
"decoder_attention_heads": 12,
|
39 |
+
"decoder_ffn_dim": 3072,
|
40 |
+
"decoder_layerdrop": 0.1,
|
41 |
+
"decoder_layers": 6,
|
42 |
+
"decoder_start_token_id": 2,
|
43 |
+
"encoder_attention_heads": 12,
|
44 |
+
"encoder_ffn_dim": 3072,
|
45 |
+
"encoder_layerdrop": 0.1,
|
46 |
+
"encoder_layers": 12,
|
47 |
+
"encoder_max_relative_position": 160,
|
48 |
+
"eos_token_id": 2,
|
49 |
+
"feat_extract_activation": "gelu",
|
50 |
+
"feat_extract_norm": "group",
|
51 |
+
"feat_proj_dropout": 0.0,
|
52 |
+
"guided_attention_loss_num_heads": 2,
|
53 |
+
"guided_attention_loss_scale": 10.0,
|
54 |
+
"guided_attention_loss_sigma": 0.4,
|
55 |
+
"hidden_act": "gelu",
|
56 |
+
"hidden_dropout": 0.1,
|
57 |
+
"hidden_size": 768,
|
58 |
+
"initializer_range": 0.02,
|
59 |
+
"is_encoder_decoder": true,
|
60 |
+
"layer_norm_eps": 1e-05,
|
61 |
+
"mask_feature_length": 10,
|
62 |
+
"mask_feature_min_masks": 0,
|
63 |
+
"mask_feature_prob": 0.0,
|
64 |
+
"mask_time_length": 10,
|
65 |
+
"mask_time_min_masks": 2,
|
66 |
+
"mask_time_prob": 0.05,
|
67 |
+
"max_length": 1876,
|
68 |
+
"max_speech_positions": 1876,
|
69 |
+
"max_text_positions": 600,
|
70 |
+
"model_type": "speecht5",
|
71 |
+
"num_conv_pos_embedding_groups": 16,
|
72 |
+
"num_conv_pos_embeddings": 128,
|
73 |
+
"num_feat_extract_layers": 7,
|
74 |
+
"num_mel_bins": 80,
|
75 |
+
"pad_token_id": 1,
|
76 |
+
"positional_dropout": 0.1,
|
77 |
+
"reduction_factor": 2,
|
78 |
+
"scale_embedding": false,
|
79 |
+
"speaker_embedding_dim": 512,
|
80 |
+
"speech_decoder_postnet_dropout": 0.5,
|
81 |
+
"speech_decoder_postnet_kernel": 5,
|
82 |
+
"speech_decoder_postnet_layers": 5,
|
83 |
+
"speech_decoder_postnet_units": 256,
|
84 |
+
"speech_decoder_prenet_dropout": 0.5,
|
85 |
+
"speech_decoder_prenet_layers": 2,
|
86 |
+
"speech_decoder_prenet_units": 256,
|
87 |
+
"transformers_version": "4.43.4",
|
88 |
+
"use_cache": false,
|
89 |
+
"use_guided_attention_loss": true,
|
90 |
+
"vocab_size": 81
|
91 |
+
}
|
female_2.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9f46af6a5a6cc28b286a793c675203a3ba922648a7c3df25307d1ecfc86870e6
|
3 |
+
size 2176
|
generation_config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"decoder_start_token_id": 2,
|
5 |
+
"eos_token_id": 2,
|
6 |
+
"max_length": 1876,
|
7 |
+
"pad_token_id": 1,
|
8 |
+
"transformers_version": "4.43.4"
|
9 |
+
}
|
handler.py
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict, Any,Union
|
2 |
+
import tempfile
|
3 |
+
import numpy as np
|
4 |
+
import torch
|
5 |
+
import pyewts
|
6 |
+
import noisereduce as nr
|
7 |
+
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
|
8 |
+
from num2tib.core import convert
|
9 |
+
from num2tib.core import convert2text
|
10 |
+
import soundfile as sf
|
11 |
+
import base64
|
12 |
+
import re
|
13 |
+
import requests
|
14 |
+
import os
|
15 |
+
from pydub import AudioSegment
|
16 |
+
|
17 |
+
converter = pyewts.pyewts()
|
18 |
+
def download_file(url, destination):
|
19 |
+
response = requests.get(url)
|
20 |
+
with open(destination, 'wb') as file:
|
21 |
+
file.write(response.content)
|
22 |
+
|
23 |
+
# Example usage:
|
24 |
+
download_file('https://huggingface.co/openpecha/speecht5-tts-01/resolve/main/female_2.npy', 'female_2.npy')
|
25 |
+
def replace_numbers_with_convert(sentence, wylie=True):
|
26 |
+
pattern = r'\d+(\.\d+)?'
|
27 |
+
def replace(match):
|
28 |
+
return convert(match.group(), wylie)
|
29 |
+
result = re.sub(pattern, replace, sentence)
|
30 |
+
|
31 |
+
return result
|
32 |
+
|
33 |
+
def cleanup_text(inputs):
|
34 |
+
for src, dst in replacements:
|
35 |
+
inputs = inputs.replace(src, dst)
|
36 |
+
return inputs
|
37 |
+
|
38 |
+
speaker_embeddings = {
|
39 |
+
"Lhasa(female)": "female_2.npy",
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
replacements = [
|
44 |
+
('_', '_'),
|
45 |
+
('*', 'v'),
|
46 |
+
('`', ';'),
|
47 |
+
('~', ','),
|
48 |
+
('+', ','),
|
49 |
+
('\\', ';'),
|
50 |
+
('|', ';'),
|
51 |
+
('╚',''),
|
52 |
+
('╗','')
|
53 |
+
]
|
54 |
+
|
55 |
+
class EndpointHandler():
|
56 |
+
def __init__(self, path=""):
|
57 |
+
# load the model
|
58 |
+
self.processor = SpeechT5Processor.from_pretrained("TenzinGayche/TTS_run3_ep20_174k_b")
|
59 |
+
self.model = SpeechT5ForTextToSpeech.from_pretrained("TenzinGayche/TTS_run3_ep20_174k_b")
|
60 |
+
self.model.to('cuda')
|
61 |
+
self.vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
62 |
+
|
63 |
+
|
64 |
+
def __call__(self, data: Dict[str, Any]) -> Dict[str, Union[int, str]]:
|
65 |
+
"""_summary_
|
66 |
+
|
67 |
+
Args:
|
68 |
+
data (Dict[str, Any]): _description_
|
69 |
+
|
70 |
+
Returns:
|
71 |
+
bytes: _description_
|
72 |
+
"""
|
73 |
+
text = data.pop("inputs",data)
|
74 |
+
|
75 |
+
# process input
|
76 |
+
|
77 |
+
if len(text.strip()) == 0:
|
78 |
+
return (16000, np.zeros(0).astype(np.int16))
|
79 |
+
text = converter.toWylie(text)
|
80 |
+
text=cleanup_text(text)
|
81 |
+
text=replace_numbers_with_convert(text)
|
82 |
+
inputs = self.processor(text=text, return_tensors="pt")
|
83 |
+
input_ids = inputs["input_ids"]
|
84 |
+
input_ids = input_ids[..., :self.model.config.max_text_positions]
|
85 |
+
speaker_embedding = np.load(speaker_embeddings['Lhasa(female)'])
|
86 |
+
speaker_embedding = torch.tensor(speaker_embedding)
|
87 |
+
speech = self.model.generate_speech(input_ids.to('cuda'), speaker_embedding.to('cuda'), vocoder=self.vocoder.to('cuda'))
|
88 |
+
speech = nr.reduce_noise(y=speech.to('cpu'), sr=16000)
|
89 |
+
# Create a unique temporary WAV file
|
90 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as temp_wav_file:
|
91 |
+
temp_wav_path = temp_wav_file.name
|
92 |
+
sf.write(temp_wav_path, speech, 16000, 'PCM_24') # Use sf.write to write the WAV file
|
93 |
+
|
94 |
+
# Read the WAV file and encode it as base64
|
95 |
+
with open(temp_wav_path, "rb") as wav_file:
|
96 |
+
audio_base64 = base64.b64encode(wav_file.read()).decode("utf-8")
|
97 |
+
|
98 |
+
# Clean up the temporary WAV file
|
99 |
+
os.remove(temp_wav_path)
|
100 |
+
|
101 |
+
return {
|
102 |
+
"sample_rate": 16000,
|
103 |
+
"audio_base64": audio_base64, # Base64-encoded audio data
|
104 |
+
"model": "openpecha/speecht5-tts-01",
|
105 |
+
"model_version": "1"
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a18d13c81eadc1f1ad894772903c6cfde410567590110c7340fa37ed8e4d9f19
|
3 |
+
size 577789320
|
onnx/decoder_model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c5861f41a72751e029b6393b15211f08e93396f3b71fa77932cd8c688c07c669
|
3 |
+
size 238389463
|
onnx/decoder_model_bnb4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75965505976673c4e0f78e920078b7ae862e6e6c61eaf27640f99d5bfe4dd4ce
|
3 |
+
size 38979403
|
onnx/decoder_model_fp16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e76cc47e78a7861a1746e1002969fa58bd5b1c79ff40709d79e4106b4ff38533
|
3 |
+
size 119305248
|
onnx/decoder_model_int8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:823e31c2b3966968d28492b05788a00f5d4f53ea4e7ef1d8b8086cc0583a4855
|
3 |
+
size 64743535
|
onnx/decoder_model_merged.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0d82ffd7cf107ea32d36f44992a3b25c39f3bc23899fec620395834dcee5296b
|
3 |
+
size 244349167
|
onnx/decoder_model_q4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e3353cacdf5535b891faf6fa779ac72b9a5d9709c204e05ec618477c142e09d
|
3 |
+
size 42607312
|
onnx/decoder_model_q4f16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89e2155435bc07c1683b38a459886ac9badacbc4d89873829285c205e403c460
|
3 |
+
size 35923480
|
onnx/decoder_model_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:823e31c2b3966968d28492b05788a00f5d4f53ea4e7ef1d8b8086cc0583a4855
|
3 |
+
size 64743535
|
onnx/decoder_model_uint8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e87f23d34ae2bfecb3301537613767cfa41c0281017b1eeb3433417fbadd8b2e
|
3 |
+
size 64743535
|
onnx/decoder_postnet_and_vocoder.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dbd965cb53a619b9820021710da77705bc5e08a264c1ced65d9f593678d7f13f
|
3 |
+
size 55455058
|
onnx/decoder_postnet_and_vocoder_bnb4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:509fb2a028bed47ab8afa21c70244d5ff1616348ea314d2e16a2da213c4f09ac
|
3 |
+
size 55455077
|
onnx/decoder_postnet_and_vocoder_fp16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f23dac8d29895f90ec03b7b03faa60f54f31d4ec405220e479736faaf16b0829
|
3 |
+
size 27759944
|
onnx/decoder_postnet_and_vocoder_int8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c97a30c295be29e1e06faef052be223ebbbcf163d20caa2f990aba929fcb2543
|
3 |
+
size 18254997
|
onnx/decoder_postnet_and_vocoder_q4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:509fb2a028bed47ab8afa21c70244d5ff1616348ea314d2e16a2da213c4f09ac
|
3 |
+
size 55455077
|
onnx/decoder_postnet_and_vocoder_q4f16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0db130e43cf870bede3f3cec1d064164c9abdbdf0978896daf47e6c43da4b089
|
3 |
+
size 27759963
|
onnx/decoder_postnet_and_vocoder_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:517a7a241890dbb33388cc9f09907771ac0411882d7c209e1c999246eda60ead
|
3 |
+
size 18254997
|
onnx/decoder_postnet_and_vocoder_uint8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:517a7a241890dbb33388cc9f09907771ac0411882d7c209e1c999246eda60ead
|
3 |
+
size 18254997
|
onnx/decoder_with_past_model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:314c8c93212125832988780bd65b2fbf7b244dd8197aac5069c96c3c79a3c9da
|
3 |
+
size 210030510
|
onnx/decoder_with_past_model_bnb4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:397236d5cb7432415ee0fe93376e0e3c9de1e75ce96f6481d2300ed052c3697c
|
3 |
+
size 34948830
|
onnx/decoder_with_past_model_fp16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4bcaad87f2b1aba003f93dc2ec867e7256938a4d0a7758169fba04e9e34ef919
|
3 |
+
size 105123157
|
onnx/decoder_with_past_model_int8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:405ea15db995fe2bf5122c98cf6c117fdd75c0e5ebbd892fd52809a94d76e744
|
3 |
+
size 57560019
|
onnx/decoder_with_past_model_q4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5961f1cb633809a1b0965417e9dff848c9966aa8c785dc198196baaa0e6625be
|
3 |
+
size 38134455
|
onnx/decoder_with_past_model_q4f16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b0aff61cda451eb260e1a63b523bdd9cddf3c86254fe996d70a3eef1699bb269
|
3 |
+
size 31914053
|
onnx/decoder_with_past_model_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:405ea15db995fe2bf5122c98cf6c117fdd75c0e5ebbd892fd52809a94d76e744
|
3 |
+
size 57560019
|
onnx/decoder_with_past_model_uint8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:97537ef63ab98325eb11a5fed9964afbc9252b84b59bfc9344d485b11ef156be
|
3 |
+
size 57560019
|
onnx/encoder_model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a68bf8abf2b005b31d32a829efac70bda5357536e0045c5da62b1faf82d0bf0d
|
3 |
+
size 342759185
|
onnx/encoder_model_bnb4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca032a5b440875d2b3222a5f26ab10458aac6f68b7fe0e1419c7dcb93bb9ac33
|
3 |
+
size 50807507
|
onnx/encoder_model_fp16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:10215f235aac5572d07086e1eb421d0263111763af1909b1885024f26950234b
|
3 |
+
size 171559930
|
onnx/encoder_model_int8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2e3bef7d3297b1da9cdf809f7beee23c6ff6a1ac47389f2f425f77ee315eeb3d
|
3 |
+
size 88227663
|
onnx/encoder_model_q4.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:943f37c68b24359c89e7f09a1c29e62c5a00f5025dabf706f24ebc6437b61aa5
|
3 |
+
size 56115395
|
onnx/encoder_model_q4f16.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b8c93002dd58c0ff7fe5cbcc3344138bb139baeee4df3f57d09554c850abd63
|
3 |
+
size 49477133
|
onnx/encoder_model_quantized.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2e3bef7d3297b1da9cdf809f7beee23c6ff6a1ac47389f2f425f77ee315eeb3d
|
3 |
+
size 88227663
|
onnx/encoder_model_uint8.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a34759f65d5d7ba531cea2642b2be005a26dffc8dd9767f00f3abde6953c0c7d
|
3 |
+
size 88227663
|
preprocessor_config.json
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_normalize": false,
|
3 |
+
"feature_extractor_type": "SpeechT5FeatureExtractor",
|
4 |
+
"feature_size": 1,
|
5 |
+
"fmax": 7600,
|
6 |
+
"fmin": 80,
|
7 |
+
"frame_signal_scale": 1.0,
|
8 |
+
"hop_length": 16,
|
9 |
+
"mel_floor": 1e-10,
|
10 |
+
"num_mel_bins": 80,
|
11 |
+
"padding_side": "right",
|
12 |
+
"padding_value": 0.0,
|
13 |
+
"processor_class": "SpeechT5Processor",
|
14 |
+
"reduction_factor": 2,
|
15 |
+
"return_attention_mask": true,
|
16 |
+
"sampling_rate": 16000,
|
17 |
+
"win_function": "hann_window",
|
18 |
+
"win_length": 64
|
19 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0286da88000d1b9cbf4e402accd2556bd298c3124e1b873f6957ee82419b289e
|
3 |
+
size 577872765
|
quantize_config.json
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"modes": [
|
3 |
+
"fp16",
|
4 |
+
"q8",
|
5 |
+
"int8",
|
6 |
+
"uint8",
|
7 |
+
"q4",
|
8 |
+
"q4f16",
|
9 |
+
"bnb4"
|
10 |
+
],
|
11 |
+
"per_channel": true,
|
12 |
+
"reduce_range": true,
|
13 |
+
"block_size": null,
|
14 |
+
"is_symmetric": true,
|
15 |
+
"accuracy_level": null,
|
16 |
+
"quant_type": 1
|
17 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
git+https://github.com/TenzinGayche/num2tib.git
|
2 |
+
numpy
|
3 |
+
pyewts
|
4 |
+
noisereduce
|
5 |
+
transformers
|
6 |
+
SentencePiece
|
7 |
+
torch
|
8 |
+
requests
|
9 |
+
soundfile
|
10 |
+
pydub
|
special_tokens_map.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"mask_token": {
|
5 |
+
"content": "<mask>",
|
6 |
+
"lstrip": true,
|
7 |
+
"normalized": true,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false
|
10 |
+
},
|
11 |
+
"pad_token": "<pad>",
|
12 |
+
"unk_token": "<unk>"
|
13 |
+
}
|
spm_char.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fcc48f3e225f627b1641db410ceb0c8649bd2b0c982e150b03f8be3728ab560
|
3 |
+
size 238473
|
tokenizer.json
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": "1.0",
|
3 |
+
"truncation": null,
|
4 |
+
"padding": null,
|
5 |
+
"added_tokens": [
|
6 |
+
{
|
7 |
+
"id": 0,
|
8 |
+
"content": "<s>",
|
9 |
+
"single_word": false,
|
10 |
+
"lstrip": false,
|
11 |
+
"rstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"special": true
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"id": 1,
|
17 |
+
"content": "<pad>",
|
18 |
+
"single_word": false,
|
19 |
+
"lstrip": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"normalized": false,
|
22 |
+
"special": true
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"id": 2,
|
26 |
+
"content": "</s>",
|
27 |
+
"single_word": false,
|
28 |
+
"lstrip": false,
|
29 |
+
"rstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"special": true
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"id": 3,
|
35 |
+
"content": "<unk>",
|
36 |
+
"single_word": false,
|
37 |
+
"lstrip": false,
|
38 |
+
"rstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"special": true
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"id": 79,
|
44 |
+
"content": "<mask>",
|
45 |
+
"single_word": false,
|
46 |
+
"lstrip": false,
|
47 |
+
"rstrip": false,
|
48 |
+
"normalized": false,
|
49 |
+
"special": true
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"id": 80,
|
53 |
+
"content": "<ctc_blank>",
|
54 |
+
"single_word": false,
|
55 |
+
"lstrip": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"normalized": false,
|
58 |
+
"special": true
|
59 |
+
}
|
60 |
+
],
|
61 |
+
"normalizer": {
|
62 |
+
"type": "Precompiled",
|
63 |
+
"precompiled_charsmap": null
|
64 |
+
},
|
65 |
+
"pre_tokenizer": {
|
66 |
+
"type": "Sequence",
|
67 |
+
"pretokenizers": [
|
68 |
+
{
|
69 |
+
"type": "WhitespaceSplit"
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"type": "Metaspace",
|
73 |
+
"replacement": "\u2581",
|
74 |
+
"add_prefix_space": true
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"type": "Split",
|
78 |
+
"pattern": {
|
79 |
+
"Regex": ""
|
80 |
+
},
|
81 |
+
"behavior": "Isolated",
|
82 |
+
"invert": false
|
83 |
+
}
|
84 |
+
]
|
85 |
+
},
|
86 |
+
"post_processor": {
|
87 |
+
"type": "TemplateProcessing",
|
88 |
+
"single": [
|
89 |
+
{
|
90 |
+
"Sequence": {
|
91 |
+
"id": "A",
|
92 |
+
"type_id": 0
|
93 |
+
}
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"SpecialToken": {
|
97 |
+
"id": "</s>",
|
98 |
+
"type_id": 0
|
99 |
+
}
|
100 |
+
}
|
101 |
+
],
|
102 |
+
"pair": [
|
103 |
+
{
|
104 |
+
"Sequence": {
|
105 |
+
"id": "A",
|
106 |
+
"type_id": 0
|
107 |
+
}
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"SpecialToken": {
|
111 |
+
"id": "</s>",
|
112 |
+
"type_id": 0
|
113 |
+
}
|
114 |
+
},
|
115 |
+
{
|
116 |
+
"Sequence": {
|
117 |
+
"id": "B",
|
118 |
+
"type_id": 0
|
119 |
+
}
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"SpecialToken": {
|
123 |
+
"id": "</s>",
|
124 |
+
"type_id": 0
|
125 |
+
}
|
126 |
+
}
|
127 |
+
],
|
128 |
+
"special_tokens": {
|
129 |
+
"</s>": {
|
130 |
+
"id": "</s>",
|
131 |
+
"ids": [
|
132 |
+
2
|
133 |
+
],
|
134 |
+
"tokens": [
|
135 |
+
"</s>"
|
136 |
+
]
|
137 |
+
}
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"decoder": {
|
141 |
+
"type": "Metaspace",
|
142 |
+
"replacement": "\u2581",
|
143 |
+
"add_prefix_space": true
|
144 |
+
},
|
145 |
+
"model": {
|
146 |
+
"unk_id": 2,
|
147 |
+
"vocab": {
|
148 |
+
"<s>": 0,
|
149 |
+
"<pad>": 1,
|
150 |
+
"</s>": 2,
|
151 |
+
"<unk>": 3,
|
152 |
+
"\u2581": 4,
|
153 |
+
"e": 5,
|
154 |
+
"t": 6,
|
155 |
+
"a": 7,
|
156 |
+
"o": 8,
|
157 |
+
"n": 9,
|
158 |
+
"i": 10,
|
159 |
+
"h": 11,
|
160 |
+
"s": 12,
|
161 |
+
"r": 13,
|
162 |
+
"d": 14,
|
163 |
+
"l": 15,
|
164 |
+
"u": 16,
|
165 |
+
"c": 17,
|
166 |
+
"m": 18,
|
167 |
+
"f": 19,
|
168 |
+
"w": 20,
|
169 |
+
"g": 21,
|
170 |
+
"y": 22,
|
171 |
+
",": 23,
|
172 |
+
"p": 24,
|
173 |
+
"b": 25,
|
174 |
+
".": 26,
|
175 |
+
"v": 27,
|
176 |
+
"k": 28,
|
177 |
+
"\"": 29,
|
178 |
+
"I": 30,
|
179 |
+
"'": 31,
|
180 |
+
"T": 32,
|
181 |
+
"A": 33,
|
182 |
+
"S": 34,
|
183 |
+
"H": 35,
|
184 |
+
";": 36,
|
185 |
+
"x": 37,
|
186 |
+
"W": 38,
|
187 |
+
"-": 39,
|
188 |
+
"B": 40,
|
189 |
+
"?": 41,
|
190 |
+
"C": 42,
|
191 |
+
"M": 43,
|
192 |
+
"!": 44,
|
193 |
+
"q": 45,
|
194 |
+
"j": 46,
|
195 |
+
"E": 47,
|
196 |
+
"N": 48,
|
197 |
+
"P": 49,
|
198 |
+
"O": 50,
|
199 |
+
"D": 51,
|
200 |
+
"L": 52,
|
201 |
+
"G": 53,
|
202 |
+
"R": 54,
|
203 |
+
"F": 55,
|
204 |
+
"Y": 56,
|
205 |
+
"z": 57,
|
206 |
+
"J": 58,
|
207 |
+
":": 59,
|
208 |
+
"K": 60,
|
209 |
+
"U": 61,
|
210 |
+
"V": 62,
|
211 |
+
")": 63,
|
212 |
+
"(": 64,
|
213 |
+
"Q": 65,
|
214 |
+
"Z": 66,
|
215 |
+
"]": 67,
|
216 |
+
"[": 68,
|
217 |
+
"X": 69,
|
218 |
+
"\u2014": 70,
|
219 |
+
"/": 71,
|
220 |
+
"\u00e6": 72,
|
221 |
+
"\u00e9": 73,
|
222 |
+
"{": 74,
|
223 |
+
"}": 75,
|
224 |
+
"\u00ea": 76,
|
225 |
+
"\u0153": 77,
|
226 |
+
"\u0304": 78,
|
227 |
+
"<mask>": 79,
|
228 |
+
"<ctc_blank>": 80
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "<s>",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"1": {
|
12 |
+
"content": "<pad>",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"2": {
|
20 |
+
"content": "</s>",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"3": {
|
28 |
+
"content": "<unk>",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"79": {
|
36 |
+
"content": "<mask>",
|
37 |
+
"lstrip": true,
|
38 |
+
"normalized": true,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
},
|
43 |
+
"80": {
|
44 |
+
"content": "<ctc_blank>",
|
45 |
+
"lstrip": false,
|
46 |
+
"normalized": true,
|
47 |
+
"rstrip": false,
|
48 |
+
"single_word": false,
|
49 |
+
"special": false
|
50 |
+
}
|
51 |
+
},
|
52 |
+
"bos_token": "<s>",
|
53 |
+
"clean_up_tokenization_spaces": true,
|
54 |
+
"eos_token": "</s>",
|
55 |
+
"mask_token": "<mask>",
|
56 |
+
"model_max_length": 600,
|
57 |
+
"normalize": false,
|
58 |
+
"pad_token": "<pad>",
|
59 |
+
"processor_class": "SpeechT5Processor",
|
60 |
+
"sp_model_kwargs": {},
|
61 |
+
"tokenizer_class": "SpeechT5Tokenizer",
|
62 |
+
"unk_token": "<unk>"
|
63 |
+
}
|