Views
No views yet
transformers as follows:1from transformers import pipeline
2
3MODEL_NAME = "biodatlab/whisper-th-medium-combined" # specify the model name
4lang = "th" # change to Thai langauge
5
6device = 0 if torch.cuda.is_available() else "cpu"
7
8pipe = pipeline(
9 task="automatic-speech-recognition",
10 model=MODEL_NAME,
11 chunk_length_s=30,
12 device=device,
13)
14pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(
15 language=lang,
16 task="transcribe"
17)
18text = pipe("audio.mp3")["text"] # give audio mp3 and transcribe text@misc {thonburian_whisper_med,
author = { Atirut Boribalburephan, Zaw Htet Aung, Knot Pipatsrisawat, Titipat Achakulvisut },
title = { Thonburian Whisper: A fine-tuned Whisper model for Thai automatic speech recognition },
year = 2022,
url = { https://huggingface.co/biodatlab/whisper-th-medium-combined },
doi = { 10.57967/hf/0226 },
publisher = { Hugging Face }
}