paraformer pipeline for fasr
Project description
fasr-paraformer
基于 Paraformer 的语音识别流水线插件,为 fasr 提供离线/流式 ASR、VAD 和标点恢复能力。
安装
# 作为 fasr 工作空间成员安装
uv sync
# 或单独安装
pip install fasr-paraformer
快速开始
import fasr
# 加载预置流水线(自动下载模型)
asr = fasr.load("paraformer")
# 识别音频
audios = asr("example.wav")
print(audios[0].text)
预置流水线
| 流水线名称 | 组件构成 | 说明 |
|---|---|---|
paraformer |
FSMN VAD → Paraformer → CT-Transformer | 通用中文离线识别,带时间戳 |
seaco_paraformer |
FSMN VAD → Seaco-Paraformer → CT-Transformer | 支持热词的离线识别 |
sensevoice |
FSMN VAD → SenseVoice → CT-Transformer | 多语言情感识别 |
# 带热词的识别
asr = fasr.load("seaco_paraformer")
audios = asr("meeting.wav", hotwords=["Paraformer", "语音识别"])
模型组件
ASR 模型
| 注册名 | 类 | 默认 checkpoint | 说明 |
|---|---|---|---|
paraformer |
ParaformerForASR |
iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch |
离线 Paraformer,输出带时间戳的 token |
seaco_paraformer |
SeacoParaformerForASR |
iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch |
支持热词偏置的 Paraformer |
stream_paraformer |
ParaformerForStreamASR |
iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online |
流式 Paraformer (Torch) |
stream_paraformer.onnx |
ParaformerForStreamASROnnx |
同上 | 流式 Paraformer (ONNX) |
VAD 模型
| 注册名 | 类 | 说明 |
|---|---|---|
fsmn |
FSMNForVAD |
FSMN 离线 VAD,ONNX Runtime 推理,内置模型权重 |
stream_fsmn |
FSMNForStreamVAD |
FSMN 流式 VAD (Torch) |
stream_fsmn.onnx |
FSMNForStreamVADOnnx |
FSMN 流式 VAD (ONNX) |
标点模型
| 注册名 | 类 | 默认 checkpoint | 说明 |
|---|---|---|---|
ct_transformer |
CTTransformerForPunc |
iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch |
CT-Transformer 标点恢复,中英文混合 |
自定义流水线
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="fsmn")
.add_pipe("recognizer", model="seaco_paraformer")
.add_pipe("sentencizer", model="ct_transformer")
)
audios = pipeline("audio.wav")
依赖
fasr >= 0.3.7funasrfunasr-onnx >= 0.4.1onnxruntime >= 1.24.3torch >= 2.8.0torchaudio >= 2.8.0- Python 3.10–3.12
项目结构
src/fasr_paraformer/
├── __init__.py # 流水线构建函数 & entry points
├── asset/fsmn-vad/ # 内置 FSMN VAD 模型权重与配置
├── models/
│ ├── asr.py # Paraformer / Seaco-Paraformer
│ ├── vad.py # FSMN VAD
│ ├── pun.py # CT-Transformer 标点恢复
│ ├── stream_asr.py # 流式 Paraformer (Torch / ONNX)
│ └── stream_vad.py # 流式 FSMN VAD (Torch / ONNX)
├── preprocessors/
│ ├── waveform/ # Fbank 特征提取、LFR、CMVN
│ └── text/ # SentencePiece / Char 分词器
└── runtimes/
└── ort.py # ONNX Runtime 推理封装
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fasr_paraformer-0.3.7.post0.tar.gz.
File metadata
- Download URL: fasr_paraformer-0.3.7.post0.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
722ad8643c8cf913af9235b1bae2309095fbe002da82a0cb19cf8cc60e0eda3c
|
|
| MD5 |
10456b59ffee4119609110426b1d0c8a
|
|
| BLAKE2b-256 |
796e907755c84e731d7f44ee317fee522ba8b1c158fbc29092f3fa97d4f725b6
|
File details
Details for the file fasr_paraformer-0.3.7.post0-py3-none-any.whl.
File metadata
- Download URL: fasr_paraformer-0.3.7.post0-py3-none-any.whl
- Upload date:
- Size: 3.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64b0e9ee4e990bc5ce121def4bf76a719e2791a44e959f0655cfe14ae671d9c5
|
|
| MD5 |
bf5659e79f9cf7076a04df78be26e10b
|
|
| BLAKE2b-256 |
12c62322d59b14e340abe88d5a5398166da598f1e6dd9774c389021318c757dd
|