feat add readme
Browse files
README.md
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ru
|
4 |
+
tags:
|
5 |
+
- vits
|
6 |
+
license: apache-2.0
|
7 |
+
pipeline_tag: text-to-speech
|
8 |
+
---
|
9 |
+
|
10 |
+
# Text to Speech Russian free multispeaker model
|
11 |
+
|
12 |
+
This is a multiple speakers text-to-speech model for the Russian language. It works on plain text with punctuation separation, and does not require prior conversion of the text into phonemes.
|
13 |
+
The model with multiple speakers has two voices: 0 - woman, 1 - man.
|
14 |
+
|
15 |
+
The text accepts lowercase.
|
16 |
+
|
17 |
+
The model is trained to place accents on her own. But to improve the quality of generation, we recommend putting accents in the text before vowel letters.
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
Usage example using PyTorch:
|
22 |
+
|
23 |
+
```python
|
24 |
+
from transformers import VitsModel, AutoTokenizer
|
25 |
+
import torch
|
26 |
+
import scipy
|
27 |
+
from ruaccent import RUAccent
|
28 |
+
|
29 |
+
device = 'cuda' # 'cpu' or 'cuda'
|
30 |
+
|
31 |
+
speaker = 1 # 0-woman, 1-man
|
32 |
+
|
33 |
+
# load model
|
34 |
+
model_name = "utrobinmv/tts_ru_free_hf_vits_high_multispeaker"
|
35 |
+
|
36 |
+
model = VitsModel.from_pretrained(model_name).to(device)
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
38 |
+
model.eval()
|
39 |
+
|
40 |
+
# text with accents
|
41 |
+
text = """Ночью двадцать тр+етьего июня начал извергаться самый высокий
|
42 |
+
действующий вулк+ан в Евразии - Кл+ючевской. Об этом сообщила руководитель
|
43 |
+
Камчатской группы реагирования на вулканические извержения, ведущий
|
44 |
+
научный сотрудник Института вулканологии и сейсмологии ДВО РАН +Ольга Гирина.
|
45 |
+
«Зафиксированное ночью не просто свечение, а вершинное эксплозивное
|
46 |
+
извержение стромболианского типа. Пока такое извержение никому не опасно:
|
47 |
+
ни населению, ни авиации» пояснила ТАСС госпожа Гирина."""
|
48 |
+
|
49 |
+
# the placement of accents
|
50 |
+
text = text.lower()
|
51 |
+
|
52 |
+
inputs = tokenizer(text, return_tensors="pt")
|
53 |
+
|
54 |
+
with torch.no_grad():
|
55 |
+
output = model(**inputs.to(device), speaker_id=speaker).waveform
|
56 |
+
output = output.detach().cpu().numpy()
|
57 |
+
|
58 |
+
scipy.io.wavfile.write("tts_audio.wav", rate=model.config.sampling_rate,
|
59 |
+
data=output[0])
|
60 |
+
```
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
For displayed in a Jupyter Notebook / Google Colab:
|
65 |
+
|
66 |
+
```python
|
67 |
+
from IPython.display import Audio
|
68 |
+
|
69 |
+
Audio(output, rate=model.config.sampling_rate)
|
70 |
+
```
|
71 |
+
|
72 |
+
##
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
## Languages covered
|
77 |
+
|
78 |
+
Russian (ru_RU)
|