sherpa-onnx 中英混 ct-transformer

我要开发同款
匿名用户2024年07月31日
40阅读
所属分类aiPytorch
开源地址https://modelscope.cn/models/pengzhendong/punct-ct-transformer-zh-en

作品详情

Introduction

This model is converted from https://modelscope.cn/models/iic/puncct-transformerzh-cn-common-vocab272727-pytorch/summary

The commands to generate the onnx model are given below:

pip install funasr modelscope
pip install kaldi-native-fbank torchaudio onnx onnxruntime

mkdir -p /tmp/models
cd /tmp/models

git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
cd punc_ct-transformer_zh-cn-common-vocab272727-pytorch
git lfs pull --include model.pt

cd /tmp
git clone https://github.com/alibaba-damo-academy/FunASR
cd FunASR/runtime/python/onnxruntime

cat >export-onnx.py <<EOF

from funasr_onnx import CT_Transformer
model_dir = "/tmp/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" # model = CT_Transformer(model_dir, quantize=True) model = CT_Transformer(model_dir)
EOF

chmod +x export-onnx.py

./export-onnx.py

You will find the exported model.onnx file inside /tmp/models/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.

Now you can use ./add-model-metadata.py in this repo to add metadata to the generated model.onnx.

Note that we don't provide model.int8.onnx because

punc_ct-transformer_zh-cn-common-vocab272727-pytorch fangjun$ ls -lh *.onnx
-rw-r--r--  1 fangjun  staff   279M Apr 12 11:08 model.onnx
-rw-r--r--  1 fangjun  staff   270M Apr 12 11:09 model_quant.onnx

model.int8.onnx does not have advantages in the file size for this model.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论