Views
No views yet
transformers library interface.gigaam_transformers.py contains model, feature extractor and tokenizer classes with usual transformers methods. Model can be initialized with transformers auto classes (see an example below).torch 2.7.1torchaudio 2.7.1transformers 4.49.0accelerate 1.5.2transformers ASR models.1from transformers import AutoModel, AutoProcessor
2import torch
3import torchaudio
4
5# load audio
6wav, sr = torchaudio.load("audio.wav")
7# resample if necessary
8wav = torchaudio.functional.resample(wav, sr, 16000)
9
10# load model and processor
11processor = AutoProcessor.from_pretrained("waveletdeboshir/gigaam-ctc", trust_remote_code=True)
12model = AutoModel.from_pretrained("waveletdeboshir/gigaam-ctc", trust_remote_code=True)
13model.eval()
14
15input_features = processor(wav[0], sampling_rate=16000, return_tensors="pt")
16
17# predict
18with torch.no_grad():
19 logits = model(**input_features).logits
20# greedy decoding
21greedy_ids = logits.argmax(dim=-1)
22# decode token ids to text
23transcription = processor.batch_decode(greedy_ids)[0]
24