lyuxiang.lx 8 months ago
parent
commit
0b75c3a03f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      cosyvoice/cli/model.py

+ 2 - 0
cosyvoice/cli/model.py

@@ -87,6 +87,8 @@ class CosyVoiceModel:
         assert torch.cuda.is_available(), 'tensorrt only supports gpu!'
         if not os.path.exists(flow_decoder_estimator_model):
             convert_onnx_to_trt(flow_decoder_estimator_model, flow_decoder_onnx_model, fp16)
+        if os.path.getsize(flow_decoder_estimator_model) == 0:
+            raise ValueError('{} is empty file, delete it and export again!'.format(flow_decoder_estimator_model))
         del self.flow.decoder.estimator
         import tensorrt as trt
         with open(flow_decoder_estimator_model, 'rb') as f: