Skip to main content

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.arkmodel.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 Waveform

model = registry.vad_models.get("firered")(use_gpu=True, speech_threshold=0.4)

waveform = Waveform.from_file("example.wav")
segments = model.detect(waveform)
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 语音判定阈值,越小越敏感

依赖

  • fasr
  • torch >= 2.0.0
  • soundfile >= 0.12.0
  • kaldiio >= 2.18.0kaldi-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.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fasr_vad_firered-0.5.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file fasr_vad_firered-0.5.0.tar.gz.

File metadata

  • Download URL: fasr_vad_firered-0.5.0.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

Hashes for fasr_vad_firered-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fa0ae4aaa745e7638d688dcdcdabb251976536efe50d1149dda4e718a34c66aa
MD5 9b5e1d713700b80995c5418a3f978be3
BLAKE2b-256 2b4f9e86dcfda2b321626ac1cbdcd1f4c37f56009d6094ebcc36283dbe83a96d

See more details on using hashes here.

File details

Details for the file fasr_vad_firered-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: fasr_vad_firered-0.5.0-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

Hashes for fasr_vad_firered-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7a73c429475a5c8596f9fce8e1d62733982246c8112836e9d2cd7e61d30d14
MD5 2518ece9100de19aaf27d678645511eb
BLAKE2b-256 cf6f010b4d1a4b691205a868630244f6360a9212eb477f7d55242c0ea22005a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page