(self,
model_type, model_path, ref_wav_path="assets/Claire.wav",
prompt_text="Although the campaign was not a complete success, it did provide Napoleon with valuable experience and prestige.",
enable_vllm_acc=False)
| 10 | |
| 11 | class Inference(): |
| 12 | def __init__(self, |
| 13 | model_type, model_path, ref_wav_path="assets/Claire.wav", |
| 14 | prompt_text="Although the campaign was not a complete success, it did provide Napoleon with valuable experience and prestige.", |
| 15 | enable_vllm_acc=False): |
| 16 | # ref_wav_path and prompt_text are used here only to initialize sovits (otherwise the first run would be slow) |
| 17 | # new ref_wav_path and prompt_text can still be specified later using call_tts |
| 18 | self.sovits_processor = Processor(sovits_path=os.path.join(model_path, "sovits.pth")) |
| 19 | self.sovits_processor.generate_audio_token(ref_wav_path) |
| 20 | clean_text_inf_normed_text(prompt_text, 'en', 'v1') |
| 21 | logging.info("init vits finish") |
| 22 | |
| 23 | # Used to distinguish between API mode and regular TTS mode |
| 24 | self.enable_vllm_acc = enable_vllm_acc |
| 25 | if self.enable_vllm_acc == True: |
| 26 | from inference.inference_llama import InferenceLlamaVllm |
| 27 | self.llama = InferenceLlamaVllm(model_path, model_type) |
| 28 | else: |
| 29 | from inference.inference_llama import InferenceLlamaHf |
| 30 | self.llama = InferenceLlamaHf(model_path, model_type) |
| 31 | |
| 32 | self.model_type = model_type |
| 33 | |
| 34 | def _create_prompt(self, prompt_text, text, audio_tokens): |
| 35 | if self.model_type == "base": |
nothing calls this directly
no test coverage detected