# wenet-e2e/wenet architecture

> Architecture diagram of the GitHub repository wenet-e2e/wenet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wenet-e2e/wenet
- Repository: https://github.com/wenet-e2e/wenet

## Overview

WeNet is a speech-recognition toolkit spanning model training, Python transcription, and production runtimes across CPU, GPU, and mobile platforms. The primary user workflow is to provide audio through the Python API or CLI, select/load a recognition model, and receive recognized text. The tree also shows training and deployment branches, plus streaming and network-serving runtimes. The sampled source confirms the web demo’s model-selection/transcription calls, C++ feature extraction, and selected client behavior; links for unsampled training and runtime internals are kept conservative.

Main entry points: [`wenet/models`](https://github.com/wenet-e2e/wenet/tree/main/wenet/models) (ASR architectures), [`runtime/core/decoder/asr_decoder.cc`](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_decoder.cc) (ASR decoder), [`wenet/bin/train.py`](https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/train.py) (Training entry), [`runtime/web/app.py`](https://github.com/wenet-e2e/wenet/blob/main/runtime/web/app.py) (Gradio demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python recognition"]
  node_cli["CLI recognition<br/>[recognize.py]"]
  node_api["Python model API<br/>[model.py]"]
  node_transcribe["Transcription<br/>[transcribe.py]"]
end

subgraph group_training["Training and models"]
  node_datasets["Data loading"]
  node_trainer["Training entry<br/>[train.py]"]
  node_models["ASR architectures"]
  node_tokenizers["Text tokenizers"]
  node_checkpoint["Checkpoint averaging<br/>[average_model.py]"]
  node_export["Model export<br/>[export_onnx_cpu.py]"]
end

subgraph group_runtime["Production runtime"]
  node_capi["C++ recognition API<br/>[wenet_api.cc]"]
  node_features["Audio features"]
  node_decoder["ASR decoder<br/>[asr_decoder.cc]"]
  node_grpc["gRPC service<br/>[grpc_server.cc]"]
  node_http["HTTP service<br/>[http_server.cc]"]
  node_websocket["WebSocket service"]
  node_triton["Triton serving"]
end

subgraph group_apps["Client applications"]
  node_webdemo["Gradio demo<br/>[app.py]"]
  node_android["Android client<br/>[Recognize.java]"]
  node_ios["iOS client"]
  node_tritonclient["Triton clients<br/>[speech_client.py]"]
end

node_user(("Audio user"))
node_text["Recognized text"]

node_user -->|"provides audio"| node_api
node_api -->|"transcribes"| node_transcribe
node_transcribe -->|"returns text"| node_text
node_user -->|"submits audio"| node_cli
node_cli -->|"outputs text"| node_text
node_user -->|"records audio"| node_webdemo
node_webdemo -->|"loads models"| node_api
node_webdemo -->|"calls transcription"| node_transcribe
node_trainer -->|"loads training data"| node_datasets
node_trainer -->|"trains models"| node_models
node_trainer -->|"writes checkpoints"| node_checkpoint
node_checkpoint -->|"averages weights"| node_models
node_export -->|"exports model"| node_models
node_capi -->|"accepts audio"| node_features
node_features -->|"supplies features"| node_decoder
node_grpc -->|"dispatches recognition"| node_decoder
node_http -->|"dispatches recognition"| node_decoder
node_websocket -->|"dispatches recognition"| node_decoder
node_tritonclient -->|"sends inference"| node_triton
node_android -.->|"uses native API"| node_capi
node_ios -.->|"uses native API"| node_capi
node_tokenizers -.->|"encodes text"| node_models

click node_cli "https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/recognize.py"
click node_api "https://github.com/wenet-e2e/wenet/blob/main/wenet/cli/model.py"
click node_transcribe "https://github.com/wenet-e2e/wenet/blob/main/wenet/cli/transcribe.py"
click node_webdemo "https://github.com/wenet-e2e/wenet/blob/main/runtime/web/app.py"
click node_datasets "https://github.com/wenet-e2e/wenet/tree/main/wenet/dataset"
click node_trainer "https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/train.py"
click node_models "https://github.com/wenet-e2e/wenet/tree/main/wenet/models"
click node_tokenizers "https://github.com/wenet-e2e/wenet/tree/main/wenet/text"
click node_checkpoint "https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/average_model.py"
click node_export "https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/export_onnx_cpu.py"
click node_capi "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/api/wenet_api.cc"
click node_features "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/frontend/feature_pipeline.cc"
click node_decoder "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_decoder.cc"
click node_grpc "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/grpc/grpc_server.cc"
click node_http "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/http/http_server.cc"
click node_websocket "https://github.com/wenet-e2e/wenet/blob/main/runtime/core/websocket/websocket_server.cc"
click node_triton "https://github.com/wenet-e2e/wenet/tree/main/runtime/gpu/model_repo"
click node_android "https://github.com/wenet-e2e/wenet/blob/main/runtime/android/app/src/main/java/com/mobvoi/wenet/Recognize.java"
click node_ios "https://github.com/wenet-e2e/wenet/blob/main/runtime/ios/WenetDemo/WenetDemo/ViewController.swift"
click node_tritonclient "https://github.com/wenet-e2e/wenet/blob/main/runtime/gpu/client/speech_client.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_api,node_transcribe,node_user toneBlue
class node_datasets,node_trainer,node_models,node_tokenizers,node_checkpoint,node_export toneAmber
class node_capi,node_features,node_decoder,node_grpc,node_http,node_websocket,node_triton toneMint
class node_webdemo,node_android,node_ios,node_tritonclient toneRose
class node_text toneIndigo
```

## Components

### Python recognition

- [CLI recognition](https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/recognize.py): `wenet/bin/recognize.py`
- [Python model API](https://github.com/wenet-e2e/wenet/blob/main/wenet/cli/model.py): `wenet/cli/model.py`
- [Transcription](https://github.com/wenet-e2e/wenet/blob/main/wenet/cli/transcribe.py): `wenet/cli/transcribe.py`

### Training and models

- [Data loading](https://github.com/wenet-e2e/wenet/tree/main/wenet/dataset): `wenet/dataset`
- [Training entry](https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/train.py): `wenet/bin/train.py`
- [ASR architectures](https://github.com/wenet-e2e/wenet/tree/main/wenet/models): `wenet/models`
- [Text tokenizers](https://github.com/wenet-e2e/wenet/tree/main/wenet/text): `wenet/text`
- [Checkpoint averaging](https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/average_model.py): `wenet/bin/average_model.py`
- [Model export](https://github.com/wenet-e2e/wenet/blob/main/wenet/bin/export_onnx_cpu.py): `wenet/bin/export_onnx_cpu.py`

### Production runtime

- [C++ recognition API](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/api/wenet_api.cc): `runtime/core/api/wenet_api.cc`
- [Audio features](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/frontend/feature_pipeline.cc): `runtime/core/frontend/feature_pipeline.cc`
- [ASR decoder](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_decoder.cc): `runtime/core/decoder/asr_decoder.cc`
- [gRPC service](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/grpc/grpc_server.cc): `runtime/core/grpc/grpc_server.cc`
- [HTTP service](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/http/http_server.cc): `runtime/core/http/http_server.cc`
- [WebSocket service](https://github.com/wenet-e2e/wenet/blob/main/runtime/core/websocket/websocket_server.cc): `runtime/core/websocket/websocket_server.cc`
- [Triton serving](https://github.com/wenet-e2e/wenet/tree/main/runtime/gpu/model_repo): `runtime/gpu/model_repo`

### Client applications

- [Gradio demo](https://github.com/wenet-e2e/wenet/blob/main/runtime/web/app.py): `runtime/web/app.py`
- [Android client](https://github.com/wenet-e2e/wenet/blob/main/runtime/android/app/src/main/java/com/mobvoi/wenet/Recognize.java): `runtime/android/app/src/main/java/com/mobvoi/wenet/Recognize.java`
- [iOS client](https://github.com/wenet-e2e/wenet/blob/main/runtime/ios/WenetDemo/WenetDemo/ViewController.swift): `runtime/ios/WenetDemo/WenetDemo/ViewController.swift`
- [Triton clients](https://github.com/wenet-e2e/wenet/blob/main/runtime/gpu/client/speech_client.py): `runtime/gpu/client/speech_client.py`

### Other components

- **Audio user**
- **Recognized text**

## Connections

- Audio user → Python model API: provides audio
- Python model API → Transcription: transcribes
- Transcription → Recognized text: returns text
- Audio user → CLI recognition: submits audio
- CLI recognition → Recognized text: outputs text
- Audio user → Gradio demo: records audio
- Gradio demo → Python model API: loads models
- Gradio demo → Transcription: calls transcription
- Training entry → Data loading: loads training data
- Training entry → ASR architectures: trains models
- Training entry → Checkpoint averaging: writes checkpoints
- Checkpoint averaging → ASR architectures: averages weights
- Model export → ASR architectures: exports model
- C++ recognition API → Audio features: accepts audio
- Audio features → ASR decoder: supplies features
- gRPC service → ASR decoder: dispatches recognition
- HTTP service → ASR decoder: dispatches recognition
- WebSocket service → ASR decoder: dispatches recognition
- Triton clients → Triton serving: sends inference
- Android client → C++ recognition API: uses native API
- iOS client → C++ recognition API: uses native API
- Text tokenizers → ASR architectures: encodes text
