Downloads · 30 days
65
5% of all-time downloads
juierror/whisper-tiny-thai
whisper-tiny-thai is a automatic speech recognition model from juierror. Use it when you need speech turned into text. It is set up for transformers. The card lists the license as apache-2.0.
This model has been trained and evaluated on three datasets:
Downloads · 30 days
65
5% of all-time downloads
All-time downloads
1.3K
Public
Parameters
37.8M
453 MB on disk
Likes
1
Public
Click a slice to open those files.
.bin151 MB · 50%
From the Hugging Face model README
# visit https://pytorch.org/get-started/locally/ to install pytorch
pip3 install transformers librosa
from transformers import WhisperForConditionalGeneration, WhisperProcessor
import librosa
device = "cuda" # cpu, cuda
model = WhisperForConditionalGeneration.from_pretrained("juierror/whisper-tiny-thai").to(device)
processor = WhisperProcessor.from_pretrained("juierror/whisper-tiny-thai", language="Thai", task="transcribe")
path = "/path/to/audio/file"
def inference(path: str) -> str:
"""
Get the transcription from audio path
Args:
path(str): path to audio file (can be load with librosa)
Returns:
str: transcription
"""
audio, sr = librosa.load(path, sr=16000)
input_features = processor(audio, sampling_rate=16000, return_tensors="pt").input_features
generated_tokens = model.generate(
input_features=input_features.to(device),
max_new_tokens=255,
language="Thai"
).cpu()
transcriptions = processor.tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
return transcriptions[0]
print(inference(path=path))
This model has been trained and evaluated on three datasets:
@techreport{gowajee,
title = {{Gowajee Corpus}},
author = {Ekapol Chuangsuwanich and Atiwong Suchato and Korrawe Karunratanakul and Burin Naowarat and Chompakorn CChaichot
and Penpicha Sangsa-nga and Thunyathon Anutarases and Nitchakran Chaipojjana},
year = {2020},
institution = {Chulalongkorn University, Faculty of Engineering, Computer Engineering Department},
month = {12},
Date-Added = {2021-07-20},
url = {https://github.com/ekapolc/gowajee_corpus}
note = {Version 0.9.2}
}
The Character Error Rate (CER) is calculated by removing spaces in both the labels and predicted text, and then computing the CER. The Word Error Rate (WER) is calculated using the PythaiNLP newmm tokenizer to tokenize both the labels and predicted text, and then computing the WER.
These are the results.
| Dataset | WER | CER |
|---|---|---|
| Common Voice 13 | 23.14 | 6.74 |
| Gowajee | 24.79 | 11.39 |
| Thai Elderly Speech (Smart Home) | 13.28 | 4.14 |
| Thai Elderly Speech (Health Care) | 12.99 | 3.41 |