# ASRT

> A self-hosted Chinese speech-recognition system you can train yourself, with HTTP and gRPC servers

- Category: Multimodal Generation / Audio, Music & Voice
- Language: Python
- Licence: GPL-3.0
- Repository: https://github.com/nl8590687/ASRT_SpeechRecognition
- Website: https://www.ailemon.net/asrt
- Canonical page: https://ai-tldr.dev/tools/asrt/

## In short

ASRT is a deep-learning Chinese speech-recognition system built on TensorFlow/Keras. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed GPL-3.0. To get started: run the service with Docker.

## Overview

ASRT is a deep-learning Chinese speech-recognition system built on TensorFlow/Keras. It is a complete pipeline rather than a single model: an acoustic stage turns audio into a Mandarin pinyin sequence, and a separate language stage turns that pinyin sequence into Chinese characters. The acoustic model is a deep convolutional network with CTC, and the project also draws on LSTM and attention components; the language model is a maximum-entropy hidden Markov model over a probabilistic graph.

Its unusual selling point among speech tools is that training is a first-class path, not an afterthought. The repository ships the training, evaluation and single-file prediction scripts, and its default configuration already wires up six public Mandarin corpora — Thchs30, ST-CMDS, Primewords, aishell-1, aidatatang200 and MagicData — so you can reproduce the model rather than only consume it. Several model variants (24, 25, 251 and 251bn) are selectable in code, input audio runs up to 16 seconds, and the project reports that its best model reaches roughly 85% pinyin accuracy on its test set.

For deployment, ASRT exposes the recognizer as a service over both HTTP and gRPC, with matching client scripts for a quick end-to-end check, and publishes a Docker image that runs CPU-only inference without any training setup. Pre-trained weights ship inside the release server bundles on the project's download page and in the GitHub Releases assets. The project is GPL-3.0 licensed and its documentation is primarily in Chinese.

## What it does

- Full Chinese ASR pipeline: a DCNN + CTC acoustic model producing pinyin, and a maximum-entropy HMM language model producing characters
- Training, evaluation and single-file prediction scripts included, with six Mandarin corpora configured by default
- Selectable model variants (24, 25, 251, 251bn) and support for up to 16 seconds of input audio
- API servers over both HTTP and gRPC, each with a matching client script for verification
- A published Docker image for CPU-only inference deployment
- Pre-trained models distributed in the release server bundles and GitHub Releases assets

## Getting started

ASRT can be run two ways: pull the Docker image for inference only, or clone the repository and set up datasets if you intend to train. Training needs an NVIDIA GPU with 11GB or more; inference does not.

1. Run the service with Docker

   The fastest path. This runs inference only — no training — and exposes the HTTP and gRPC ports.

```bash
docker pull ailemondocker/asrt_service:1.3.0
docker run --rm -it -p 20001:20001 -p 20002:20002 --name asrt-server -d ailemondocker/asrt_service:1.3.0
```

2. Clone the repository and prepare data

   For training, clone the project, create a data directory, and unpack the downloaded corpora into it.

```bash
git clone https://github.com/nl8590687/ASRT_SpeechRecognition.git
cd ASRT_SpeechRecognition
mkdir /data/speech_data
tar zxf <dataset-archive> -C /data/speech_data/
python download_default_datalist.py
```

3. Train and evaluate

   Training needs Python 3.9+ and TensorFlow 2.5+. Evaluation expects the model path in the code to exist.

```bash
python3 train_speech_model.py
python3 evaluate_speech_model.py
```

4. Recognise a file, or serve the model

   predict_speech_file.py transcribes a single audio file. The server scripts expose the model over HTTP or gRPC, and the client scripts check that the endpoint answers.

```bash
python3 predict_speech_file.py

python3 asrserver_http.py
python3 client_http.py

python3 asrserver_grpc.py
python3 client_grpc.py
```

## When to use it

- Reach for it when Mandarin audio has to be transcribed on your own hardware with no cloud speech API in the path
- Reach for it when you need to retrain or fine-tune a Chinese acoustic model on your own corpus rather than accept a fixed vendor model
- Reach for it when an existing service needs a speech endpoint it can call over gRPC as well as HTTP
- Reach for it as a teaching reference for the classic CTC acoustic model plus separate pinyin-to-character language model design
