🚀 克里奥尔语微调版Whisper Medium模型
本模型是基于openai/whisper-medium在克里奥尔语文本语音数据集上进行微调的版本。其主要目标是创建一个准确率达99%的海地克里奥尔语语音转文字模型,能够转录不同口音、地区和说话风格的海地语音。
🚀 快速开始
本模型可用于多种场景的海地克里奥尔语语音转录,如语音笔记、广播节目、访谈等,还能为语音助手、转录服务等提供支持。
✨ 主要特性
- 架构:Whisper Medium
- 微调语言:海地克里奥尔语(Kreyòl Ayisyen)
- 词汇表:基于拉丁字母(克里奥尔语正字法),保留变音符号和语言细微差别。
- 语音类型:使用女性合成语音制作。
- 采样率:16kHz
- 训练目标:最大化日常克里奥尔语语音的转录准确率
📦 安装指南
文档未提及安装步骤,可参考Hugging Face平台上关于transformers
库的安装说明。
💻 使用示例
基础用法
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
import librosa
import numpy as np
import torch
processor = AutoProcessor.from_pretrained("jsbeaudry/whisper-medium-oswald")
model = AutoModelForSpeechSeq2Seq.from_pretrained("jsbeaudry/whisper-medium-oswald")
def transcript (audio_file_path):
speech_array, sampling_rate = librosa.load(audio_file_path, sr=16000)
speech_array_pt = torch.from_numpy(speech_array).unsqueeze(0)
input_features = processor(speech_array, sampling_rate=sampling_rate, return_tensors="pt").input_features
predicted_ids = model.generate(input_features)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
return transcription
text = transcript("/path_audio")
print(text)
高级用法
from transformers import pipeline
import gradio as gr
print("Loading model...")
pipe = pipeline(model="jsbeaudry/whisper-medium-oswald")
print("Model loaded successfully.")
def transcribe(audio_path):
if audio_path is None:
return "Please upload or record an audio file first."
result = pipe(audio_path)
return result["text"]
def create_interface():
with gr.Blocks(title="Whisper Medium - Haitian Creole") as demo:
gr.Markdown("# 🎙️ Whisper Medium Creole ASR")
gr.Markdown(
"Upload an audio file or record your voice in Haitian Creole. "
"Then click **Transcribe** to see the result."
)
with gr.Row():
with gr.Column():
audio_input = gr.Audio(source="upload", type="filepath", label="🎧 Upload Audio")
audio_input2 = gr.Audio(source="microphone", type="filepath", label="🎤 Record Audio")
with gr.Column():
transcribe_button = gr.Button("🔍 Transcribe")
output_text = gr.Textbox(label="📝 Transcribed Text", lines=4)
transcribe_button.click(fn=transcribe, inputs=audio_input, outputs=output_text)
transcribe_button.click(fn=transcribe, inputs=audio_input2, outputs=output_text)
return demo
if __name__ == "__main__":
interface = create_interface()
interface.launch()
📚 详细文档
预期用途
- 转录海地克里奥尔语语音:可用于语音笔记、广播节目、访谈、公开演讲、教育内容、合成语音等。
- 启用克里奥尔语语音接口:可应用于语音助手、转录服务、语言学习工具、聊天机器人和无障碍平台等。
局限性
- 可能存在困难的情况:
- 大量代码切换的语音(克里奥尔语 + 法语/英语混合)
- 音频质量极差(如背景噪音大)
- 某些方言中语速极快或含糊不清的语音
- 长时间的音频文件
- 未针对低资源设备进行实时转录优化
- 在特定数据集上进行微调,可能对完全未见的语音类型或罕见口音的泛化能力较差
训练和评估数据
该模型在克里奥尔语文本语音数据集上进行训练,该数据集包括:
- 5小时的海地克里奥尔语合成语音
- 按照标准克里奥尔语正字法标注的、时间对齐的文本转录
下一步数据来源
- 公共领域的广播和播客存档
- 开放访问的访谈和口语音频
- 社区提交的语音样本
预处理步骤
- 语音活动检测(VAD)
- 噪声过滤和音频归一化
- 手动转录审核和修正
训练超参数
- 学习率:1e-05
- 训练批次大小:16
- 评估批次大小:8
- 随机种子:42
- 优化器:使用OptimizerNames.ADAMW_TORCH,β值为(0.9, 0.999),ε值为1e-08,无额外优化器参数
- 学习率调度器类型:线性
- 学习率调度器热身步数:500
- 训练轮数:5
- 混合精度训练:原生自动混合精度(Native AMP)
框架版本
- Transformers 4.46.1
- Pytorch 2.6.0+cu124
- Datasets 3.5.0
- Tokenizers 0.20.3
🔧 技术细节
本模型基于OpenAI的Whisper架构,通过迁移学习和在高质量的海地克里奥尔语音频 - 文本对数据集上进行微调,使其适应海地克里奥尔语。在训练过程中,使用了特定的超参数和优化器,以最大化日常克里奥尔语语音的转录准确率。
📄 许可证
本模型使用Apache 2.0许可证。
📌 引用
如果您使用此模型,请引用:
@misc{whispermediumcreoleoswald2025,
title={Whisper Medium Creole - Oswald},
author={Jean sauvenel beaudry},
year={2025},
howpublished={\url{https://huggingface.co/solvexalab/whisper-medium-creole-oswald}}
}