Views
No views yet
1pip install --upgrade pip
2pip install --upgrade transformers acceleratepipeline
class to transcribe audios of arbitrary length:1import torch
2from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
3from datasets import load_dataset
4
5
6device = "cuda:0" if torch.cuda.is_available() else "cpu"
7torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
8
9model_id = "TalTechNLP/whisper-large-v3-turbo-et-subs"
10
11model = AutoModelForSpeechSeq2Seq.from_pretrained(
12 model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
13)
14model.to(device)
15
16processor = AutoProcessor.from_pretrained(model_id)
17
18pipe = pipeline(
19 "automatic-speech-recognition",
20 model=model,
21 tokenizer=processor.tokenizer,
22 feature_extractor=processor.feature_extractor,
23 torch_dtype=torch_dtype,
24 device=device,
25)
26
27audio = "sample.mp3"
28
29result = pipe(sample, generate_kwargs={"task": "transcribe", "language": "et"})
30print(result)@inproceedings{fedorchenko-2025-optimizing,
title = "Optimizing Estonian {TV} Subtitles with Semi-supervised Learning and {LLMs}",
author = {Fedorchenko, Artem and Alum{\"a}e, Tanel},
booktitle = "Proceedings of the 25th Nordic Conference on Computational Linguistics (NoDaLiDa)",
year = "2025"
}