🚀 馬來西亞微調版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秒進行分塊,然後對每個樣本進行預測。