Downloads · 30 days
4.1K
0% of all-time downloads
alvanlii/wav2vec2-BERT-cantonese
wav2vec2-BERT-cantonese is a automatic speech recognition model from alvanlii. Use it when you need speech turned into text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of facebook/w2v-bert-2.0. This has a CER of 10.27 on Common Voice 16 (yue) test set (without punctuations).
Downloads · 30 days
4.1K
0% of all-time downloads
All-time downloads
980K
Public
Parameters
608M
28.6 GB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors2.4 GB · 54%
From the Hugging Face model README
This model is a fine-tuned version of facebook/w2v-bert-2.0. This has a CER of 10.27 on Common Voice 16 (yue) test set (without punctuations).
For training, three datasets were used:
zh-HK and yue Train Setfrom transformers import pipeline
bert_asr = pipeline(
"automatic-speech-recognition", model="alvanlii/wav2vec2-BERT-cantonese", device="cuda"
)
text = pipe(file)["text"]
or
import torch
import soundfile as sf
from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
model_name = "alvanlii/wav2vec2-BERT-cantonese"
asr_model = AutoModelForCTC.from_pretrained(model_name).to(device)
processor = Wav2Vec2BertProcessor.from_pretrained(model_name)
audio_input, _ = sf.read(file)
inputs = processor([audio_input], sampling_rate=16_000).input_features
features = torch.tensor(inputs)
with torch.no_grad():
logits = asr_model(features).logits
predicted_ids = torch.argmax(logits, dim=-1)
predictions = processor.batch_decode(predicted_ids, skip_special_tokens=True)