🚀 马来西亚微调版Whisper Base
本项目在马来西亚数据集上对Whisper Base进行微调,旨在提升其在马来西亚相关语音识别任务中的性能。该项目解决了在马来西亚多语言语音场景下,现有语音识别模型识别准确率不高的问题,为马来西亚地区的语音处理提供了更精准、更适配的解决方案。
🚀 快速开始
本项目在以下数据集上对Whisper Base进行微调:
- IMDA STT,数据集链接
- 伪标签马来西亚YouTube视频,数据集链接
- 马来语对话语音语料库,数据集链接
- Haqkiem TTS数据集,此为私有数据集,你可以从这里请求访问权限
- 伪标签努山塔拉有声读物,数据集链接
脚本链接:https://github.com/mesolitica/malaya-speech/tree/malaysian-speech/session/whisper
Wandb链接:https://wandb.ai/huseinzol05/malaysian-whisper-base?workspace=user-huseinzol05
Wandb报告链接:https://wandb.ai/huseinzol05/malaysian-whisper-base/reports/Finetune-Whisper--Vmlldzo2Mzg2NDgx
✨ 主要特性
支持的微调语言
ms
,马来语,包括标准马来语和当地马来语。
en
,英语,包括标准英语和马来西亚式英语(Manglish)。
💻 使用示例
基础用法
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq, pipeline
from datasets import Audio
import requests
sr = 16000
audio = Audio(sampling_rate=sr)
processor = AutoProcessor.from_pretrained("mesolitica/malaysian-whisper-base")
model = AutoModelForSpeechSeq2Seq.from_pretrained("mesolitica/malaysian-whisper-base")
r = requests.get('https://huggingface.co/datasets/huseinzol05/malaya-speech-stt-test-set/resolve/main/test.mp3')
y = audio.decode_example(audio.encode_example(r.content))['array']
inputs = processor([y], return_tensors = 'pt')
r = model.generate(inputs['input_features'], language='ms', return_timestamps=True)
processor.tokenizer.decode(r[0])
输出结果:
'<|startoftranscript|><|ms|><|transcribe|> Zamily On Aging di Vener Australia, Australia yang telah diadakan pada tahun 1982 dan berasaskan unjuran tersebut maka jabatan perangkaan Malaysia menganggarkan menjelang tahun 2005 sejumlah 15% penduduk kita adalah daripada kalangan warga emas. Untuk makluman Tuan Yang Pertua dan juga Alian Bohon, pembangunan sistem pendafiran warga emas ataupun kita sebutkan event adalah usaha kerajaan ke arah merealisasikan objektif yang telah digangkatkan<|endoftext|>'
高级用法
r = model.generate(inputs['input_features'], language='en', return_timestamps=True)
processor.tokenizer.decode(r[0])
输出结果:
<|startoftranscript|><|en|><|transcribe|> Assembly on Aging, Divina Australia, Australia, which has been provided in 1982 and the operation of the transportation of Malaysia's implementation to prevent the tourism of the 25th, 15% of our population is from the market. For the information of the President and also the respected, the development of the market system or we have made an event.<|endoftext|>
如何预测较长音频
你需要将音频按30秒进行分块,然后对每个样本进行预测。