FireRedVAD for fasr (bundled fireredvad inference)
Project description
fasr-vad-firered
基于 FireRedVAD 的语音活动检测模型插件,为 fasr 提供非流式 VAD 能力。
安装
pip install fasr-vad-firered
注册模型
| 注册名 | 类 | 默认 checkpoint | 说明 |
|---|---|---|---|
firered |
FireRedForVAD |
xukaituo/FireRedVAD |
非流式 VAD,基于神经网络的语音段检测 |
模型权重默认从 ModelScope 自动下载。权重目录需包含 cmvn.ark 和 model.pth.tar。
使用方式
在流水线中使用
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="firered")
.add_pipe("recognizer", model="firered_aed", checkpoint_dir="/path/to/asr-ckpt")
.add_pipe("sentencizer", model="ct_transformer")
)
单独使用模型
模型实例化时会自动执行 download_checkpoint() + load_checkpoint():
from fasr.config import registry
from fasr.data import AudioSpan, Waveform
model = registry.vad_models.get("firered")(use_gpu=True, speech_threshold=0.4)
audio = AudioSpan(waveform=Waveform.from_file("example.wav"), start_ms=0)
segments = model.detect(audio)
for seg in segments:
print(f"{seg.start_ms}ms - {seg.end_ms}ms")
# 使用自定义权重目录(需含 cmvn.ark 与 model.pth.tar)
model.load_checkpoint("/path/to/custom/firered-vad")
运行期 / 会话参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
checkpoint |
str | None |
"FireRedTeam/FireRedVAD" |
远程 repo_id;非空时实例化会自动下载 |
cache_dir |
str | Path | None |
None |
缓存目录,None 使用 fasr.utils.get_cache_dir() |
endpoint |
Literal["modelscope", "huggingface", "hf-mirror"] |
"modelscope" |
下载端点 |
use_gpu |
bool |
False |
是否使用 GPU 推理 |
speech_threshold |
float |
0.4 |
语音判定阈值,越小越敏感 |
依赖
fasrtorch >= 2.0.0soundfile >= 0.12.0kaldiio >= 2.18.0、kaldi-native-fbank >= 1.19.0- Python 3.10–3.12
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fasr_vad_firered-0.5.1.tar.gz
(14.6 kB
view details)
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_vad_firered-0.5.1.tar.gz.
File metadata
- Download URL: fasr_vad_firered-0.5.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","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 |
ad222d8e50bed3b98b37329bba271874a7acc72547ede89f8ea7e7bc626c65c4
|
|
| MD5 |
21568bb586c1edde60a4b6b373fa0e3c
|
|
| BLAKE2b-256 |
aa3603019cefc5b55f92fe50ac91786186ca808a75e067b2d1ea2ee73a1baf5e
|
File details
Details for the file fasr_vad_firered-0.5.1-py3-none-any.whl.
File metadata
- Download URL: fasr_vad_firered-0.5.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","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 |
f734c8457b82d46521cee8148db41e88e92fe93155457d6a93af18b78491809c
|
|
| MD5 |
0460e33ee5a8fcf0c5f8b60530fe11c1
|
|
| BLAKE2b-256 |
322b99344701eec2c8dc412f9771a05f9ca92b38909e266fb44c06f4f26505e2
|