Automatic Speech Recognition
Transformers
PyTorch
TensorBoard
Chinese
whisper
whisper-event
Generated from Trainer
Eval Results (legacy)
Instructions to use thomas0104/whisper_medium_nan_tw with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thomas0104/whisper_medium_nan_tw with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="thomas0104/whisper_medium_nan_tw")# Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("thomas0104/whisper_medium_nan_tw") model = AutoModelForSpeechSeq2Seq.from_pretrained("thomas0104/whisper_medium_nan_tw") - Notebooks
- Google Colab
- Kaggle
File size: 767 Bytes
f958a0b | 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 | import re
import jiwer
p = open('label.txt',encoding="utf-8")
label = p.readline().split('=')[1]
label = eval(label)
label_ch = []
label_rm = []
for i in range(len(label)):
q = re.search('[^A-z]+\s+', str(label[i])).span()
label_ch.append(label[i][:q[1]])
label_rm.append(label[i][q[1]:])
p = open('pred.txt','r',encoding="utf-8")
pred = p.readline().split('=')[1]
pred = eval(pred)
pred_ch = []
pred_rm = []
for i in range(len(pred)):
q = re.search('[^A-z]+\s+', str(pred[i])).span()
pred_ch.append(pred[i][:q[1]])
pred_rm.append(pred[i][q[1]:])
for i in range(len(label_rm)):
if len(label_rm[i]) == 0:
print(i)
label_rm[i] = 'a'
wer_ch = jiwer.wer(label_ch, pred_ch)
print(f'{wer_ch=}')
wer_rm = jiwer.wer(label_rm, pred_rm)
print(f'{wer_rm=}')
|