speechbrain
Guides SpeechBrain package use, pretrained inference, recipes, audio pipelines, model components, metrics, and repo maintenance for speech and conversational-AI workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- speechbrain
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides SpeechBrain package use, pretrained inference, recipes, audio pipelines, model components, metrics, and repo maintenance for speech and conversational-AI workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation-and-environment.md4.4 KB
- 参考文档references/repo-provenance.md2.7 KB
- 参考文档references/repo-routing-metadata.json502 B
- 参考文档references/troubleshooting.md4.7 KB
- 脚本scripts/check_speechbrain_install.py3.7 KB
03 SKILL.md 正文
SpeechBrain repo skill
Use this skill when a task involves the SpeechBrain Python package, SpeechBrain recipes, pretrained SpeechBrain models, HyperPyYAML experiment files, audio/data pipelines, speech preprocessing, speech metrics, or maintaining the SpeechBrain repository.
SpeechBrain is a PyTorch-based speech and conversational-AI toolkit. It exposes both a library (speechbrain) and a large recipe collection. Start here to choose the right focused route, then read only the linked sub-skill/reference needed for the task.
Quick install and import check
For ordinary package use:
pip install speechbrain
python - <<'PY'
import speechbrain as sb
print(sb.__version__)
print(sb.Brain)
PY
For local recipe development from a source checkout, install the repository and its dependencies in an isolated environment:
pip install -r requirements.txt
pip install --editable .
python -m pip check
Run the bundled environment smoke script when diagnosing setup or optional dependency issues:
python scripts/check_speechbrain_install.py --json
Read references/installation-and-environment.md for dependency, Python/Torch, audio backend, Hugging Face, and CPU/GPU notes. Read references/troubleshooting.md for cross-cutting install, import, audio, network/cache, and runtime failures.
Route map
| User task | Read |
|---|---|
| Use pretrained models for ASR, speaker verification, classification, enhancement, separation, VAD, TTS, G2P, or local/Hugging Face model loading. | sub-skills/pretrained-inference/SKILL.md |
Run or adapt a recipe, create a new recipe from templates, debug HyperPyYAML overrides, use Brain, or launch CPU/GPU/DDP training. |
sub-skills/recipe-training/SKILL.md |
Load/save audio, build DynamicItemDataset/DataPipeline, train tokenizers, create audio features, apply augmentation, beamforming, or vocal-feature preprocessing. |
sub-skills/data-audio-pipelines/SKILL.md |
Choose neural blocks, decoders, losses, metric stats, WER scoring, checkpoint recovery, Pretrainer, streaming helpers, or component-level tests. |
sub-skills/components-metrics/SKILL.md |
| Maintain the repository: focused tests, recipe CSV consistency, docs generation, performance tables, lint/pre-commit, or contributor review checks. | sub-skills/repo-maintenance/SKILL.md |
Working model
- SpeechBrain experiments are usually a Python script plus a HyperPyYAML file:
python train.py hparams.yaml --override value. speechbrain.Brainowns train/valid/test loops; recipes subclass it and override forward/objective hooks.- Pretrained inference classes inherit
speechbrain.inference.interfaces.Pretrainedand are commonly loaded withClass.from_hparams(source=..., savedir=..., run_opts={...}). - Audio tensors generally follow batch-time-channel conventions. Mono waveforms are often
(batch, time); multi-channel waveforms use an extra channel dimension. - CPU is enough for imports, small fixtures, and many debug examples. Full recipe training and profiling often need CUDA or another accelerator; do not treat a CPU smoke check as proof of GPU throughput.
Evidence, provenance, and routing metadata
- Read
references/repo-provenance.mdbefore checking staleness or refreshing this skill. references/repo-routing-metadata.jsoncontains structured router metadata for managed repo-skill import tooling.- This runtime skill is self-contained. It does not require opening the original SpeechBrain checkout; source-relative evidence paths appear only in provenance and review artifacts.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).