OmniVoice-Taigi-SuiSiann
Taiwanese Taigi (Hokkien, Min-nan) Text-to-Speech ・ 台語語音合成模型
A text-to-speech model for Taiwanese Taigi (Hokkien, Min-nan). It takes Tâi-lô romanization as input and produces 24 kHz speech.
台語(臺灣閩南語)的語音合成模型。輸入台羅拼音,輸出 24 kHz 的語音。
The model is OmniVoice fine-tuned on the SuíSiann dataset, a single-speaker corpus recorded by Ms. Ông Siù-iông (王秀容).
這個模型是用 SuíSiann 資料集 微調 OmniVoice 得到的。SuíSiann 是單一語者的語料,由王秀容(Ông Siù-iông)女士錄製。
Samples 範例
All clips below are synthesized by this model. Each sentence was generated once with a fixed seed (1234), without cherry-picking.
下面的音檔都是這個模型合成的。每一句只合成一次,亂數種子固定為 1234,沒有挑選。
Text-to-Speech 一般語音合成
| Input 輸入 | Audio 音檔 |
|---|---|
Lí hó, guá sī ē-hiáu kóng Tâi-gí ê gí-im ha̍p-sîng bôo-hîng.Hello, I am a speech synthesis model that can speak Taiwanese.你好,我是會講台語的語音合成模型。 | |
Bîn-á-tsài nā bô lo̍h-hōo, lán tsò-hué khì hái-pinn tshit-thô.If it doesn't rain tomorrow, let's go to the beach together.明天如果沒下雨,我們一起去海邊玩。 | |
Lí tsia̍h-pá--buē? Beh lim tê--bô?Have you eaten? Would you like some tea?你吃飽了嗎?要喝茶嗎? | |
Tâi-uân sī tsi̍t ê tsin suí ê sóo-tsāi. Tsia ū kuân-kuân ê suann, mā ū tshim-tshim ê hái. Huan-gîng ta̍k-ke lâi Tâi-uân tshit-thô.Taiwan is a beautiful place. It has tall mountains and deep seas. Everyone is welcome to visit.台灣是一個很美的地方。這裡有高高的山,也有深深的海。歡迎大家來台灣玩。 | |
Khuànn hî-á tī-hia siû-lâi-siû-khì, siû-lâi-siû-khì, guá tuì lí siūnn-lâi-siūnn-khì, siūnn-lâi-siūnn-khì, tsit-kuí-tang guá-ê phah-piànn kah jīn-tsin, lóng-sī in-uī lí.Excerpt from the lyrics of 〈魚仔〉 by Crowd Lu.節錄自盧廣仲〈魚仔〉的歌詞。 |
Speed Control and Tags 語速控制與標籤
Pass speed to change the speaking rate. Put a tag such as [laughter] in the text to add a non-verbal sound.
用 speed 調整語速。在文字裡寫 [laughter] 這類標籤,可以加入非語言的聲音。
| Input 輸入 | Audio 音檔 |
|---|---|
speed=0.8 (slower 放慢)Bîn-á-tsài nā bô lo̍h-hōo, lán tsò-hué khì hái-pinn tshit-thô. | |
speed=1.3 (faster 加快)Bîn-á-tsài nā bô lo̍h-hōo, lán tsò-hué khì hái-pinn tshit-thô. | |
[laughter] tag 標籤[laughter] Lí kóng ê tāi-tsì tsiok tshù-bī.What you said is really funny.你說的事情好有趣。 |
Quick Start 快速開始
1. Install. 安裝。
Install PyTorch first (see the official guide), then OmniVoice:
先安裝 PyTorch(請看官方說明),再安裝 OmniVoice:
pip install omnivoice
2. Download the helper script and synthesize. 下載小工具,合成一句。
wget https://huggingface.co/ga642381/OmniVoice-Taigi-SuiSiann/resolve/main/taigi_tts.py
python taigi_tts.py "Lí hó, guá sī ē-hiáu kóng Tâi-gí ê gí-im ha̍p-sîng bôo-hîng." -o out.wav
The first run downloads the model (about 2.5 GB) and the audio tokenizer (about 0.8 GB).
第一次執行會下載模型(約 2.5 GB)和音訊 tokenizer(約 0.8 GB)。
3. Use it from Python. 在 Python 裡使用。
from taigi_tts import TaigiTTS
tts = TaigiTTS() # uses the GPU if one is available
tts.say("Tsia̍h-pá--buē?", "a.wav")
tts.say("Lán tsò-hué lâi-khì.", "b.wav", speed=0.8) # slower
audio, sr = tts.generate("Lí hó!") # returns a numpy array, sr = 24000
Using OmniVoice Directly 直接使用 OmniVoice
taigi_tts.py is a thin wrapper around the code below. If you call OmniVoice yourself, keep the four numbered points; dropping any of them degrades the output.
taigi_tts.py 只是把下面這段程式包起來。自己呼叫 OmniVoice 時,請保留有編號的四個重點,少了任何一個,合成品質都會變差。
import json, unicodedata
import soundfile as sf
import torch
from huggingface_hub import hf_hub_download
from omnivoice import OmniVoice
REPO = "ga642381/OmniVoice-Taigi-SuiSiann"
model = OmniVoice.from_pretrained(REPO, device_map="cuda:0", dtype=torch.float16)
ref_audio = hf_hub_download(REPO, "ref/ref.wav")
ref = json.load(open(hf_hub_download(REPO, "ref/ref.json"), encoding="utf-8"))
text = unicodedata.normalize("NFC", "Lí hó, guá sī Tâi-gí ê gí-im ha̍p-sîng bôo-hîng.") # (1) Unicode NFC
audio = model.generate(
text=text,
language="nan", # (2) always set the language to "nan" (Min Nan)
ref_audio=ref_audio, # (3) pass the reference audio together with its Tâi-lô transcript
ref_text=ref["tailo"],
denoise=False, # (4) disable denoise (it was not used during fine-tuning)
num_step=32,
)
sf.write("out.wav", audio[0], model.sampling_rate) # 24 kHz
OmniVoice needs a reference clip for every synthesis call; the model continues speaking in the voice of that clip. This repository includes one recording of the SuíSiann speaker (ref/ref.wav, 8.7 seconds) and its transcript (ref/ref.json), so the code above works as is.
OmniVoice 每次合成都需要一段參考音檔,模型會用那段音檔的聲音接著唸。這個 repository 附了一段 SuíSiann 語者的錄音(ref/ref.wav,8.7 秒)和它的逐字稿(ref/ref.json),所以上面的程式可以直接執行。
Model Details 模型資料
| Base model基礎模型 | k2-fsa/OmniVoice |
| Training data訓練資料 | SuíSiann Dataset 0.2.1, one female speaker, Ms. Ông Siù-iông (王秀容)SuíSiann 資料集 0.2.1,單一女性語者,王秀容女士 |
| Data size資料量 | 3,150 utterances (4.5 hours) for training; 60 utterances held out for validation訓練 3,150 句(4.5 小時);另外保留 60 句做驗證 |
| Input text輸入文字 | Tâi-lô romanization with tone diacritics, written in citation tones (no tone sandhi applied)台羅拼音,調號式,寫本調(不做變調) |
| Audio preprocessing音訊前處理 | Resampled from 48 kHz to 24 kHz, leading and trailing silence trimmed, loudness normalized; utterances shorter than 1 second or longer than 30 seconds removed從 48 kHz 重新取樣到 24 kHz,去掉頭尾靜音,音量正規化;移除短於 1 秒或長於 30 秒的句子 |
| Training訓練 | Official OmniVoice fine-tuning code and configuration, 5,000 steps, learning rate 1e-5, about 50 minutes on one NVIDIA L40S GPUOmniVoice 官方的微調程式和設定,5,000 步,學習率 1e-5,在一張 NVIDIA L40S GPU 上約 50 分鐘 |
| Output輸出 | 24 kHz, mono24 kHz,單聲道 |