Views
No views yet
0.88573| Step | Training Loss | Validation Loss |
|---|---|---|
| 50 | 0.3669 | 0.3935 |
| 100 | 0.2040 | 0.2728 |
| 200 | 0.0678 | 0.1421 |
| 400 | 0.0055 | 0.0655 |
| 600 | 0.0033 | 0.0543 |
| 800 | 0.0026 | 0.0450 |
| 1000 | 0.0005 | 0.0440 |
| 1200 | 0.0001 | 0.0417 |
| Region 1 | Region 2 | Region 3 | Region 4 |
|---|---|---|---|
| Barisal | Bhola | Bogura | Brahmanbaria |
| Chittagong | Comilla | Dhaka | Feni |
| Jessore | Jhenaidah | Khulna | Kushtia |
| Lakshmipur | Mymensingh | Natore | Noakhali |
| Pabna | Rajshahi | Rangpur | Sylhet |
pipeline or the transformers library.pipeline (Easiest)1from transformers import pipeline
2
3# Load the pipeline
4pipe = pipeline("automatic-speech-recognition", model="YOUR_USERNAME/YOUR_MODEL_NAME")
5
6# Transcribe an audio file
7transcription = pipe("path_to_audio.wav")
8
9print(transcription["text"])WhisperForConditionalGeneration (Custom)1import librosa
2import torch
3from transformers import WhisperProcessor, WhisperForConditionalGeneration
4
5# Load model and processor
6model_id = "YOUR_USERNAME/YOUR_MODEL_NAME"
7processor = WhisperProcessor.from_pretrained(model_id)
8model = WhisperForConditionalGeneration.from_pretrained(model_id)
9
10# Load audio (resampling to 16kHz is mandatory)
11audio_path = "path_to_audio.wav"
12speech_array, sr = librosa.load(audio_path, sr=16000)
13
14# Process audio
15input_features = processor(speech_array, sampling_rate=16000, return_tensors="pt").input_features
16
17# Generate token ids
18predicted_ids = model.generate(input_features)
19
20# Decode token ids to text
21transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
22
23print(transcription)1e-0528161200450True