-
Notifications
You must be signed in to change notification settings - Fork 88
Description
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.models.audio.tts import SambertHifigan
import os
import time
model_dir = "/home/gpu/KAN-TTS/pretrain_work_dir/" # the path of my trained speech model
custom_infer_abs = {
'voice_name':'F7',
'am_ckpt': os.path.join(model_dir, 'tmp_am', 'ckpt'),
'am_config': os.path.join(model_dir, 'tmp_am', 'config.yaml'),
'voc_ckpt':os.path.join(model_dir, 'orig_model', 'basemodel_16k', 'hifigan', 'ckpt'),
'voc_config':os.path.join(model_dir, 'orig_model', 'basemodel_16k', 'hifigan', 'config.yaml'),
'audio_config':os.path.join(model_dir, 'data', 'audio_config.yaml'),
'se_file':os.path.join(model_dir, 'data', 'se', 'se.npy')
}
kwargs = {'custom_ckpt': custom_infer_abs}
model_id = SambertHifigan(os.path.join(model_dir, "orig_model"), **kwargs)
sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id)
txt = "<speak rate="1.5">我的语速比正常人慢。"
output = sambert_hifigan_tts(input=text)
wav = output[OutputKeys.OUTPUT_WAV]
with open('output.wav', 'wb') as f:
f.write(wav)
========================>
try diffrent text like next:
txt = "<speak rate="200">我的语速比正常人慢。"
txt = "<speak rate="-200">我的语速比正常人慢。"
txt = "<speak rate="0.5">我的语速比正常人慢。"
txt = "<speak rate="1.5">我的语速比正常人慢。"
get "output.wav" that have same speech rate.
the context is right. but the speech rate is same. why?