瀏覽代碼

fix possible bug

lyuxiang.lx 7 月之前
父節點
當前提交
46dfe0439b
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      cosyvoice/flow/flow_matching.py

+ 2 - 0
cosyvoice/flow/flow_matching.py

@@ -127,6 +127,8 @@ class ConditionalCFM(BASECFM):
             return self.estimator(x, mask, mu, t, spks, cond, streaming=streaming)
         else:
             [estimator, stream], trt_engine = self.estimator.acquire_estimator()
+            # NOTE need to synchronize when switching stream
+            torch.cuda.current_stream().synchronize()
             with stream:
                 estimator.set_input_shape('x', (2, 80, x.size(2)))
                 estimator.set_input_shape('mask', (2, 1, x.size(2)))