| | |
| | | (简体中文|[English](./README.md)) |
| | | |
| | | # FunASR: A Fundamental End-to-End Speech Recognition Toolkit |
| | | <p align="left"> |
| | | <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-brightgreen.svg"></a> |
| | | <a href=""><img src="https://img.shields.io/badge/Python->=3.7,<=3.10-aff.svg"></a> |
| | | <a href=""><img src="https://img.shields.io/badge/Pytorch-%3E%3D1.11-blue"></a> |
| | | </p> |
| | | |
| | | FunASR希望在语音识别的学术研究和工业应用之间架起一座桥梁。通过支持在[ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)上发布的工业级语音识别模型的训练和微调,研究人员和开发人员可以更方便地进行语音识别模型的研究和生产,并推动语音识别生态的发展。让语音识别更有趣! |
| | | [](https://pypi.org/project/funasr/) |
| | | |
| | | |
| | | FunASR希望在语音识别的学术研究和工业应用之间架起一座桥梁。通过发布工业级语音识别模型的训练和微调,研究人员和开发人员可以更方便地进行语音识别模型的研究和生产,并推动语音识别生态的发展。让语音识别更有趣! |
| | | |
| | | <div align="center"> |
| | | <h4> |
| | | <a href="#最新动态"> 最新动态 </a> |
| | | <a href="#核心功能"> 核心功能 </a> |
| | | |<a href="#最新动态"> 最新动态 </a> |
| | | |<a href="#安装教程"> 安装 </a> |
| | | |<a href="#快速开始"> 快速开始 </a> |
| | | |<a href="https://alibaba-damo-academy.github.io/FunASR/en/index.html"> 教程文档 </a> |
| | | |<a href="#核心功能"> 核心功能 </a> |
| | | |<a href="./docs/model_zoo/modelscope_models.md"> 模型仓库 </a> |
| | | |<a href="./funasr/runtime/readme_cn.md"> 服务部署 </a> |
| | | |<a href="#模型仓库"> 模型仓库 </a> |
| | | |<a href="#服务部署"> 服务部署 </a> |
| | | |<a href="#联系我们"> 联系我们 </a> |
| | | </h4> |
| | | </div> |
| | | |
| | | <a name="最新动态"></a> |
| | | ## 最新动态 |
| | | |
| | | ### 服务部署SDK |
| | | |
| | | - 2023.07.03: |
| | | 中文离线文件转写服务(CPU版本)发布,支持一键部署和测试([点击此处](funasr/runtime/readme_cn.md)) |
| | | |
| | | ### ASRU 2023 多通道多方会议转录挑战 2.0 |
| | | |
| | | 详情请参考文档([点击此处](https://alibaba-damo-academy.github.io/FunASR/m2met2_cn/index.html)) |
| | | |
| | | |
| | | ### 语音识别 |
| | | |
| | | - 学术模型: |
| | | - Encoder-Decoder模型:[Transformer](egs/aishell/transformer),[Conformer](egs/aishell/conformer),[Branchformer](egs/aishell/branchformer) |
| | | - Transducer模型:[RNNT(流式)](egs/aishell/rnnt),[BAT](egs/aishell/bat) |
| | | - 非自回归模型:[Paraformer](egs/aishell/paraformer) |
| | | - 多说话人识别模型:[MFCCA](egs_modelscope/asr/mfcca) |
| | | |
| | | - 工业模型: |
| | | - 中文通用模型:[Paraformer-large](egs_modelscope/asr/paraformer/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch),[Paraformer-large长音频版本](egs_modelscope/asr_vad_punc/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch),[Paraformer-large流式版本](egs_modelscope/asr/paraformer/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online) |
| | | - 中文通用热词模型:[Paraformer-large-contextual](egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404), |
| | | - 英文通用模型:[Conformer]() |
| | | - 流式离线一体化模型: [16k UniASR闽南语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-minnan-16k-common-vocab3825/summary)、 [16k UniASR法语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fr-16k-common-vocab3472-tensorflow1-online/summary)、 [16k UniASR德语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-de-16k-common-vocab3690-tensorflow1-online/summary)、 [16k UniASR越南语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-vi-16k-common-vocab1001-pytorch-online/summary)、 [16k UniASR波斯语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-fa-16k-common-vocab1257-pytorch-online/summary), |
| | | [16k UniASR缅甸语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-my-16k-common-vocab696-pytorch/summary)、 [16k UniASR希伯来语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-he-16k-common-vocab1085-pytorch/summary)、 [16k UniASR乌尔都语](https://modelscope.cn/models/damo/speech_UniASR_asr_2pass-ur-16k-common-vocab877-pytorch/summary)、 [8k UniASR中文金融领域](https://www.modelscope.cn/models/damo/speech_UniASR_asr_2pass-zh-cn-8k-finance-vocab3445-online/summary)、[16k UniASR中文音视频领域](https://www.modelscope.cn/models/damo/speech_UniASR_asr_2pass-zh-cn-16k-audio_and_video-vocab3445-online/summary) |
| | | |
| | | ### 说话人识别 |
| | | - 说话人确认模型:[xvector](egs_modelscope/speaker_verification) |
| | | - 说话人日志模型:[SOND](egs/callhome/diarization/sond) |
| | | |
| | | ### 标点恢复 |
| | | - 中文标点模型:[CT-Transformer](egs_modelscope/punctuation/punc_ct-transformer_zh-cn-common-vocab272727-pytorch),[CT-Transformer流式](egs_modelscope/punctuation/punc_ct-transformer_zh-cn-common-vadrealtime-vocab272727) |
| | | |
| | | ### 端点检测 |
| | | - [FSMN-VAD](egs_modelscope/vad/speech_fsmn_vad_zh-cn-16k-common) |
| | | |
| | | ### 时间戳预测 |
| | | - 字级别模型:[TP-Aligner](egs_modelscope/tp/speech_timestamp_prediction-v1-16k-offline) |
| | | |
| | | <a name="核心功能"></a> |
| | | ## 核心功能 |
| | | - FunASR是一个基础语音识别工具包,提供多种功能,包括语音识别(ASR)、语音活动检测(VAD)、标点恢复、语言模型、说话人验证、说话人分离和多人对话语音识别。 |
| | | - 我们在[ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)上发布了大量的学术和工业预训练模型,可以通过我们的[模型仓库](https://github.com/alibaba-damo-academy/FunASR/blob/main/docs/model_zoo/modelscope_models.md)访问。代表性的[Paraformer-large](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)模型在许多语音识别任务中实现了SOTA性能。 |
| | | - FunASR提供了一个易于使用的接口,可以直接基于ModelScope中托管模型进行推理与微调。此外,FunASR中的优化数据加载器可以加速大规模数据集的训练速度。 |
| | | - FunASR是一个基础语音识别工具包,提供多种功能,包括语音识别(ASR)、语音端点检测(VAD)、标点恢复、语言模型、说话人验证、说话人分离和多人对话语音识别等。FunASR提供了便捷的脚本和教程,支持预训练好的模型的推理与微调。 |
| | | - 我们在[ModelScope](https://www.modelscope.cn/models?page=1&tasks=auto-speech-recognition)与[huggingface](https://huggingface.co/FunASR)上发布了大量开源数据集或者海量工业数据训练的模型,可以通过我们的[模型仓库](https://github.com/alibaba-damo-academy/FunASR/blob/main/docs/model_zoo/modelscope_models.md)了解模型的详细信息。代表性的[Paraformer](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)非自回归端到端语音识别模型具有高精度、高效率、便捷部署的优点,支持快速构建语音识别服务,详细信息可以阅读([服务部署文档](runtime/readme_cn.md))。 |
| | | |
| | | <a name="最新动态"></a> |
| | | ## 最新动态 |
| | | - 2024/01/30:funasr-1.0发布,更新说明[文档](https://github.com/alibaba-damo-academy/FunASR/discussions/1319) |
| | | - 2024/01/30:新增加情感识别 [模型链接](https://www.modelscope.cn/models/iic/emotion2vec_base_finetuned/summary),原始模型 [repo](https://github.com/ddlBoJack/emotion2vec). |
| | | - 2024/01/25: 中文离线文件转写服务 4.2、英文离线文件转写服务 1.3,优化vad数据处理方式,大幅降低峰值内存占用,内存泄漏优化;中文实时语音听写服务 1.7 发布,客户端优化;详细信息参阅([部署文档](runtime/readme_cn.md)) |
| | | - 2024/01/09: funasr社区软件包windows 2.0版本发布,支持软件包中文离线文件转写4.1、英文离线文件转写1.2、中文实时听写服务1.6的最新功能,详细信息参阅([FunASR社区软件包windows版本](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) |
| | | - 2024/01/03: 中文离线文件转写服务 4.0 发布,新增支持8k模型、优化时间戳不匹配问题及增加句子级别时间戳、优化英文单词fst热词效果、支持自动化配置线程参数,同时修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) |
| | | - 2024/01/03: 中文实时语音听写服务 1.6 发布,2pass-offline模式支持Ngram语言模型解码、wfst热词,同时修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#中文实时语音听写服务cpu版本)) |
| | | - 2024/01/03: 英文离线文件转写服务 1.2 发布,修复已知的crash问题及内存泄漏问题,详细信息参阅([部署文档](runtime/readme_cn.md#英文离线文件转写服务cpu版本)) |
| | | - 2023/12/04: funasr社区软件包windows 1.0版本发布,支持中文离线文件转写、英文离线文件转写、中文实时听写服务,详细信息参阅([FunASR社区软件包windows版本](https://www.modelscope.cn/models/damo/funasr-runtime-win-cpu-x64/summary)) |
| | | - 2023/11/08:中文离线文件转写服务3.0 CPU版本发布,新增标点大模型、Ngram语言模型与wfst热词,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) |
| | | - 2023/10/17: 英文离线文件转写服务一键部署的CPU版本发布,详细信息参阅([部署文档](runtime/readme_cn.md#英文离线文件转写服务cpu版本)) |
| | | - 2023/10/13: [SlideSpeech](https://slidespeech.github.io/): 一个大规模的多模态音视频语料库,主要是在线会议或者在线课程场景,包含了大量与发言人讲话实时同步的幻灯片。 |
| | | - 2023.10.10: [Paraformer-long-Spk](https://github.com/alibaba-damo-academy/FunASR/blob/main/egs_modelscope/asr_vad_spk/speech_paraformer-large-vad-punc-spk_asr_nat-zh-cn/demo.py)模型发布,支持在长语音识别的基础上获取每句话的说话人标签。 |
| | | - 2023.10.07: [FunCodec](https://github.com/alibaba-damo-academy/FunCodec): FunCodec提供开源模型和训练工具,可以用于音频离散编码,以及基于离散编码的语音识别、语音合成等任务。 |
| | | - 2023.09.01: 中文离线文件转写服务2.0 CPU版本发布,新增ffmpeg、时间戳与热词模型支持,详细信息参阅([部署文档](runtime/readme_cn.md#中文离线文件转写服务cpu版本)) |
| | | - 2023.08.07: 中文实时语音听写服务一键部署的CPU版本发布,详细信息参阅([部署文档](runtime/readme_cn.md#中文实时语音听写服务cpu版本)) |
| | | - 2023.07.17: BAT一种低延迟低内存消耗的RNN-T模型发布,详细信息参阅([BAT](egs/aishell/bat)) |
| | | - 2023.06.26: ASRU2023 多通道多方会议转录挑战赛2.0完成竞赛结果公布,详细信息参阅([M2MeT2.0](https://alibaba-damo-academy.github.io/FunASR/m2met2_cn/index.html)) |
| | | |
| | | <a name="安装教程"></a> |
| | | ## 安装教程 |
| | | |
| | | 直接安装发布软件包 |
| | | |
| | | ```shell |
| | | pip3 install -U funasr |
| | | # 中国大陆用户,如果遇到网络问题,可以用下面指令: |
| | | # pip3 install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple |
| | | ``` |
| | | |
| | | 您也可以从源码安装 |
| | | |
| | | |
| | | 或者从源代码安装 |
| | | ``` sh |
| | | git clone https://github.com/alibaba/FunASR.git && cd FunASR |
| | | pip3 install -e ./ |
| | | # 中国大陆用户,如果遇到网络问题,可以用下面指令: |
| | | # pip3 install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple |
| | | ``` |
| | | 如果您需要使用ModelScope中发布的预训练模型,需要安装ModelScope |
| | | 如果需要使用工业预训练模型,安装modelscope(可选) |
| | | |
| | | ```shell |
| | | pip3 install -U modelscope |
| | | # 中国大陆用户,如果遇到网络问题,可以用下面指令: |
| | | # pip3 install -U modelscope -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html -i https://mirror.sjtu.edu.cn/pypi/web/simple |
| | | ``` |
| | | |
| | | 更详细安装过程介绍([点击此处](https://alibaba-damo-academy.github.io/FunASR/en/installation/installation.html)) |
| | | ## 模型仓库 |
| | | |
| | | FunASR开源了大量在工业数据上预训练模型,您可以在[模型许可协议](./MODEL_LICENSE)下自由使用、复制、修改和分享FunASR模型,下面列举代表性的模型,更多模型请参考[模型仓库]()。 |
| | | |
| | | (注:[🤗]()表示Huggingface模型仓库链接,[⭐]()表示ModelScope模型仓库链接) |
| | | |
| | | |
| | | | 模型名字 | 任务详情 | 训练数据 | 参数量 | |
| | | |:------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------:|:------------:|:----:| |
| | | | paraformer-zh <br> ([⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) [🤗](https://huggingface.co/funasr/paraformer-tp) ) | 语音识别,带时间戳输出,非实时 | 60000小时,中文 | 220M | |
| | | | paraformer-zh-streaming <br> ( [⭐](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/summary) [🤗](https://huggingface.co/funasr/paraformer-zh-streaming) ) | 语音识别,实时 | 60000小时,中文 | 220M | |
| | | | paraformer-en <br> ( [⭐](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-en-16k-common-vocab10020/summary) [🤗](https://huggingface.co/funasr/paraformer-en) ) | 语音识别,非实时 | 50000小时,英文 | 220M | |
| | | | conformer-en <br> ( [⭐](https://modelscope.cn/models/damo/speech_conformer_asr-en-16k-vocab4199-pytorch/summary) [🤗](https://huggingface.co/funasr/conformer-en) ) | 语音识别,非实时 | 50000小时,英文 | 220M | |
| | | | ct-punc <br> ( [⭐](https://modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large/summary) [🤗](https://huggingface.co/funasr/ct-punc) ) | 标点恢复 | 100M,中文与英文 | 1.1G | |
| | | | fsmn-vad <br> ( [⭐](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/summary) [🤗](https://huggingface.co/funasr/fsmn-vad) ) | 语音端点检测,实时 | 5000小时,中文与英文 | 0.4M | |
| | | | fa-zh <br> ( [⭐](https://modelscope.cn/models/damo/speech_timestamp_prediction-v1-16k-offline/summary) [🤗](https://huggingface.co/funasr/fa-zh) ) | 字级别时间戳预测 | 50000小时,中文 | 38M | |
| | | | cam++ <br> ( [⭐](https://modelscope.cn/models/iic/speech_campplus_sv_zh-cn_16k-common/summary) [🤗](https://huggingface.co/funasr/campplus) ) | 说话人确认/分割 | 5000小时 | 7.2M | |
| | | |
| | | |
| | | <a name="快速开始"></a> |
| | | ## 快速开始 |
| | | |
| | | 您可以通过如下几种方式使用FunASR功能: |
| | | 下面为快速上手教程,测试音频([中文](https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav),[英文]()) |
| | | |
| | | - 服务部署SDK |
| | | - 工业模型egs |
| | | - 学术模型egs |
| | | |
| | | ### 服务部署SDK |
| | | |
| | | #### python版本示例 |
| | | |
| | | 支持实时流式语音识别,并且会用非流式模型进行纠错,输出文本带有标点。目前只支持单个client,如需多并发请参考下方c++版本服务部署SDK |
| | | |
| | | ##### 服务端部署 |
| | | ```shell |
| | | cd funasr/runtime/python/websocket |
| | | python funasr_wss_server.py --port 10095 |
| | | ``` |
| | | |
| | | ##### 客户端测试 |
| | | ```shell |
| | | python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk_size "5,10,5" |
| | | #python funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode 2pass --chunk_size "8,8,4" --audio_in "./data/wav.scp" |
| | | ``` |
| | | 更多例子可以参考([点击此处](https://alibaba-damo-academy.github.io/FunASR/en/runtime/websocket_python.html#id2)) |
| | | |
| | | <a name="cpp版本示例"></a> |
| | | #### c++版本示例 |
| | | |
| | | 目前已支持离线文件转写服务(CPU),支持上百路并发请求 |
| | | |
| | | ##### 服务端部署 |
| | | 可以用个下面指令,一键部署完成部署 |
| | | ```shell |
| | | curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-offline-cpu-zh.sh |
| | | sudo bash funasr-runtime-deploy-offline-cpu-zh.sh install --workspace ./funasr-runtime-resources |
| | | ``` |
| | | |
| | | ##### 客户端测试 |
| | | ### 可执行命令行 |
| | | |
| | | ```shell |
| | | python3 funasr_wss_client.py --host "127.0.0.1" --port 10095 --mode offline --audio_in "../audio/asr_example.wav" |
| | | funasr +model=paraformer-zh +vad_model="fsmn-vad" +punc_model="ct-punc" +input=asr_example_zh.wav |
| | | ``` |
| | | 更多例子参考([点击此处](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/docs/SDK_tutorial_zh.md)) |
| | | |
| | | 注:支持单条音频文件识别,也支持文件列表,列表为kaldi风格wav.scp:`wav_id wav_path` |
| | | |
| | | ### 工业模型egs |
| | | ### 非实时语音识别 |
| | | ```python |
| | | from funasr import AutoModel |
| | | # paraformer-zh is a multi-functional asr model |
| | | # use vad, punc, spk or not as you need |
| | | model = AutoModel(model="paraformer-zh", model_revision="v2.0.4", |
| | | vad_model="fsmn-vad", vad_model_revision="v2.0.4", |
| | | punc_model="ct-punc-c", punc_model_revision="v2.0.4", |
| | | # spk_model="cam++", spk_model_revision="v2.0.2", |
| | | ) |
| | | res = model.generate(input=f"{model.model_path}/example/asr_example.wav", |
| | | batch_size_s=300, |
| | | hotword='魔搭') |
| | | print(res) |
| | | ``` |
| | | 注:`model_hub`:表示模型仓库,`ms`为选择modelscope下载,`hf`为选择huggingface下载。 |
| | | |
| | | 如果您希望使用ModelScope中预训练好的工业模型,进行推理或者微调训练,您可以参考下面指令: |
| | | |
| | | ### 实时语音识别 |
| | | |
| | | ```python |
| | | from modelscope.pipelines import pipeline |
| | | from modelscope.utils.constant import Tasks |
| | | from funasr import AutoModel |
| | | |
| | | inference_pipeline = pipeline( |
| | | task=Tasks.auto_speech_recognition, |
| | | model='damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch', |
| | | ) |
| | | chunk_size = [0, 10, 5] #[0, 10, 5] 600ms, [0, 8, 4] 480ms |
| | | encoder_chunk_look_back = 4 #number of chunks to lookback for encoder self-attention |
| | | decoder_chunk_look_back = 1 #number of encoder chunks to lookback for decoder cross-attention |
| | | |
| | | rec_result = inference_pipeline(audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav') |
| | | print(rec_result) |
| | | # {'text': '欢迎大家来体验达摩院推出的语音识别模型'} |
| | | model = AutoModel(model="paraformer-zh-streaming", model_revision="v2.0.4") |
| | | |
| | | import soundfile |
| | | import os |
| | | |
| | | wav_file = os.path.join(model.model_path, "example/asr_example.wav") |
| | | speech, sample_rate = soundfile.read(wav_file) |
| | | chunk_stride = chunk_size[1] * 960 # 600ms |
| | | |
| | | cache = {} |
| | | total_chunk_num = int(len((speech)-1)/chunk_stride+1) |
| | | for i in range(total_chunk_num): |
| | | speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] |
| | | is_final = i == total_chunk_num - 1 |
| | | res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size, encoder_chunk_look_back=encoder_chunk_look_back, decoder_chunk_look_back=decoder_chunk_look_back) |
| | | print(res) |
| | | ``` |
| | | |
| | | 更多例子可以参考([点击此处](https://alibaba-damo-academy.github.io/FunASR/en/modelscope_pipeline/quick_start.html)) |
| | | 注:`chunk_size`为流式延时配置,`[0,10,5]`表示上屏实时出字粒度为`10*60=600ms`,未来信息为`5*60=300ms`。每次推理输入为`600ms`(采样点数为`16000*0.6=960`),输出为对应文字,最后一个语音片段输入需要设置`is_final=True`来强制输出最后一个字。 |
| | | |
| | | ### 语音端点检测(非实时) |
| | | ```python |
| | | from funasr import AutoModel |
| | | |
| | | ### 学术模型egs |
| | | model = AutoModel(model="fsmn-vad", model_revision="v2.0.4") |
| | | |
| | | 如果您希望从头开始训练,通常为学术模型,您可以通过下面的指令启动训练与推理: |
| | | |
| | | ```shell |
| | | cd egs/aishell/paraformer |
| | | . ./run.sh --CUDA_VISIBLE_DEVICES="0,1" --gpu_num=2 |
| | | wav_file = f"{model.model_path}/example/asr_example.wav" |
| | | res = model.generate(input=wav_file) |
| | | print(res) |
| | | ``` |
| | | |
| | | 更多例子可以参考([点击此处](https://alibaba-damo-academy.github.io/FunASR/en/academic_recipe/asr_recipe.html)) |
| | | ### 语音端点检测(实时) |
| | | ```python |
| | | from funasr import AutoModel |
| | | |
| | | <a name="联系我们"></a> |
| | | chunk_size = 200 # ms |
| | | model = AutoModel(model="fsmn-vad", model_revision="v2.0.4") |
| | | |
| | | import soundfile |
| | | |
| | | wav_file = f"{model.model_path}/example/vad_example.wav" |
| | | speech, sample_rate = soundfile.read(wav_file) |
| | | chunk_stride = int(chunk_size * sample_rate / 1000) |
| | | |
| | | cache = {} |
| | | total_chunk_num = int(len((speech)-1)/chunk_stride+1) |
| | | for i in range(total_chunk_num): |
| | | speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride] |
| | | is_final = i == total_chunk_num - 1 |
| | | res = model.generate(input=speech_chunk, cache=cache, is_final=is_final, chunk_size=chunk_size) |
| | | if len(res[0]["value"]): |
| | | print(res) |
| | | ``` |
| | | |
| | | ### 标点恢复 |
| | | ```python |
| | | from funasr import AutoModel |
| | | |
| | | model = AutoModel(model="ct-punc", model_revision="v2.0.4") |
| | | |
| | | res = model.generate(input="那今天的会就到这里吧 happy new year 明年见") |
| | | print(res) |
| | | ``` |
| | | |
| | | ### 时间戳预测 |
| | | ```python |
| | | from funasr import AutoModel |
| | | |
| | | model = AutoModel(model="fa-zh", model_revision="v2.0.0") |
| | | |
| | | wav_file = f"{model.model_path}/example/asr_example.wav" |
| | | text_file = f"{model.model_path}/example/text.txt" |
| | | res = model.generate(input=(wav_file, text_file), data_type=("sound", "text")) |
| | | print(res) |
| | | ``` |
| | | 更多详细用法([示例](https://github.com/alibaba-damo-academy/FunASR/tree/main/examples/industrial_data_pretraining)) |
| | | |
| | | |
| | | <a name="服务部署"></a> |
| | | ## 服务部署 |
| | | FunASR支持预训练或者进一步微调的模型进行服务部署。目前支持以下几种服务部署: |
| | | |
| | | - 中文离线文件转写服务(CPU版本),已完成 |
| | | - 中文流式语音识别服务(CPU版本),已完成 |
| | | - 英文离线文件转写服务(CPU版本),已完成 |
| | | - 中文离线文件转写服务(GPU版本),进行中 |
| | | - 更多支持中 |
| | | |
| | | 详细信息可以参阅([服务部署文档](runtime/readme_cn.md))。 |
| | | |
| | | |
| | | <a name="社区交流"></a> |
| | | ## 联系我们 |
| | | |
| | | 如果您在使用中遇到困难,可以通过以下方式联系我们 |
| | | |
| | | - 邮件: [funasr@list.alibaba-inc.com](funasr@list.alibaba-inc.com) |
| | | 如果您在使用中遇到问题,可以直接在github页面提Issues。欢迎语音兴趣爱好者扫描以下的钉钉群或者微信群二维码加入社区群,进行交流和讨论。 |
| | | |
| | | | 钉钉群 | 微信 | |
| | | |:---------------------------------------------------------------------:|:-----------------------------------------------------:| |
| | | | <div align="left"><img src="docs/images/dingding.jpg" width="250"/> | <img src="docs/images/wechat.png" width="232"/></div> | |
| | | | <div align="left"><img src="docs/images/dingding.jpg" width="250"/> | <img src="docs/images/wechat.png" width="215"/></div> | |
| | | |
| | | ## 社区贡献者 |
| | | |
| | | | <div align="left"><img src="docs/images/damo.png" width="180"/> | <div align="left"><img src="docs/images/nwpu.png" width="260"/> | <img src="docs/images/China_Telecom.png" width="200"/> </div> | <img src="docs/images/RapidAI.png" width="200"/> </div> | <img src="docs/images/aihealthx.png" width="200"/> </div> | |
| | | |:---------------------------------------------------------------:|:---------------------------------------------------------------:|:--------------------------------------------------------------:|:-------------------------------------------------------:|:-----------------------------------------------------------:| |
| | | | <div align="left"><img src="docs/images/alibaba.png" width="260"/> | <div align="left"><img src="docs/images/nwpu.png" width="260"/> | <img src="docs/images/China_Telecom.png" width="200"/> </div> | <img src="docs/images/RapidAI.png" width="200"/> </div> | <img src="docs/images/aihealthx.png" width="200"/> </div> | <img src="docs/images/XVERSE.png" width="250"/> </div> | |
| | | |:------------------------------------------------------------------:|:---------------------------------------------------------------:|:--------------------------------------------------------------:|:-------------------------------------------------------:|:-----------------------------------------------------------:|:------------------------------------------------------:| |
| | | |
| | | 贡献者名单请参考([点击此处](./Acknowledge)) |
| | | 贡献者名单请参考([致谢名单](./Acknowledge.md)) |
| | | |
| | | |
| | | ## 许可协议 |
| | | 项目遵循[The MIT License](https://opensource.org/licenses/MIT)开源协议。 工业模型许可协议请参考([点击此处](./MODEL_LICENSE)) |
| | | 项目遵循[The MIT License](https://opensource.org/licenses/MIT)开源协议,模型许可协议请参考([模型协议](./MODEL_LICENSE)) |
| | | |
| | | |
| | | ## Stargazers over time |
| | | |
| | | [](https://starchart.cc/alibaba-damo-academy/FunASR) |
| | | |
| | | ## 论文引用 |
| | | |
| | |
| | | year={2023}, |
| | | booktitle={INTERSPEECH}, |
| | | } |
| | | @inproceedings{An2023bat, |
| | | author={Keyu An and Xian Shi and Shiliang Zhang}, |
| | | title={BAT: Boundary aware transducer for memory-efficient and low-latency ASR}, |
| | | year={2023}, |
| | | booktitle={INTERSPEECH}, |
| | | } |
| | | @inproceedings{gao22b_interspeech, |
| | | author={Zhifu Gao and ShiLiang Zhang and Ian McLoughlin and Zhijie Yan}, |
| | | title={{Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition}}, |
| | |
| | | pages={2063--2067}, |
| | | doi={10.21437/Interspeech.2022-9996} |
| | | } |
| | | @article{shi2023seaco, |
| | | author={Xian Shi and Yexin Yang and Zerui Li and Yanni Chen and Zhifu Gao and Shiliang Zhang}, |
| | | title={{SeACo-Paraformer: A Non-Autoregressive ASR System with Flexible and Effective Hotword Customization Ability}}, |
| | | year=2023, |
| | | journal={arXiv preprint arXiv:2308.03266(accepted by ICASSP2024)}, |
| | | } |
| | | ``` |