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 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 语音判定阈值,越小越敏感

依赖

  • 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.1.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.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

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

Hashes for fasr_vad_firered-0.5.1.tar.gz
Algorithm Hash digest
SHA256 ad222d8e50bed3b98b37329bba271874a7acc72547ede89f8ea7e7bc626c65c4
MD5 21568bb586c1edde60a4b6b373fa0e3c
BLAKE2b-256 aa3603019cefc5b55f92fe50ac91786186ca808a75e067b2d1ea2ee73a1baf5e

See more details on using hashes here.

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

Hashes for fasr_vad_firered-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f734c8457b82d46521cee8148db41e88e92fe93155457d6a93af18b78491809c
MD5 0460e33ee5a8fcf0c5f8b60530fe11c1
BLAKE2b-256 322b99344701eec2c8dc412f9771a05f9ca92b38909e266fb44c06f4f26505e2

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