Wav2vec2 Large Mms 1b Wolof
模型概述
該模型基於Wav2Vec 2.0架構,針對語音識別任務進行了微調。基礎模型facebook/mms-1b-all是在多語言語料庫上訓練的通用途ASR模型。此微調版本專門在Waxal Wolof數據集上訓練,該數據集包含沃洛夫語的音頻錄音。
模型特點
多語言支持
基於facebook/mms-1b-all模型,支持多語言語音識別。
沃洛夫語優化
專門在沃洛夫語數據集上微調,提升了對沃洛夫語語音特徵的識別準確率。
高效訓練
使用混合精度訓練和Adam優化器,訓練效率高。
模型能力
沃洛夫語語音識別
多語言語音識別
使用案例
語音轉文本
沃洛夫語錄音轉錄
將沃洛夫語的音頻錄音轉錄為文字。
詞錯誤率(WER)為0.1842
🚀 wav2vec2-large-mms-1b-wolof
本模型是基於 facebook/mms-1b-all 在 Isma/alffa_wolof 數據集上進行微調的版本,旨在實現沃洛夫語(Wolof)的自動語音識別(ASR)。
🚀 快速開始
本模型基於Wav2Vec 2.0架構,針對語音識別任務進行了微調。基礎模型 facebook/mms-1b-all 在多語言語料庫上進行訓練,用於通用的自動語音識別。此微調版本專門在包含沃洛夫語音頻記錄的 Waxal Wolof 數據集上進行訓練。
✨ 主要特性
- 基於Wav2Vec 2.0架構,針對沃洛夫語自動語音識別進行微調。
- 可將沃洛夫語音頻轉錄為文本。
📦 安裝指南
! pip install datasets
💻 使用示例
基礎用法
手動推理代碼示例:
# Load test dataset
from datasets import load_dataset, Audio
dataset = load_dataset("perrynelson/waxal-wolof", trust_remote_code=True)
dataset
# Display the first audio using Ipython
from IPython.display import Audio, display
Audio(dataset['train'][322]['audio']['array'], rate=16000)
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import torch
model_id = "bilalfaye/wav2vec2-large-mms-1b-wolof"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Load the model on CPU first
model = Wav2Vec2ForCTC.from_pretrained(model_id,
target_lang="wol",
torch_dtype=torch.float16 # Use half-precision
).to(device)
processor = Wav2Vec2Processor.from_pretrained(model_id)
processor.tokenizer.set_target_lang("wol")
# Process the audio
input_dict = processor(
dataset['train'][322]["audio"]["array"],
sampling_rate=16_000,
return_tensors="pt",
padding=True
)
# Move inputs to the appropriate device for the first processing layer
input_values = input_dict.input_values.to(device, dtype=torch.float16)
# Perform inference
logits = model(input_values).logits
# Decode predictions
pred_ids = torch.argmax(logits, dim=-1)[0]
print("Prediction:")
print(processor.decode(pred_ids))
print("\nReference:")
print(dataset['train'][322]['transcription'].lower())
高級用法
使用pipeline進行推理的代碼示例:
from transformers import pipeline
import torch
# Model ID
model_id = "bilalfaye/wav2vec2-large-mms-1b-wolof"
# Determine device (use GPU if available, otherwise fallback to CPU)
device = 0 if torch.cuda.is_available() else -1
# Use half precision (float16) for inference if GPU is available
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
# Set up the pipeline for automatic speech recognition
pipe = pipeline(
task="automatic-speech-recognition",
model=model_id,
processor=model_id,
device=device, # Specify the device (GPU if available, otherwise CPU)
torch_dtype=torch_dtype, # Set the precision (float16 for half precision, float32 otherwise)
framework="pt" # Use PyTorch as the framework
)
# Input audio processing
audio_array = dataset['train'][322]["audio"]["array"] # Fetching an audio sample
# Run inference
result = pipe(audio_array)
# Prediction
print("Prediction:")
print(result['text'])
# Reference (for comparison)
print("\nReference:")
print(dataset['train'][322]['transcription'].lower())
釋放內存代碼示例
import gc
import torch
import psutil
# Free up unused memory in CUDA (GPU) - only needed if you use a GPU
if torch.cuda.is_available():
torch.cuda.empty_cache() # Clears GPU memory cache
torch.cuda.reset_peak_memory_stats() # Resets memory stats
# Collect any unused memory in Python (CPU)
gc.collect() # Collect unused memory in Python's garbage collector
# Optionally, check memory status after clearing
if torch.cuda.is_available():
print(f"GPU Memory Allocated: {torch.cuda.memory_allocated()} bytes")
print(f"GPU Memory Cached: {torch.cuda.memory_reserved()} bytes")
else:
print(f"CPU Memory Usage: {psutil.virtual_memory().percent}%")
📚 詳細文檔
訓練超參數
訓練過程中使用了以下超參數:
- learning_rate: 0.0001
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 500
- num_epochs: 20
- mixed_precision_training: Native AMP
訓練結果
訓練損失 | 輪數 | 步數 | 驗證損失 | 字錯誤率 |
---|---|---|---|---|
0.3793 | 14.0 | 12250 | 0.1517 | 0.1888 |
0.3709 | 15.0 | 13125 | 0.1512 | 0.1882 |
0.3702 | 16.0 | 14000 | 0.1499 | 0.1858 |
0.367 | 17.0 | 14875 | 0.1492 | 0.1848 |
0.3656 | 18.0 | 15750 | 0.1493 | 0.1842 |
框架版本
- Transformers 4.41.2
- Pytorch 2.4.0+cu121
- Datasets 3.2.0
- Tokenizers 0.19.1
🔧 技術細節
本模型基於Wav2Vec 2.0架構,該架構在語音識別任務中表現出色。基礎模型 facebook/mms-1b-all 在多語言語料庫上進行預訓練,為通用的自動語音識別提供了強大的基礎。微調過程中,使用了沃洛夫語的 Isma/alffa_wolof 數據集,通過調整模型參數,使其更適應沃洛夫語的語音特徵。
📄 許可證
本項目採用MIT許可證。
作者信息
- 作者: Bilal FAYE
⚠️ 重要提示
本模型最適合處理清晰的音頻,對於嘈雜或低質量的錄音可能效果不佳。它是專門為沃洛夫語設計的,對其他語言可能無法正常工作。
Voice Activity Detection
MIT
基於pyannote.audio 2.1版本的語音活動檢測模型,用於識別音頻中的語音活動時間段
語音識別
V
pyannote
7.7M
181
Wav2vec2 Large Xlsr 53 Portuguese
Apache-2.0
這是一個針對葡萄牙語語音識別任務微調的XLSR-53大模型,基於Common Voice 6.1數據集訓練,支持葡萄牙語語音轉文本。
語音識別 其他
W
jonatasgrosman
4.9M
32
Whisper Large V3
Apache-2.0
Whisper是由OpenAI提出的先進自動語音識別(ASR)和語音翻譯模型,在超過500萬小時的標註數據上訓練,具有強大的跨數據集和跨領域泛化能力。
語音識別 支持多種語言
W
openai
4.6M
4,321
Whisper Large V3 Turbo
MIT
Whisper是由OpenAI開發的最先進的自動語音識別(ASR)和語音翻譯模型,經過超過500萬小時標記數據的訓練,在零樣本設置下展現出強大的泛化能力。
語音識別
Transformers 支持多種語言

