FunASR
FunASR copied to clipboard
paraformer-zh导出onnx失败
What is your question?
paraformer-zh导出onnx失败
Code
(funasr2) jincan@likai:~/Downloads$ funasr-export ++model=paraformer-zh ++quantize=false ++device=cpu
funasr version: 1.2.7.
Check update of funasr, and it would cost few times. You may disable it by set disable_update=True in AutoModel
You are using the latest version of funasr-1.2.7
[2025-11-13 16:05:59,638][root][INFO] - download models from model hub: ms
Downloading Model from https://www.modelscope.cn to directory: /home/jincan/.cache/modelscope/hub/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
[2025-11-13 16:06:00,439][root][WARNING] - trust_remote_code: False
[2025-11-13 16:06:01,625][root][INFO] - Loading pretrained params from /home/jincan/.cache/modelscope/hub/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pt
[2025-11-13 16:06:01,629][root][INFO] - ckpt: /home/jincan/.cache/modelscope/hub/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pt
[2025-11-13 16:06:02,231][root][INFO] - scope_map: ['module.', 'None']
[2025-11-13 16:06:02,231][root][INFO] - excludes: None
[2025-11-13 16:06:02,327][root][INFO] - Loading ckpt: /home/jincan/.cache/modelscope/hub/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/model.pt, status: <All keys matched successfully>
Error executing job with overrides: ['++model=paraformer-zh', '++quantize=false', '++device=cpu']
Traceback (most recent call last):
File "/home/jincan/miniconda3/envs/funasr2/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_compat.py", line 93, in export_compat
_dynamic_shapes.from_dynamic_axes_to_dynamic_shapes(
File "/home/jincan/miniconda3/envs/funasr2/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_dynamic_shapes.py", line 95, in from_dynamic_axes_to_dynamic_shapes
dynamic_shapes = _unflatten_dynamic_shapes_with_inputs_tree(inputs, dynamic_shapes)
File "/home/jincan/miniconda3/envs/funasr2/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_dynamic_shapes.py", line 307, in _unflatten_dynamic_shapes_with_inputs_tree
return _pytree.tree_unflatten(dynamic_shapes.values(), tree_structure)
File "/home/jincan/miniconda3/envs/funasr2/lib/python3.10/site-packages/torch/utils/_pytree.py", line 1299, in tree_unflatten
return treespec.unflatten(leaves)
File "/home/jincan/miniconda3/envs/funasr2/lib/python3.10/site-packages/torch/utils/_pytree.py", line 1195, in unflatten
raise ValueError(
ValueError: treespec.unflatten(leaves): leaves has length 4 but the spec refers to a pytree that holds 3 items (TreeSpec(list, None, [*,
*,
*])).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jincan/miniconda3/envs/funasr2/bin/funasr-export", line 7, in
What's your environment?
- OS (e.g., Linux):
- FunASR Version (1.2.7):
- ModelScope Version (1.31.0):
- PyTorch Version (2.9.0):
- How you installed funasr (
pip, source): - Python version: 3.10.18
- GPU (3080)
- CUDA/cuDNN version (cuda12.8):
环境有问题,用以下环境就可以了: python==3.10.18 torch==2.4.0 torchaudio==2.4.0 onnx==1.17.0