FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

ONNX Export of Pretrained models outputs garbage

Open andreystarenky opened this issue 1 year ago • 2 comments

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

❓ Questions and Help

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

I tried both the funasr-export and model.export in python to export paraformer-zh or paraformer-zh-streaming into an onnx file, but the resulting onnx file does not work properly, it outputs garbage. When I use "paraformer" in AutoModel it works fine, but not "paraformer-zh" or "paraformer-zh-streaming"

My goal is to get onnx of the paraformer-zh-streaming model

Code

from funasr import AutoModel

model = AutoModel(model="paraformer", device="cpu") # this onnx model works
#model = AutoModel(model="paraformer-zh", device="cpu") # this onnx file outputs garbage
#model = AutoModel(model="paraformer-zh-streaming", device="cpu") # this onnx file outputs garbage

res = model.export(quantize=False)

I am running the model as such:

model = Paraformer(model_dir, batch_size=1, quantize=False)
result = model(wav_path)

example output::

[{'preds': ('去去inn去去inn去去去inn inn去去inn去去inn去去去去去inn去去去去去inn去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去妓妓妓妓妓妓妓妓妓妓妓 . . . 

I have also tried to run this model: https://www.modelscope.cn/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx/files

This is the output that I get:

[{'preds': ('去去anyanyanyinn inn去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓妓犀妓妓妓妓妓鎉斜 . . . 

What have you tried?

I have searched the issues and docs, and have tried both the funasr-export util and the python code to export.

What's your environment?

  • OS (e.g., Linux): Windows
  • FunASR Version (e.g., 1.0.0): 1.1.5
  • ModelScope Version (e.g., 1.11.0): 1.17.1
  • PyTorch Version (e.g., 2.0.0): 2.4.0
  • How you installed funasr (pip, source): yes
  • Python version: 3.9.13
  • GPU (e.g., V100M32) N/A using CPU
  • CUDA/cuDNN version (e.g., cuda11.7): Hydra 1.3.2
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1) N/A
  • Any other relevant information:

andreystarenky avatar Aug 26 '24 07:08 andreystarenky

^ it looks like you guys have some bots in your repository as well, maybe need to ban these or add some filter lol

andreystarenky avatar Aug 26 '24 07:08 andreystarenky