This commit is contained in:
zhoubofan.zbf
2024-08-30 13:43:54 +08:00
parent 6e7f5b922a
commit 29408360fb
4 changed files with 18 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ from cosyvoice.utils.file_utils import logging
class CosyVoice:
def __init__(self, model_dir, load_jit=True, load_trt=False, use_fp16=False):
def __init__(self, model_dir, load_jit=True, load_trt=True, use_fp16=False):
instruct = True if '-Instruct' in model_dir else False
self.model_dir = model_dir
if not os.path.exists(model_dir):
@@ -39,7 +39,7 @@ class CosyVoice:
self.model.load('{}/llm.pt'.format(model_dir),
'{}/flow.pt'.format(model_dir),
'{}/hift.pt'.format(model_dir))
load_jit = False
if load_jit:
self.model.load_jit('{}/llm.text_encoder.fp16.zip'.format(model_dir),
'{}/llm.llm.fp16.zip'.format(model_dir))

View File

@@ -83,7 +83,8 @@ class CosyVoiceModel:
with open(trt_file_path, 'rb') as f:
serialized_engine = f.read()
engine = runtime.deserialize_cuda_engine(serialized_engine)
self.flow.decoder.estimator = engine.create_execution_context()
self.flow.decoder.estimator_context = engine.create_execution_context()
self.flow.decoder.estimator = None
def llm_job(self, text, prompt_text, llm_prompt_speech_token, llm_embedding, uuid):
with self.llm_context: