File size: 1,475 Bytes
50d045b
 
 
 
 
 
49da3ad
50d045b
676724b
 
49da3ad
676724b
49da3ad
 
676724b
 
 
 
 
 
 
 
 
 
 
 
 
49da3ad
676724b
 
 
 
 
 
 
 
 
 
 
49da3ad
 
 
 
 
 
676724b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
license: apache-2.0
language:
- bn
base_model:
- openai/whisper-small

pipeline_tag: automatic-speech-recognition

---
BengaliRegionalASR trained on bengali regional dialact dataset. 

# Try the model
```py
import os
import librosa
import torch, torchaudio
import numpy as np
from transformers import WhisperTokenizer ,WhisperProcessor, WhisperFeatureExtractor, WhisperForConditionalGeneration
model_path_ = "sha1779/BengaliRegionalASR"
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
feature_extractor = WhisperFeatureExtractor.from_pretrained(model_path_)
tokenizer = WhisperTokenizer.from_pretrained(model_path_)
processor = WhisperProcessor.from_pretrained(model_path_)
model = WhisperForConditionalGeneration.from_pretrained(model_path_).to(device)
model.config.forced_decoder_ids = processor.get_decoder_prompt_ids(language="bengali", task="transcribe")

mp3_path = "https://huggingface.co/sha1779/BengaliRegionalASR/resolve/main/Mp3/common_voice_bn_31617644.mp3"
speech_array, sampling_rate = librosa.load(mp3_path, sr=16000)

speech_array = librosa.resample(np.asarray(speech_array), orig_sr=sampling_rate, target_sr=16000)
input_features = feature_extractor(speech_array, sampling_rate=16000, return_tensors="pt").input_features

predicted_ids = model.generate(inputs=input_features.to(device))[0]

transcription = processor.decode(predicted_ids, skip_special_tokens=True)

print(transcription)

```

# Evaluation
Word Error Rate 0.65 %