Metadata-Version: 2.4
Name: fasr
Version: 0.5.2
Summary: FASR: Fast Automatic Speech Recognition Pipeline
Author-email: osc <790990241@qq.com>
Requires-Python: <3.13,>=3.10
Requires-Dist: aiohttp>=3.10.10
Requires-Dist: catalogue>=2.0.10
Requires-Dist: confection<2,>=1.3.3
Requires-Dist: docarray==0.40
Requires-Dist: editdistance>=0.8.1
Requires-Dist: huggingface-hub>=0.27.0
Requires-Dist: joblib>=1.4.2
Requires-Dist: jsonargparse[signatures,urls]>=4.38
Requires-Dist: kaldifst>=1.7.14
Requires-Dist: loguru>=0.7.2
Requires-Dist: modelscope>=1.19.1
Requires-Dist: nest-asyncio>=1.6.0
Requires-Dist: numpy>=1.24
Requires-Dist: protobuf>=3.20.0
Requires-Dist: pydantic>=2.9.2
Requires-Dist: soundfile>=0.12.1
Requires-Dist: soxr>=0.5.0
Requires-Dist: wasabi>=1.1.3
Provides-Extra: benchmark
Requires-Dist: pyaudio>=0.2.14; extra == 'benchmark'
Provides-Extra: litdata
Requires-Dist: litdata>=0.2.46; extra == 'litdata'
Provides-Extra: service
Requires-Dist: fasr-service-fastapi; extra == 'service'
Description-Content-Type: text/markdown

<p align="center">
  <img src="assets/logo.svg" alt="fasr logo" width="180">
</p>

# fasr

`fasr` is a production-ready Python speech inference framework built around a
composable `AudioPipeline`.

It lets you combine VAD, ASR, punctuation restoration, language identification,
and custom components for offline transcription, batch jobs, and online
services.

📖 Chinese README: [README_ZH.md](README_ZH.md)

## Key Features

- Plugin-based model ecosystem with install-on-demand model packages.
- Unified data structures and component interfaces for easier composition.
- Asynchronous component execution for better CPU / GPU utilization.
- Production-oriented pipeline design for batch, streaming, and service use.

## Quick Start

Install the plugins you need first:

```bash
pip install fasr-vad-fsmn fasr-asr-paraformer fasr-punc-ct-transformer
```

Build a pipeline and run inference:

```python
from fasr import AudioPipeline

asr = (
    AudioPipeline()
    .add_pipe("detector", model="fsmn")
    .add_pipe("recognizer", model="paraformer")
    .add_pipe("sentencizer", model="ct_transformer")
)

audios = asr.run(["1.wav", "2.wav", "3.wav"])
for audio in audios:
    print(audio.text)
    # if your audio has multiple channels, you can use audio.channels to get the text of each channel
    for channel in audio.channels:
        print(channel.text)
```

## Supported Models

`fasr` discovers models through plugin packages. The following models are
currently supported in this repository:

| Capability | Registered model IDs | Plugin packages |
|---|---|---|
| VAD | `marblenet`, `fsmn`, `fsmn_online`, `firered`, `stream_silero` | `fasr-vad-marblenet`, `fasr-vad-fsmn`, `fasr-vad-firered`, `fasr-vad-silero` |
| ASR | `qwen3asr`, `qwen3_0_6b`, `qwen3_1_7b`, `stream_qwen3_0_6b`, `stream_qwen3_1_7b`, `paraformer`, `seaco_paraformer`, `paraformer_online`, `firered_aed`, `firered_llm`, `fun_asr_nano` | `fasr-asr-qwen3asr`, `fasr-asr-paraformer`, `fasr-asr-firered`, `fasr-asr-funasr` |
| Punctuation | `ct_transformer` | `fasr-punc-ct-transformer` |
| LID | `firered` | `fasr-lid-firered` |

## Service Deployment

FastAPI service support is provided by the optional `fasr-service-fastapi`
plugin. Install the service extra and start the service:

```bash
pip install fasr-service-fastapi
fasr init --cfg config.cfg
fasr serve --cfg config.cfg
```

You can also inspect the generated config:

```bash
fasr serve --print_default_config true
fasr serve --write_default_config run.cfg
```

Service routers are config-driven. If `[service.transcribe_router]` is omitted,
batch endpoints such as `POST /transcribe` and `POST /inference` are not
mounted. If `[service.realtime_router]` is omitted, realtime websocket
endpoints are not mounted. At least one router must be configured.

## Model Plugin Guide

Model plugin implementation details live in
[docs/model-plugins.md](docs/model-plugins.md).
