Downloads · 30 days
12
1% of all-time downloads
abnerh/wav2vec2-xlsr-300m-german-truecase
wav2vec2-xlsr-300m-german-truecase is a automatic speech recognition model from abnerh. Use it when you need speech turned into text. It is set up for transformers.
Fine-tuned facebook/wav2vec2-xls-r-300m on German using the Common Voice dataset. When using this model, make sure that your speech input is sampled at 16kHz.
Downloads · 30 days
12
1% of all-time downloads
All-time downloads
1.3K
Public
Parameters
316M
5 GB on disk
Likes
1
Public
Click a slice to open those files.
.pt2.5 GB · 50%
From the Hugging Face model README
Fine-tuned facebook/wav2vec2-xls-r-300m on German using the Common Voice dataset. When using this model, make sure that your speech input is sampled at 16kHz.
As capitalization is an important part of the German language (eg. Sie vs. sie). I trained a model using a vocab that includes both lower case and upper case letters in hopes that the model would learn the correct casing. This removes the need to do any post-processing like truecasing.
| Reference | Prediction |
|---|---|
| Die zoologische Einordnung der Spezies ist seit Jahrzehnten umstritten | Die psoologische Einordnung der Spezies ist seit Jahrzehnten umstritten |
| Hauptgeschäftsfeld war ursprünglich der öffentliche Sektor in Irland | Hauptgeschäftsfeld war ursprünglich der öffentliche Sektor in Irland |
| Er vertrat den Wahlkreis Donauwörth im Parlament | Er vertrat den Wahlkreis DonauWört im Parlament |
| Ich bin gespannt welche Lieder sie wählt | Ich bin gespannt welche Lieder see wählt |
| Eine allgemein verbindliche Definition gibt es nicht | Eine allgemeinverbindliche Definition gibt es nicht |
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
import soundfile as sf
import torch
# load model and processor
processor = Wav2Vec2Processor.from_pretrained("abnerh/wav2vec2-xlsr-300m-german-truecase")
model = Wav2Vec2ForCTC.from_pretrained("abnerh/wav2vec2-xlsr-300m-german-truecase")
speech, sr = sf.read('audio.wav')
# tokenize
input_values = processor(speech, return_tensors="pt", padding="longest").input_values # Batch size 1
# retrieve logits
logits = model(input_values).logits
# take argmax and decode
predicted_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(predicted_ids)
# print transcription results
print(transcription)