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)

Release files for tror-yong-asr 0.1.3

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.1.3
File Size Uploaded
tror_yong_asr-0.1.3.tar.gz 19.5 kB Details

Release files / tror_yong_asr-0.1.3.tar.gz

Download URL tror_yong_asr-0.1.3.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c4c9bbcd8647224c72f05f005ad61099cdf3d44997a1ffa5fe4b7ce1c3d1f9d
BLAKE2b-256 checksum
How to use checksums
b46ac409a4c895a9fe49faac73a853ebac55d6d7a99ee4f8984ff640c8b3c23c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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