Downloads · 30 days
35
1% of all-time downloads
classla/wav2vec2-large-slavic-parlaspeech-hr-lm
wav2vec2-large-slavic-parlaspeech-hr-lm is a automatic speech recognition model from classla. Use it when you need speech turned into text. It is set up for transformers.
This model for Croatian ASR is based on the facebook/wav2vec2-large-slavic-voxpopuli-v2 model and was fine-tuned with 300 hours of recordings and transcripts from the ASR Croatian parliament dataset ParlaSpeech-HR v1.…
Downloads · 30 days
35
1% of all-time downloads
All-time downloads
4.9K
Public
Parameters
315M
3.4 GB on disk
Likes
3
Public
Click a slice to open those files.
.bin2.1 GB · 63%
From the Hugging Face model README
This model for Croatian ASR is based on the facebook/wav2vec2-large-slavic-voxpopuli-v2 model and was fine-tuned with 300 hours of recordings and transcripts from the ASR Croatian parliament dataset ParlaSpeech-HR v1.0 and enhanced with a 5-gram language model based on the ParlaMint dataset.
<div style="border: 5px solid #ff6700; padding: 10px; margin: 10px 0;"> <strong>Notice:</strong> ParlaSpeech corpora are currently in the process of enrichment with new features. Follow our progress here: <a href="http://clarinsi.github.io/parlaspeech">http://clarinsi.github.io/parlaspeech</a> </div>If you use this model, please cite the following paper:
Nikola Ljubešić, Danijel Koržinek, Peter Rupnik, Ivo-Pavao Jazbec. ParlaSpeech-HR -- a freely available ASR dataset for Croatian bootstrapped from the ParlaMint corpus. http://www.lrec-conf.org/proceedings/lrec2022/workshops/ParlaCLARINIII/pdf/2022.parlaclariniii-1.16.pdf
Evaluation is performed on the dev and test portions of the ParlaSpeech-HR v1.0 dataset.
| split | CER | WER |
|---|---|---|
| dev | 0.0253 | 0.0556 |
| test | 0.0188 | 0.0430 |
transformersTested with transformers==4.18.0, torch==1.11.0, and SoundFile==0.10.3.post1.
from transformers import Wav2Vec2ProcessorWithLM, Wav2Vec2ForCTC
import soundfile as sf
import torch
import os
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# load model and tokenizer
processor = Wav2Vec2ProcessorWithLM.from_pretrained(
"classla/wav2vec2-large-slavic-parlaspeech-hr-lm")
model = Wav2Vec2ForCTC.from_pretrained("classla/wav2vec2-large-slavic-parlaspeech-hr-lm")
# download the example wav files:
os.system("wget https://huggingface.co/classla/wav2vec2-large-slavic-parlaspeech-hr-lm/raw/main/00020570a.flac.wav")
# read the wav file
speech, sample_rate = sf.read("00020570a.flac.wav")
input_values = processor(speech, sampling_rate=sample_rate, return_tensors="pt").input_values.cuda()
inputs = processor(speech, sampling_rate=sample_rate, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
transcription = processor.batch_decode(logits.numpy()).text[0]
# remove the raw wav file
os.system("rm 00020570a.flac.wav")
transcription # 'velik broj poslovnih subjekata poslao je sa minusom velik dio'
In fine-tuning, the following arguments were used:
| arg | value |
|---|---|
per_device_train_batch_size | 16 |
gradient_accumulation_steps | 4 |
num_train_epochs | 8 |
learning_rate | 3e-4 |
warmup_steps | 500 |