Skip to main content

TrorYong ASR Model

TrorYongASR, is an Automatic Speech Recognition Model implemented by KrorngAI.

TrorYong (ត្រយ៉ង) is Khmer word for giant ibis, the bird that symbolises Cambodia.

Support My Work

While this work comes truly from the heart, each project represents a significant investment of time -- from deep-dive research and code preparation to the final narrative and editing process. I am incredibly passionate about sharing this knowledge, but maintaining this level of quality is a major undertaking. If you find my work helpful and are in a position to do so, please consider supporting my work with a donation. You can click here to donate or scan the QR code below. Your generosity acts as a huge encouragement and helps ensure that I can continue creating in-depth, valuable content for you.

Using Cambodian bank account, you can donate by scanning my ABA QR code here. (or click here. Make sure that receiver's name is 'Khun Kim Ang'.)

Installation

You can easily install tror-yong-asr using pip command as the following:

pip install tror-yong-asr

To use TrorYongASR, there are few dependencies: transformers, safetensors, and torchaudio.

Usage

Get started with the code below

from transformers import AutoProcessor
from tror_yong_asr import TrorYongASRModel, transcribe, translate, detect_language


model_id = "KrorngAI/TrorYongASR-tiny"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
model = TrorYongASRModel.from_pretrained(model_id)

result1 = detect_language('/path/to/audio_file.mp3', model, processor)
print(result1)

result2 = transcribe('/path/to/audio_file.mp3', model, processor, max_tokens=64)
print(result2)

result3 = translate('/path/to/audio_file.mp3', model, processor, max_tokens=64)
print(result3)

TrorYongASR has 2 pre-trained weights that support Khmer and English:

  • Tiny version with model_id=KrorngAI/TrorYongASR-tiny
  • Small version with model_id=KrorngAI/TrorYongASR-small
Figure 1: TrorYongASR architecture. Dropout layers are omitted due to space constraints, [B], [L], [T], [E], and [P] are begin-of-sequence, language, task, end-of-sequence, and padding tokens, respectively. This figures presents the case having 16 distinct target prediction positions. The QKV-projection is explicitly shown here because particularly for TrorYongASR, the single position basis p is used for each position to directly form query projection The last linear layer outputs logits over the vocabulary set. These logits are then used to compute cross-entropy loss.

Evaluation

TrorYongASR was evaluated on test-split of google/fleurs with code km-kh for Khmer and librispeech.clean for English.

WER Comparison with Whisper:

Tiny Parameters Khmer (fleurs) English (librispeech.clean)
TrorYongASR 29M 75.88% 54.33%
Whisper 39M 100.6% 7.6%
Small Parameters Khmer (fleurs) English (librispeech.clean)
TrorYongASR 135M 50.46% 21.75%
Whisper 244M 104.4% 3.4%

Fine-tune TrorYongASR

Below is the notebook of fine-tuning tutorial.

Open in Colab

If you speak Khmer, you can watch my YouTube video explaining each step of the fine-tuning below.

Watch the video

Note: from version v.1.1 onward, you can use functions push_to_hub, save_pretrained, and from_pretrained like any models of transformers.

from transformers import AutoProcessor
from tror_yong_asr import TrorYongASRModel

original_model_id="KrorngAI/TrorYongASR-tiny"
processor = AutoProcessor.from_pretrained(original_model_id, trust_remote_code=True)
model = TrorYongASRModel.from_pretrained(original_model_id)

new_model_id="your_hf_repo"
processor.push_to_hub(new_model_id)
model.push_to_hub(new_model_id)

Metadata

Release files for tror-yong-asr 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tror-yong-asr 0.2.0
File Size Uploaded Provenance Actions
tror_yong_asr-0.2.0.tar.gz 28.4 kB Without provenance Details for tror_yong_asr-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tror-yong-asr 0.2.0
File Interpreter ABI Platform Actions
tror_yong_asr-0.2.0-py3-none-any.whl Python 3 none any Details for tror_yong_asr-0.2.0-py3-none-any.whl

Total release size: 95.0 kB

Release files / tror_yong_asr-0.2.0.tar.gz

Download URL tror_yong_asr-0.2.0.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
71fd66a8227aa230e1139f20221ff7dcf3642a42c66330b4abb810935ed98fa6
BLAKE2b-256 checksum
How to use checksums
32422e378dc6b3790db4c510a255454fa300889eeb16d80d515b555b07b02b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / tror_yong_asr-0.2.0-py3-none-any.whl

Download URL tror_yong_asr-0.2.0-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeba01f0e42a8bdf4f4764709e28dbd6490f0de9a268e31d2541849c8126fc60
BLAKE2b-256 checksum
How to use checksums
d0c236a6e3b73641dbca41d1f09a924a63652a2aa5e1f9c4212267b386299e71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for tror-yong-asr 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page