-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
150 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,14 @@ name: Push rapid_paraformer to pypi | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'python/rapid_paraformer/**' | ||
- 'python/docs/doc_whl.md' | ||
- 'python/setup.py' | ||
- '.github/workflows/gen_whl_to_pypi.yml' | ||
# branches: [ main ] | ||
# paths: | ||
# - 'python/rapid_paraformer/**' | ||
# - 'python/docs/doc_whl.md' | ||
# - 'python/setup.py' | ||
# - '.github/workflows/gen_whl_to_pypi.yml' | ||
tags: | ||
- v* | ||
|
||
# env: | ||
# RESOURCES_URL: https://github.com/RapidAI/RapidLatexOCR/releases/download/v0.0.0/models.zip | ||
|
@@ -59,7 +61,7 @@ jobs: | |
pip install -r requirements.txt | ||
python -m pip install --upgrade pip | ||
pip install wheel get_pypi_latest_version | ||
python setup.py bdist_wheel ${{ github.event.head_commit.message }} | ||
python setup.py bdist_wheel ${{ github.ref_name }} | ||
# - name: Publish distribution 📦 to Test PyPI | ||
# uses: pypa/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
*.7z filter=lfs diff=lfs merge=lfs -text | ||
*.arrow filter=lfs diff=lfs merge=lfs -text | ||
*.bin filter=lfs diff=lfs merge=lfs -text | ||
*.bz2 filter=lfs diff=lfs merge=lfs -text | ||
*.ckpt filter=lfs diff=lfs merge=lfs -text | ||
*.ftz filter=lfs diff=lfs merge=lfs -text | ||
*.gz filter=lfs diff=lfs merge=lfs -text | ||
*.h5 filter=lfs diff=lfs merge=lfs -text | ||
*.joblib filter=lfs diff=lfs merge=lfs -text | ||
*.lfs.* filter=lfs diff=lfs merge=lfs -text | ||
*.mlmodel filter=lfs diff=lfs merge=lfs -text | ||
*.model filter=lfs diff=lfs merge=lfs -text | ||
*.msgpack filter=lfs diff=lfs merge=lfs -text | ||
*.npy filter=lfs diff=lfs merge=lfs -text | ||
*.npz filter=lfs diff=lfs merge=lfs -text | ||
*.onnx filter=lfs diff=lfs merge=lfs -text | ||
*.ot filter=lfs diff=lfs merge=lfs -text | ||
*.parquet filter=lfs diff=lfs merge=lfs -text | ||
*.pb filter=lfs diff=lfs merge=lfs -text | ||
*.pickle filter=lfs diff=lfs merge=lfs -text | ||
*.pkl filter=lfs diff=lfs merge=lfs -text | ||
*.pt filter=lfs diff=lfs merge=lfs -text | ||
*.pth filter=lfs diff=lfs merge=lfs -text | ||
*.rar filter=lfs diff=lfs merge=lfs -text | ||
*.safetensors filter=lfs diff=lfs merge=lfs -text | ||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text | ||
*.tar.* filter=lfs diff=lfs merge=lfs -text | ||
*.tar filter=lfs diff=lfs merge=lfs -text | ||
*.tflite filter=lfs diff=lfs merge=lfs -text | ||
*.tgz filter=lfs diff=lfs merge=lfs -text | ||
*.wasm filter=lfs diff=lfs merge=lfs -text | ||
*.xz filter=lfs diff=lfs merge=lfs -text | ||
*.zip filter=lfs diff=lfs merge=lfs -text | ||
*.zst filter=lfs diff=lfs merge=lfs -text | ||
*tfevents* filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,71 @@ | ||
## rapid_paraformer | ||
|
||
<p align="left"> | ||
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a> | ||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a> | ||
<a href="https://pepy.tech/project/rapid_paraformer"><img src="https://static.pepy.tech/personalized-badge/rapid_paraformer?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a> | ||
<a href="https://pypi.org/project/rapid_paraformer/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid_paraformer"></a> | ||
<a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a> | ||
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> | ||
</p> | ||
|
||
- 模型出自阿里达摩院[Paraformer语音识别-中文-通用-16k-离线-large-pytorch](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | ||
- 🎉该项目核心代码已经并入[FunASR](https://github.com/alibaba-damo-academy/FunASR) | ||
- 本仓库仅对模型做了转换,只采用ONNXRuntime推理引擎 | ||
|
||
#### TODO | ||
<div align="center"> | ||
<div align="center"> | ||
<h1><b>Rapid Paraformer</b></h1> | ||
</div> | ||
|
||
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a> | ||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.13-aff.svg"></a> | ||
<a href="https://pepy.tech/project/rapid_paraformer"><img src="https://static.pepy.tech/personalized-badge/rapid_paraformer?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a> | ||
<a href="https://pypi.org/project/rapid_paraformer/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid_paraformer"></a> | ||
<a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a> | ||
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> | ||
</div> | ||
|
||
## 简介 | ||
rapid_paraformer是一个基于阿里达摩院[Paraformer语音识别-中文-通用-16k-离线-large-pytorch](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)的语音识别工具。 | ||
|
||
🎉该项目核心代码已经并入[FunASR](https://github.com/alibaba-damo-academy/FunASR) | ||
|
||
本仓库仅对模型做了转换,只采用ONNXRuntime推理引擎 | ||
|
||
## TODO | ||
- [ ] 整合vad + asr + pun三个模型,打造可部署使用的方案 | ||
|
||
#### 使用步骤 | ||
1. Install | ||
1. 安装`rapid_paraformer` | ||
```bash | ||
pip install rapid_paraformer | ||
``` | ||
2. 下载**resources.zip** ([Google Drive](https://drive.google.com/drive/folders/1RVQtMe0eB_k6G5TJlmXwPELx4VtF2oCw?usp=sharing) | [百度网盘](https://pan.baidu.com/s/1zf8Ta6QxFHY3Z75fHNYKrQ?pwd=6ekq)) | ||
```bash | ||
resources | ||
├── [ 700] config.yaml | ||
└── [4.0K] models | ||
├── [ 11K] am.mvn | ||
├── [824M] asr_paraformerv2.onnx | ||
└── [ 50K] token_list.pkl | ||
``` | ||
3. **asr_paraformerv2.onnx**文件可基于modescope下的notebook环境自助转换: | ||
1. 打开[快速体验](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | ||
2. 打开notebook → Cell中输入以下命令, 执行即可。 | ||
```python | ||
!python -m funasr.export.export_model --model-name 'damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch' --export-dir "./export" | ||
``` | ||
|
||
2. 使用 | ||
```python | ||
from rapid_paraformer import RapidParaformer | ||
config_path = "resources/config.yaml" | ||
paraformer = RapidParaformer(config_path) | ||
wav_path = [ | ||
"test_wavs/0478_00017.wav", | ||
"test_wavs/asr_example_zh.wav", | ||
] | ||
result = paraformer(wav_path) | ||
print(result) | ||
``` | ||
3. 查看结果 | ||
```text | ||
['y', '欢迎大家来体验达摩院推出的语音识别模型'] | ||
## 安装 | ||
```bash | ||
pip install rapid_paraformer | ||
``` | ||
|
||
## 模型下载 | ||
方法一:从Hugging Face上下载([link](https://huggingface.co/SWHL/RapidParaformer)) | ||
```python | ||
from rapid_paraformer import download_hf_model | ||
|
||
download_hf_model(repo_id="SWHL/RapidParaformer", save_dir=".") | ||
``` | ||
|
||
方法二:([Google Drive](https://drive.google.com/drive/folders/1RVQtMe0eB_k6G5TJlmXwPELx4VtF2oCw?usp=sharing) | [百度网盘](https://pan.baidu.com/s/1zf8Ta6QxFHY3Z75fHNYKrQ?pwd=6ekq)) | ||
```bash | ||
resources | ||
├── [ 700] config.yaml | ||
└── [4.0K] models | ||
├── [ 11K] am.mvn | ||
├── [824M] asr_paraformerv2.onnx | ||
└── [ 50K] token_list.pkl | ||
``` | ||
|
||
## 模型转换 | ||
基于modescope下的notebook环境自助转换: | ||
1. 打开[快速体验](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary) | ||
2. 打开notebook → Cell中输入以下命令, 执行即可。 | ||
```bash | ||
!python -m funasr.export.export_model --model-name 'damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch' --export-dir "./export" | ||
``` | ||
|
||
## 使用 | ||
```python | ||
from rapid_paraformer import RapidParaformer | ||
config_path = "resources/config.yaml" | ||
paraformer = RapidParaformer(config_path) | ||
wav_path = [ | ||
"test_wavs/0478_00017.wav", | ||
"test_wavs/asr_example_zh.wav", | ||
] | ||
result = paraformer(wav_path) | ||
print(result) | ||
# ['y', '欢迎大家来体验达摩院推出的语音识别模型'] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# -*- encoding: utf-8 -*- | ||
# @Author: SWHL | ||
# @Contact: [email protected] | ||
from rapid_paraformer import RapidParaformer | ||
from rapid_paraformer import RapidParaformer, download_hf_model | ||
|
||
download_hf_model(repo_id="SWHL/RapidParaformer", save_dir=".") | ||
|
||
config_path = "resources/config.yaml" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1 @@ | ||
## rapid_paraformer | ||
|
||
<p align="left"> | ||
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a> | ||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a> | ||
<a href="https://pepy.tech/project/rapid_paraformer"><img src="https://static.pepy.tech/personalized-badge/rapid_paraformer?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a> | ||
<a href="https://pypi.org/project/rapid_paraformer/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid_paraformer"></a> | ||
<a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a> | ||
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> | ||
</p> | ||
|
||
|
||
### Use | ||
1. Install | ||
1. Install the `rapid_paraformer` | ||
```bash | ||
pip install rapid_paraformer | ||
``` | ||
2. Download the **resources.zip** ([Google Drive](https://drive.google.com/drive/folders/1RVQtMe0eB_k6G5TJlmXwPELx4VtF2oCw?usp=sharing) | [Baidu NetDisk](https://pan.baidu.com/s/1zf8Ta6QxFHY3Z75fHNYKrQ?pwd=6ekq)) | ||
```bash | ||
resources | ||
├── [ 700] config.yaml | ||
└── [4.0K] models | ||
├── [ 11K] am.mvn | ||
├── [824M] asr_paraformerv2.onnx | ||
└── [ 50K] token_list.pkl | ||
``` | ||
2. Use | ||
```python | ||
from rapid_paraformer import RapidParaformer | ||
config_path = "resources/config.yaml" | ||
paraformer = RapidParaformer(config_path) | ||
wav_path = [ | ||
"test_wavs/0478_00017.wav", | ||
"test_wavs/asr_example_zh.wav", | ||
] | ||
result = paraformer(wav_path) | ||
print(result) | ||
``` | ||
|
||
### See details for [RapidASR](https://github.com/RapidAI/RapidASR). | ||
See [link](https://github.com/RapidAI/RapidASR/tree/main/python) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- encoding: utf-8 -*- | ||
# @Author: SWHL | ||
# @Contact: [email protected] | ||
from .rapid_paraformer import RapidParaformer | ||
from .main import RapidParaformer | ||
from .utils import download_hf_model |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
librosa | ||
numpy | ||
onnxruntime | ||
scipy | ||
typeguard==2.13.3 | ||
huggingface_hub |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.