# Repository Briefing: k2-fsa/sherpa
> Source: https://repoforai.com/repo/k2-fsa/sherpa (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/k2-fsa/sherpa
- **Official Docs / Website**: https://k2-fsa.github.io/sherpa
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: C++
- **License**: Apache-2.0
- **Engineering Health**: A (85/100 · Maintenance 35/35 · Adoption 19/25 · Releases 11/20 · License 20/20)
- **Latest Release**: speaker-recognition-models (2025-01-10) — https://github.com/k2-fsa/sherpa/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Docker, API
- **Momentum**: 1,029 ★ total (+0 24h / +1 7d) · 160 forks
- **Topics**: `asr`, `cpp`, `ctc`, `end-to-end-asr`, `python`, `pytorch`, `speech-recognition`, `transducer`, `websocket`
- **When to Use**: Best for: Teams self-hosting pretrained transducer or CTC speech recognition through a C++ or Python API or a WebSocket service, with the capacity to maintain a PyTorch runtime. Skip if: You need a PyTorch-free mobile or embedded runtime, a training framework, or a managed transcription API that removes inference operations from your team.

## Overview
```text
### Architecture & Core Mechanics
sherpa is a C++ speech-to-text inference framework backed by PyTorch, with C++ and Python APIs for running pretrained end-to-end transducer and CTC models. The application supplies speech audio and uses the selected model to obtain a transcript. WebSocket is a service integration path when the recognizer needs to run separately from its clients, rather than a requirement for in-process API use.

`CMakeLists.txt` and `setup.py` provide native build and Python packaging entry points, respectively, while `python-api-examples/` is a starting point for client integration. `requirements.txt` lists `websockets`, `kaldifeat`, `sentencepiece>=0.1.96`, and `numpy`; the container recipe also installs `torchaudio` and a pinned k2 build. The presence of `triton/` alone does not establish a supported Triton configuration or a production service contract.

### Key Capabilities & Differentiators
The main capability is transcribing speech with pretrained end-to-end transducer and CTC models. That gives teams two model families to evaluate without making the serving framework responsible for training or fine-tuning; those workflows belong in icefall. Use the API surface and examples to validate the inference integration, and test WebSocket separately if browser or remote clients will connect to a recognition service.

Choose the model before committing to a rollout. There are no verified specifications here for language coverage, input audio format, decoding options, partial-result semantics, or serving capacity. A browser demo provides a way to try recognition without installing the stack, but it does not establish the production protocol or what latency and recognition quality to expect on your own audio.

### Trade-offs & Limitations
Compared with a managed Whisper API, self-hosting sherpa gives your team control over where audio is processed and which supported model it runs. In return, the team owns dependency compatibility, model rollout, capacity planning, and service reliability. Neither lower latency nor lower cost follows automatically; compare end-to-end behavior with your model, hardware, concurrency, and network path.

If removing PyTorch or targeting iOS, Android, or embedded systems is a hard requirement, start by evaluating the related projects sherpa-onnx and sherpa-ncnn, which do not depend on PyTorch and cover those platforms. For commercial distribution, Apache-2.0 applies to the sherpa repository; verify the separate terms for your model weights, dependencies, and container base.

### Hardware & Deployment Guide
For the Docker path, check the host NVIDIA driver against the `nvcr.io/nvidia/pytorch:22.12-py3` base and the pinned k2 build, `1.24.4.dev20240223+cuda11.7.torch1.13.1`, before installing or changing runtime components. The recipe installs `torchaudio`, clones icefall under `/workspace`, and adds it to `PYTHONPATH`. The Dockerfile excerpt ends at an incomplete clone line, so it does not establish a runnable image build, a server command, an exposed port, or model mounts.

For direct integration, use the CMake or Python packaging path as appropriate and provision a compatible pretrained model. Profile RAM, VRAM where applicable, and real-time performance under representative stream concurrency rather than sizing from the base image. The January 8–10, 2025 releases are labeled `speaker-segmentation-models`, `vad-models`, and `speaker-recognition-models`; those names do not establish runtime changes or a unified API for these tasks.
```

## Key Capabilities
```text
- Model scope: Pretrained end-to-end transducer and CTC inference; training and fine-tuning belong in icefall.
- Integration: C++ and Python APIs, Python examples in `python-api-examples/`, and a WebSocket service path.
- Dependencies: `websockets`, `kaldifeat`, `sentencepiece>=0.1.96`, and `numpy` are listed in `requirements.txt`.
- Container compatibility: The Dockerfile specifies NVIDIA PyTorch `22.12-py3` and k2 `1.24.4.dev20240223+cuda11.7.torch1.13.1`.
- Release scope: January 2025 entries are labeled for speaker segmentation, voice activity detection, and speaker recognition models; they do not establish a unified service API.
```

## Quick Start / Clone
```bash
git clone --depth 1 https://github.com/k2-fsa/sherpa.git
cd sherpa
```
