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
游雁e21e66c6a36a
diff --git a/funasr/export/README.md b/funasr/export/README.mdnew file mode 100644index 000000000..39a726520--- /dev/null+++ b/funasr/export/README.md@@ -0,0 +1,21 @@++environment: ubuntu20.04-py37-torch1.11.0-tf1.15.5-1.2.0++Export onnx files from modelscope+```python+from funasr.export.export_model import ASRModelExportParaformer++output_dir = "../export"+export_model = ASRModelExportParaformer(cache_dir=output_dir, onnx=True)+export_model.export_from_modelscope('damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')+```+++Export onnx files from local path+```python+from funasr.export.export_model import ASRModelExportParaformer++output_dir = "../export"+export_model = ASRModelExportParaformer(cache_dir=output_dir, onnx=True)+export_model.export_from_local('/root/cache/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')+```\ No newline at end of filediff --git a/funasr/export/export_model.py b/funasr/export/export_model.pyindex a08acad57..2aff6f918 100644--- a/funasr/export/export_model.py+++ b/funasr/export/export_model.py@@ -41,12 +41,25 @@ class ASRModelExportParaformer:model,self.export_config,)- if self.onnx:- self._export_onnx(model, verbose, export_dir)+ self._export_onnx(model, verbose, export_dir)+ # if self.onnx:+ # self._export_onnx(model, verbose, export_dir)+ # else:+ # self._export_torchscripts(model, verbose, export_dir)logging.info("output dir: {}".format(export_dir))+ def _export_torchscripts(self, model, verbose, path, enc_size=None):+ if enc_size:+ dummy_input = model.get_dummy_inputs(enc_size)+ else:+ dummy_input = model.get_dummy_inputs()++ # model_script = torch.jit.script(model)+ model_script = torch.jit.trace(model, dummy_input)+ model_script.save(os.path.join(path, f'{model.model_name}.torchscripts'))+def export_from_modelscope(self,tag_name: str = 'damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch',