Views
No views yet

1git clone https://github.com/viitor-ai/viitor-voice.git
2cd viitor-voice
3conda create -n viitor_voice python=3.10
4conda activate viitor_voice
5pip install -r requirements.txt
6
7### Due to the issue with vllm's tokenizer length calculation, the token limit cannot take effect.
8python_package_path=`pip show pip | egrep Location | awk -F ' ' '{print $2}'`
9cp viitor_voice/utils/patch.py $python_package_path/vllm/entrypoints/openai/logits_processors.py1from viitor_voice.inference.vllm_engine import VllmEngine
2import torchaudio
3
4tts_engine = VllmEngine(model_path="ZzWater/viitor-voice-mix")
5
6## chinese example
7ref_audio = "reference_samples/reference_samples/chinese_female.wav"
8ref_text = "博士,您工作辛苦了!"
9text_list = ["我觉得我还能抢救一下的!", "我…我才不要和你一起!"]
10audios = tts_engine.batch_infer(text_list, ref_audio, ref_text)
11for i, audio in enumerate(audios):
12 torchaudio.save('test_chinese_{}.wav'.format(i), audios[0], 24000)
13
14
15# english example
16ref_audio = "reference_samples/reference_samples/english_female.wav"
17ref_text = "At dinner, he informed me that he was a trouble shooter for a huge international organization."
18text_list = ["Working overtime feels like running a marathon with no finish line in sight—just endless tasks and a growing sense that my life is being lived in the office instead of the real world."]
19audios = tts_engine.batch_infer(text_list, ref_audio, ref_text)
20for i, audio in enumerate(audios):
21 torchaudio.save('test_english_{}.wav'.format(i), audios[0], 24000)
221from viitor_voice.inference.transformers_engine import TransformersEngine
2import torchaudio
3
4tts_engine = TransformersEngine(model_path="ZzWater/viitor-voice-mix", device='cpu')
5
6## chinese example
7ref_audio = "reference_samples/reference_samples/chinese_female.wav"
8ref_text = "博士,您工作辛苦了!"
9text_list = ["我觉得我还能抢救一下的!", "我…我才不要和你一起!"]
10audios = tts_engine.batch_infer(text_list, ref_audio, ref_text)
11for i, audio in enumerate(audios):
12 torchaudio.save('test_chinese_{}.wav'.format(i), audios[0], 24000)
13
14
15# english example
16ref_audio = "reference_samples/reference_samples/english_female.wav"
17ref_text = "At dinner, he informed me that he was a trouble shooter for a huge international organization."
18text_list = [" Working overtime feels like running a marathon with no finish line in sight", " Just endless tasks and a growing sense that my life is being lived in the office instead of the real world."]
19audios = tts_engine.batch_infer(text_list, ref_audio, ref_text)
20for i, audio in enumerate(audios):
21 torchaudio.save('test_english_{}.wav'.format(i), audios[0], 24000)
22python gradio_demo.py