Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- th
|
4 |
+
tags:
|
5 |
+
- text-to-speech
|
6 |
+
- Thai
|
7 |
+
---
|
8 |
+
โมเดลนี้ใช้ เสียงที่บันทึกจาก Play.ht : https://play.ht/ เพื่อนำมา finetune model.
|
9 |
+
|
10 |
+
Finetune โมเดลโค้ด GitHub : https://github.com/ylacombe/finetune-hf-vits
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
การใช้งาน :
|
15 |
+
```py
|
16 |
+
import torch
|
17 |
+
from transformers import VitsTokenizer, VitsModel, set_seed
|
18 |
+
import scipy
|
19 |
+
|
20 |
+
tokenizer = VitsTokenizer.from_pretrained("VIZINTZOR/MMS-TTS-THAI-MALEV1",cache_dir="./mms")
|
21 |
+
model = VitsModel.from_pretrained("VIZINTZOR/MMS-TTS-THAI-MALEV1",cache_dir="./mms")
|
22 |
+
|
23 |
+
inputs = tokenizer(text="สวัสดีครับ นี่คือการบรรยายภาษาไทย", return_tensors="pt")
|
24 |
+
|
25 |
+
set_seed(456) # make deterministic
|
26 |
+
|
27 |
+
with torch.no_grad():
|
28 |
+
outputs = model(**inputs)
|
29 |
+
|
30 |
+
waveform = outputs.waveform[0]
|
31 |
+
|
32 |
+
# Convert PyTorch tensor to NumPy array
|
33 |
+
waveform_array = waveform.numpy()
|
34 |
+
|
35 |
+
scipy.io.wavfile.write("techno_output.wav", rate=model.config.sampling_rate, data=waveform_array)
|
36 |
+
```
|