🚀 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 數據集 |