许可协议: Apache-2.0
语言: 法语
库名称: transformers
缩略图: 无
标签:
- 自动语音识别
- hf-asr排行榜
- 鲁棒语音事件
- CTC
- Wav2vec2
数据集:
- Common Voice
- mozilla-foundation/common_voice_11_0
- facebook/multilingual_librispeech
- facebook/voxpopuli
- gigant/african_accented_french
评估指标:
- 词错误率(WER)
模型索引:
- 名称: 针对法语ASR微调的wav2vec2-FR-7K-large模型
结果:
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: Common Voice 11.0
类型: mozilla-foundation/common_voice_11_0
参数: fr
指标:
- 名称: 测试集WER
类型: wer
值: 11.44
- 名称: 测试集WER (+语言模型)
类型: wer
值: 9.66
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: 多语言LibriSpeech (MLS)
类型: facebook/multilingual_librispeech
参数: french
指标:
- 名称: 测试集WER
类型: wer
值: 5.93
- 名称: 测试集WER (+语言模型)
类型: wer
值: 5.13
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: VoxPopuli
类型: facebook/voxpopuli
参数: fr
指标:
- 名称: 测试集WER
类型: wer
值: 9.33
- 名称: 测试集WER (+语言模型)
类型: wer
值: 8.51
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: 非洲口音法语
类型: gigant/african_accented_french
参数: fr
指标:
- 名称: 测试集WER
类型: wer
值: 16.22
- 名称: 测试集WER (+语言模型)
类型: wer
值: 15.39
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: 鲁棒语音事件-开发数据
类型: speech-recognition-community-v2/dev_data
参数: fr
指标:
- 名称: 测试集WER
类型: wer
值: 16.56
- 名称: 测试集WER (+语言模型)
类型: wer
值: 12.96
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: Fleurs
类型: google/fleurs
参数: fr_fr
指标:
- 名称: 测试集WER
类型: wer
值: 10.10
- 名称: 测试集WER (+语言模型)
类型: wer
值: 8.84
针对法语ASR微调的wav2vec2-FR-7K-large模型



本模型是基于LeBenchmark/wav2vec2-FR-7K-large的微调版本,在超过2200小时的法语语音数据集上训练而成,训练数据包含Common Voice 11.0、多语言LibriSpeech、Voxpopuli、多语言TEDx、MediaSpeech和非洲口音法语的训练集和验证集。使用时请确保语音输入采样率为16kHz。
使用方法
- 使用语言模型处理本地音频文件
import torch
import torchaudio
from transformers import AutoModelForCTC, Wav2Vec2ProcessorWithLM
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = AutoModelForCTC.from_pretrained("bhuang/asr-wav2vec2-french").to(device)
processor_with_lm = Wav2Vec2ProcessorWithLM.from_pretrained("bhuang/asr-wav2vec2-french")
model_sample_rate = processor_with_lm.feature_extractor.sampling_rate
wav_path = "example.wav"
waveform, sample_rate = torchaudio.load(wav_path)
waveform = waveform.squeeze(axis=0)
if sample_rate != model_sample_rate:
resampler = torchaudio.transforms.Resample(sample_rate, model_sample_rate)
waveform = resampler(waveform)
input_dict = processor_with_lm(waveform, sampling_rate=model_sample_rate, return_tensors="pt")
with torch.inference_mode():
logits = model(input_dict.input_values.to(device)).logits
predicted_sentence = processor_with_lm.batch_decode(logits.cpu().numpy()).text[0]
- 不使用语言模型处理本地音频文件
import torch
import torchaudio
from transformers import AutoModelForCTC, Wav2Vec2Processor
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = AutoModelForCTC.from_pretrained("bhuang/asr-wav2vec2-french").to(device)
processor = Wav2Vec2Processor.from_pretrained("bhuang/asr-wav2vec2-french")
model_sample_rate = processor.feature_extractor.sampling_rate
wav_path = "example.wav"
waveform, sample_rate = torchaudio.load(wav_path)
waveform = waveform.squeeze(axis=0)
if sample_rate != model_sample_rate:
resampler = torchaudio.transforms.Resample(sample_rate, model_sample_rate)
waveform = resampler(waveform)
input_dict = processor(waveform, sampling_rate=model_sample_rate, return_tensors="pt")
with torch.inference_mode():
logits = model(input_dict.input_values.to(device)).logits
predicted_ids = torch.argmax(logits, dim=-1)
predicted_sentence = processor.batch_decode(predicted_ids)[0]
评估
- 在
mozilla-foundation/common_voice_11_0
上评估
python eval.py \
--model_id "bhuang/asr-wav2vec2-french" \
--dataset "mozilla-foundation/common_voice_11_0" \
--config "fr" \
--split "test" \
--log_outputs \
--outdir "outputs/results_mozilla-foundatio_common_voice_11_0_with_lm"
- 在
speech-recognition-community-v2/dev_data
上评估
python eval.py \
--model_id "bhuang/asr-wav2vec2-french" \
--dataset "speech-recognition-community-v2/dev_data" \
--config "fr" \
--split "validation" \
--chunk_length_s 30.0 \
--stride_length_s 5.0 \
--log_outputs \
--outdir "outputs/results_speech-recognition-community-v2_dev_data_with_lm"