[Hardware] Enable CosyVoice3 on Moore Threads MUSA (#5164)
Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
1 parent
fa41fdf252
commit
ab0da662c0
6 files changed
+42
-8
No files matched your search
@@ -73,6 +73,19 @@ def _cosyvoice3_trt_enabled() -> bool:
|
||||
return os.environ.get("COSYVOICE3_TRT", "1") not in ("0", "false", "False", "")
|
||||
|
||||
|
||||
def _campplus_onnx_providers() -> list[str]:
|
||||
"""ONNX-Runtime providers for the campplus speaker-embedding session.
|
||||
|
||||
Prefer ``MUSAExecutionProvider`` (from the onnxruntime-musa build) with a
|
||||
CPU fallback when it is available; otherwise CPU only. The MUSA kernels
|
||||
differ from the CPU reference by a few percent on the embedding, which
|
||||
conditions voice cloning -- verify voice similarity if that matters.
|
||||
"""
|
||||
if "MUSAExecutionProvider" in onnxruntime.get_available_providers():
|
||||
return ["MUSAExecutionProvider", "CPUExecutionProvider"]
|
||||
return ["CPUExecutionProvider"]
|
||||
|
||||
|
||||
class CosyVoice3MultiModalProcessingInfo(BaseProcessingInfo):
|
||||
def get_hf_config(self):
|
||||
"""If the config is not already present pass it
|
||||
@@ -163,7 +176,7 @@ class CosyVoice3MultiModalProcessor(BaseMultiModalProcessor[CosyVoice3MultiModal
|
||||
campplus_session = onnxruntime.InferenceSession(
|
||||
campplus_onnx_path,
|
||||
sess_options=option,
|
||||
providers=["CPUExecutionProvider"],
|
||||
providers=_campplus_onnx_providers(),
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -922,6 +935,7 @@ class CosyVoice3Model(
|
||||
if getattr(self, "_code2wav_trt_done", False):
|
||||
return
|
||||
self._code2wav_trt_done = True
|
||||
|
||||
if not (_cosyvoice3_trt_enabled() and torch.cuda.is_available()):
|
||||
return
|
||||
onnx_path = self._resolve_flow_estimator_onnx()
|
||||
|
||||
Reference in new issue
Block a user