GetmanY1's picture
Create README.md
8a6989f verified
metadata
license: apache-2.0
tags:
  - automatic-speech-recognition
  - sami
model-index:
  - name: wav2vec2-xls-r-300m-sami-parl-cont-pt-108h
    results:
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: UIT-SME
          type: uit-sme
          args: sami
        metrics:
          - name: WER
            type: wer
            value: 28.87
          - name: CER
            type: cer
            value: 7.58

Northern Sámi Wav2vec2-Large ASR

facebook/wav2vec2-xls-r-300m with two-step training that involved continued pre-training on all the available Sámi Parliament speech data (108h) and fine-tuning on the 20-hour transcribed subset. When using the model make sure that your speech input is sampled at 16Khz.

Model description

The Sámi Wav2Vec2 Large has the same architecture and uses the same training objective as the English and multilingual one described in Paper.

You can read more about the pre-trained model from this paper. The training scripts are available on GitHub

Intended uses & limitations

You can use this model for Sámi ASR (speech-to-text).

How to use

To transcribe audio files the model can be used as a standalone acoustic model as follows:

from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
from datasets import load_dataset
import torch

# load model and processor
processor = Wav2Vec2Processor.from_pretrained("GetmanY1/wav2vec2-xls-r-300m-sami-parl-cont-pt-108h")
model = Wav2Vec2ForCTC.from_pretrained("GetmanY1/wav2vec2-xls-r-300m-sami-parl-cont-pt-108h")

# load dummy dataset and read soundfiles
ds = load_dataset("mozilla-foundation/common_voice_16_1", "fi", split='test')

# tokenize
input_values = processor(ds[0]["audio"]["array"], 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)

Limitations and bias

This model was fine-tuned with audio samples whose maximum length was 30 seconds so this model most likely works the best for short audios of similar length. However, you can try this model with a lot longer audios too and see how it works. If you encounter out of memory errors with very long audio files you can use the audio chunking method introduced in this blog post.

The model was fine-tuned on the data from the Sámi Parliament speech data so this model might have biases towards formal Sámi.

Citation

If you use our models or scripts, please cite our article as:

@inproceedings{getman24b_interspeech,
  author={Yaroslav Getman and Tamas Grosz and Katri Hiovain-Asikainen and Mikko Kurimo},
  title={{Exploring adaptation techniques of large speech foundation models for low-resource ASR: a case study on Northern Sámi}},
  year=2024,
  booktitle={Proc. INTERSPEECH 2024},
  pages={XX--XX},
  doi={XXXX},
  issn={XXXX-XXXX}
}