🚀 Whisper_Cleverlytics
Whisper_Cleverlytics是一款语音识别模型,基于openai/whisper-large-v3
基础模型,使用Voice_Cleverlytics
数据集进行训练,适用于阿拉伯语语音识别任务。
🚀 快速开始
若要运行该模型,首先需通过GitHub仓库安装Transformers库。
pip install --upgrade pip
pip install --upgrade git+https://github.com/huggingface/transformers.git accelerate datasets[audio]
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "smerchi/Arabic-Morocco-Speech_To_Text"
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=False, use_safetensors=True
)
model.to(device)
processor = AutoProcessor.from_pretrained(model_id)
pipe = pipeline(
"automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
max_new_tokens=128,
chunk_length_s=30,
batch_size=16,
return_timestamps=True,
torch_dtype=torch_dtype,
device=device,
)
audio="/content/audio.mp3"
%time result = pipe(audio)
print(result["text"],)
💻 使用示例
基础用法
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "smerchi/Arabic-Morocco-Speech_To_Text"
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=False, use_safetensors=True
)
model.to(device)
processor = AutoProcessor.from_pretrained(model_id)
pipe = pipeline(
"automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
max_new_tokens=128,
chunk_length_s=30,
batch_size=16,
return_timestamps=True,
torch_dtype=torch_dtype,
device=device,
)
audio="/content/audio.mp3"
%time result = pipe(audio)
print(result["text"],)
📚 详细文档
训练超参数
训练过程中使用了以下超参数:
训练结果
文档未提供具体训练结果。
框架版本
- Transformers 4.35.2
- Pytorch 2.0.1+cu117
- Datasets 2.16.0
- Tokenizers 0.14.1
📄 许可证
本项目采用Apache-2.0许可证。
属性 |
详情 |
模型类型 |
基于openai/whisper-large-v3 的语音识别模型 |
训练数据 |
Voice_Cleverlytics 数据集 |