How netease-youdao/confucius4-r2t2 works
Confucius4-R2T2 is a multilingual ASR inference package centered on append-only streaming transcription, with offline recognition and vLLM/Transformers plus optional llama.cpp decoding. The main path accepts audio, runs chunked inference, and emits stable transcript increments; a WebSocket server exposes streaming inference to clients. The llama package adds native and hybrid backends. Several modules are only partially excerpted, so links for documented capabilities rely on the README and uncertain internal details are omitted.
Main entry points: model.py llama ASR Adapter · r2t2_asr.py R2T2 ASR · ws_server.py WebSocket Server · llama_native_backend.py Native Backend
Components 16
Inference API
- Inference Examples
example.py - R2T2 ASR
r2t2/r2t2_asr.py - Stable Streaming
r2t2/r2t2_asr.py - Offline Recognition
r2t2/r2t2_asr.py - vLLM / HF Backend
r2t2/r2t2_asr.py
Streaming Service
- WebSocket Server
ws_server.py - WebSocket Client
ws_client.py
llama.cpp Backends
- llama ASR Adapter
r2t2_llama/model.py - Native Backend
r2t2_llama/llama_native_backend.py - Hybrid Backend
r2t2_llama/llama_hybrid_backend.py - Native Extension
r2t2_llama/native_ext.cpp - llama Example
r2t2_llama/example_llama.py
Runtime Support
- Debug Helpers
r2t2_llama/debug.py
Other components
- Audio User
- llama-server
- Transcript Output
Connections 19
- Audio User → Inference Examples: provides audio
example.py - Inference Examples → R2T2 ASR: runs inference
example.py - R2T2 ASR → Stable Streaming: supports chunks
README.md - R2T2 ASR → Offline Recognition: supports offline
README.md - Stable Streaming → vLLM / HF Backend: uses backend
r2t2/r2t2_asr.py - Stable Streaming → Transcript Output: emits stable text
README.md - Offline Recognition → Transcript Output: returns text
README.md - Audio User → WebSocket Client: sends audio
ws_client.py - WebSocket Client → WebSocket Server: streams frames
ws_client.py - WebSocket Server → R2T2 ASR: runs ASR
ws_server.py - WebSocket Server → Transcript Output: sends results
ws_server.py - llama Example → llama ASR Adapter: selects backend
r2t2_llama/example_llama.py - llama ASR Adapter → Native Backend: constructs backend
r2t2_llama/model.py - llama ASR Adapter → Hybrid Backend: constructs backend
r2t2_llama/model.py - Native Backend → Native Extension: calls extension
r2t2_llama/llama_native_backend.py - Hybrid Backend → Native Extension: calls extension
r2t2_llama/llama_hybrid_backend.py - Hybrid Backend → vLLM / HF Backend: encodes audio
r2t2_llama/llama_hybrid_backend.py - Native Backend → llama-server: requests inference
r2t2_llama/llama_native_backend.py - llama ASR Adapter → Debug Helpers: uses diagnostics
r2t2_llama/model.py