模型:
nguyenvulebinh/wav2vec2-base-vi
语言:
vi许可:
cc-by-nc-4.0我们使用wav2vec2架构进行自监督学习
我们的自监督模型是在一个庞大的音频数据集上进行预训练的,该数据集包含13k小时的越南YouTube音频,包括:
我们已经将预训练模型上传到了Huggingface。基础模型在大约30天内使用TPU V3-8进行了35个时期的训练,大模型在20个时期内进行了训练,总参数量分别为:
from transformers import Wav2Vec2ForPreTraining, Wav2Vec2Processor model_name = 'nguyenvulebinh/wav2vec2-base-vi' # model_name = 'nguyenvulebinh/wav2vec2-large-vi' model = Wav2Vec2ForPreTraining.from_pretrained(model_name) processor = Wav2Vec2Processor.from_pretrained(model_name)
由于我们的模型与英文wav2vec2版本具有相同的架构,您可以使用 this notebook 获取有关如何微调模型的更多信息。
VLSP T1测试集上的基准WER结果:
1235321 | 1236321 | |
---|---|---|
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 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_name = "nguyenvulebinh/wav2vec2-large-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)
nguyenvulebinh@gmail.com / binh@vietai.org