Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
export model test onnx
游雁238773f37de6
diff --git a/funasr/export/test_onnx.py b/funasr/export/test_onnx.pynew file mode 100644index 000000000..16d88e8a9--- /dev/null+++ b/funasr/export/test_onnx.py@@ -0,0 +1,20 @@+import onnxruntime+import numpy as np+++if __name__ == '__main__':+ onnx_path = "/root/cache/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/torchscripts/model.onnx"+ sess = onnxruntime.InferenceSession(onnx_path)+ input_name = [nd.name for nd in sess.get_inputs()]+ output_name = [nd.name for nd in sess.get_outputs()]++ def _get_feed_dict(feats_length):+ return {'speech': np.zeros((1, feats_length, 560), dtype=np.float32), 'speech_lengths': [feats_length,]}++ def _run(feed_dict):+ output = sess.run(output_name, input_feed=feed_dict)+ for name, value in zip(output_name, output):+ print('{}: {}'.format(name, value.shape))++ _run(_get_feed_dict(100))+ _run(_get_feed_dict(200))\ No newline at end of file