fix export error if using cpu device; fix model path (#2265)

Co-authored-by: siyuan.yang <siyuan.yang@sophgo.com>
This commit is contained in:
Thomas Young 2024-12-05 11:01:29 +08:00 committed by GitHub
parent 0c3c9be2c4
commit 46721dc84a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,7 @@
from funasr import AutoModel
model = AutoModel(
model="/raid/t3cv/wangch/WORK_SAPCE/ASR/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
model="iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
)
res = model.export(type="onnx", quantize=False, opset_version=13, device='cuda') # fp32 onnx-gpu

View File

@ -65,8 +65,9 @@ def _onnx(
**kwargs,
):
device = kwargs.get("device", "cpu")
dummy_input = model.export_dummy_inputs()
dummy_input = (dummy_input[0].to("cuda"), dummy_input[1].to("cuda"))
dummy_input = (dummy_input[0].to(device), dummy_input[1].to(device))
verbose = kwargs.get("verbose", False)