模型:

nguyenvulebinh/wav2vec2-base-vi-vlsp2020

英文

模型描述

我们的模型使用了wav2vec2架构,在13000小时的越南YouTube音频(未标记数据)上进行了预训练,并在250小时标记的VLSP ASR数据集(16kHz采样的语音音频)上进行了微调。您可以在此处找到更多描述 here

在VLSP T1测试集上的基准WER结果:

1232321 1233321
without LM 8.66 6.90
with 5-grams LM 6.53 5.32

用法

#pytorch
#!pip install transformers==4.20.0
#!pip install https://github.com/kpu/kenlm/archive/master.zip
#!pip install pyctcdecode==0.4.0
#!pip install huggingface_hub==0.10.0

from transformers.file_utils import cached_path, hf_bucket_url
from importlib.machinery import SourceFileLoader
from transformers import Wav2Vec2ProcessorWithLM
from IPython.lib.display import Audio
import torchaudio
import torch

# Load model & processor
model_name = "nguyenvulebinh/wav2vec2-base-vi-vlsp2020"
model = SourceFileLoader("model", cached_path(hf_bucket_url(model_name,filename="model_handling.py"))).load_module().Wav2Vec2ForCTC.from_pretrained(model_name)
processor = Wav2Vec2ProcessorWithLM.from_pretrained(model_name)

# Load an example audio (16k)
audio, sample_rate = torchaudio.load(cached_path(hf_bucket_url(model_name, filename="t2_0000006682.wav")))
input_data = processor.feature_extractor(audio[0], sampling_rate=16000, return_tensors='pt')

# Infer
output = model(**input_data)

# Output transcript without LM
print(processor.tokenizer.decode(output.logits.argmax(dim=-1)[0].detach().cpu().numpy()))

# Output transcript with LM
print(processor.decode(output.logits.cpu().detach().numpy()[0], beam_width=100).text)

模型参数许可证

ASR模型参数仅供非商业用途,遵循知识共享署名-非商业性使用4.0国际许可协议。您可以在此处找到详细信息: https://creativecommons.org/licenses/by-nc/4.0/legalcode

联系方式

nguyenvulebinh@gmail.com