Views
No views yet
pipeline class with the following code snippet:1import torch
2from transformers import pipeline
3
4device = "cuda" if torch.cuda.is_available() else "cpu"
5torch_dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
6
7lang = "th"
8task = "transcribe"
9
10pipe = pipeline(
11 task="automatic-speech-recognition",
12 model="nectec/Pathumma-whisper-th-medium",
13 torch_dtype=torch_dtype,
14 device=device,
15)
16pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task=task)
17
18text = pipe("audio_path.wav")["text"]
19print(text)@misc{tipaksorn2024PathummaWhisper,
title = { {Pathumma Whisper Medium (TH)} },
author = { Pattara Tipaksorn and Wayupuk Sommuang and Kwanchiva Thangthai },
url = { https://huggingface.co/nectec/Pathumma-whisper-th-medium },
publisher = { Hugging Face },
year = { 2024 },
}