W
openai
4.0M
2,317
Wav2vec2 Large Xlsr 53 Russian
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的俄語語音識別模型,支持16kHz採樣率的語音輸入
語音識別 其他
W
jonatasgrosman
3.9M
54
Wav2vec2 Large Xlsr 53 Chinese Zh Cn
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的中文語音識別模型,支持16kHz採樣率的語音輸入。
語音識別 中文
W
jonatasgrosman
3.8M
110
Wav2vec2 Large Xlsr 53 Dutch
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53微調的荷蘭語語音識別模型,在Common Voice和CSS10數據集上訓練,支持16kHz音頻輸入。
語音識別 其他
W
jonatasgrosman
3.0M
12
Wav2vec2 Large Xlsr 53 Japanese
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的日語語音識別模型,支持16kHz採樣率的語音輸入
語音識別 日語
W
jonatasgrosman
2.9M
33
Mms 300m 1130 Forced Aligner
基於Hugging Face預訓練模型的文本與音頻強制對齊工具,支持多種語言,內存效率高
語音識別
Transformers 支持多種語言

M
MahmoudAshraf
2.5M
50
Wav2vec2 Large Xlsr 53 Arabic
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53微調的阿拉伯語語音識別模型,在Common Voice和阿拉伯語語音語料庫上訓練
語音識別 阿拉伯語
W
jonatasgrosman
2.3M
37
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98