Skip to main content

Vietnamese Streaming Automatic Speech Recognition Library

Project description

🎙️ 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:

U2 Architecture

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vistreamasr-0.1.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vistreamasr-0.1.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file vistreamasr-0.1.1.tar.gz.

File metadata

  • Download URL: vistreamasr-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for vistreamasr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 269bc289210804af07f0f4d03b15e44f32568b285a928e13a21d3b2456c64cb2
MD5 b0ac13acfc18e0ee28c9008475b2ab48
BLAKE2b-256 23e0c69c77dca91dafac8a5eae331385e9bb4991bbbd9abdb8df4c7a9628914b

See more details on using hashes here.

File details

Details for the file vistreamasr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vistreamasr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for vistreamasr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00ef1937265b174afb4e910b90fac65f5d13b88f08ae440d077af9b8cf5c2d01
MD5 8b92dfe3845ea2b415a3e91c9dec2fa9
BLAKE2b-256 c015684502a369213fa380392f3222eff38a54213d2d3bfbf7ae28348c4df9ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page