🎙️ ViStreamASR - Real-Time Vietnamese Speech Recognition
ViStreamASR is a simple Vietnamese Streaming Automatic Speech Recognition library for real-time audio processing.
Features
- 🎯 Streaming ASR: Real-time audio processing with configurable chunk sizes
- 🇻🇳 Vietnamese Optimized: Specifically designed for Vietnamese speech recognition
- 📦 Simple API: Easy-to-use interface with minimal setup
- ⚡ High Performance: CPU/GPU support
Installation
pip install ViStreamASR
Installation from Source
For development or to use the latest version:
# Clone the repository
git clone https://github.com/nguyenvulebinh/ViStreamASR.git
cd ViStreamASR
# Install dependencies
pip install -r requirements.txt
# Option 1: Use directly from source
python test_library.py # Test the installation
# Option 2: Install in development mode
pip install -e .
Using from Source
When using from source, import the modules directly:
import sys
sys.path.insert(0, 'src')
from streaming import StreamingASR
# Initialize and use
asr = StreamingASR()
for result in asr.stream_from_file("audio.wav"):
print(result['text'])
Quick Start
Python API
from ViStreamASR import StreamingASR
# Initialize ASR
asr = StreamingASR()
# Process audio file
for result in asr.stream_from_file("audio.wav"):
if result['partial']:
print(f"Partial: {result['text']}")
if result['final']:
print(f"Final: {result['text']}")
Command Line
# Basic transcription
vistream-asr transcribe audio.wav
API Reference
StreamingASR
from ViStreamASR import StreamingASR
# Initialize with options
asr = StreamingASR(
chunk_size_ms=640, # Chunk size in milliseconds
auto_finalize_after=15.0, # Auto-finalize after seconds
debug=False # Enable debug logging
)
# Stream from file
for result in asr.stream_from_file("audio.wav"):
# result contains:
# - 'partial': True for partial results
# - 'final': True for final results
# - 'text': transcription text
# - 'chunk_info': processing information
pass
Advanced Usage
For low-level control:
from ViStreamASR import ASREngine
engine = ASREngine(chunk_size_ms=640, debug_mode=True)
engine.initialize_models()
# Process audio chunks directly
result = engine.process_audio(audio_chunk, is_last=False)
Model Information
- Language: Vietnamese
- Architecture: U2-based streaming ASR
- Model Size: ~2.7GB (cached after first download)
- Sample Rate: 16kHz (automatically converted)
- Optimal Chunk Size: 640ms
How U2 Streaming Works
The following picture shows how U2 (Unified Streaming and Non-streaming) architecture works:
The U2 model enables both streaming and non-streaming ASR in a unified framework, providing low-latency real-time transcription while maintaining high accuracy.
Performance
- RTF: ~0.34x (faster than real-time)
- Latency: ~640ms with default settings
- GPU Support: Automatic CUDA acceleration when available
Limitations
- Audio Input Assumption: The system assumes audio input is speech. Non-speech audio may produce unexpected results.
- Production Recommendation: For practical use, it's recommended to add VAD (Voice Activity Detection) before running streaming ASR to reduce ASR streaming load and improve efficiency.
CLI Commands
# Transcription
vistream-asr transcribe <file> # Basic transcription
vistream-asr transcribe <file> --chunk-size 640 # Custom chunk size
vistream-asr transcribe <file> --no-debug # Clean output
# Information
vistream-asr info # Library info
vistream-asr version # Version
Requirements
System Requirements
- RAM: Minimum 5GB RAM
- CPU: Minimum 2 cores
- Performance: RTF 0.3-0.4x achievable on CPU-only systems meeting above specs
- GPU: Supports GPU acceleration for better performance, but CPU-only operation still achieves RTF 0.3-0.4x
Software Requirements
- Python 3.8+
- PyTorch 2.5+
- TorchAudio 2.5+
- NumPy 1.19.0+
- Requests 2.25.0+
- flashlight-text
- librosa
License
MIT License
Release files for ViStreamASR 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vistreamasr-0.1.3.tar.gz | 2.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vistreamasr-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.2 MB
Release files / vistreamasr-0.1.3.tar.gz
| Download URL | vistreamasr-0.1.3.tar.gz |
|---|---|
| Size | 2.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c3a8c97eaee683a6a402190aaf18431e9710da5c224edf96398a54b79f78571
|
|
BLAKE2b-256 checksum How to use checksums |
05616492d00ea099b15c444d6bb46550e797737702ae6e970dd0c96fd7fa02d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / vistreamasr-0.1.3-py3-none-any.whl
| Download URL | vistreamasr-0.1.3-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e51c184ecd97addfb63da06818d4d9ff0a73abc4bd8fa7314ebae78bfc22d1f
|
|
BLAKE2b-256 checksum How to use checksums |
9c36997aa4230c1760fd6a72aa136a3b0c5dc44b6905cfbaa3b017d28485ee52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|