CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

export_jit.py中缺失CosyVoice3的导出

Open MarginGitHub opened this issue 11 months ago • 4 comments

我看到export_jit.py中有CosyVoice和CosyVoice2的处理逻辑,但是CosyVoice3是处于缺失状态,是后续不打算支持CosyVoice3吗?

MarginGitHub avatar Dec 17 '25 02:12 MarginGitHub

已经更新export_jit.py,cosyvoice3没有jit导出部分

aluminumbox avatar Dec 29 '25 10:12 aluminumbox

请教一下,为什么 CosyVoice3 没有 jit 导出部分呢?是因为对性能的提升上效果不大吗?如果要实现 jit 导致,大概的代码是在 export_jit.py 中添加如下这样的吗?

    elif model.__class__.__name__ == "CosyVoice3":
        # 1. export flow pre_lookahead_layer
        flow_pre_lookahead_layer = model.model.flow.pre_lookahead_layer
        script = get_optimized_script(flow_pre_lookahead_layer)
        script.save("{}/flow.pre_lookahead_layer.fp32.zip".format(args.model_dir))
        script = get_optimized_script(flow_pre_lookahead_layer.half())
        script.save("{}/flow.pre_lookahead_layer.fp16.zip".format(args.model_dir))
        logging.info("successfully export flow_pre_lookahead_layer")

然后实现 CosyVoice3Model 的 load_jit 方法

    def load_jit(self, flow_pre_lookahead_layer_model):
        self.flow.pre_lookahead_layer = torch.jit.load(flow_pre_lookahead_layer_model, map_location=self.device)

zenghuiguan avatar Jan 27 '26 06:01 zenghuiguan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 31 '26 02:03 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 14 '26 02:04 github-actions[bot]