# Swedish ASR: Fine Tuning Wav2Vec2

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%3E%5C
**Category:** Models\
**Created:** [March 18, 2021, 8:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560 "2021-03-18T08:13:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![birgermoell](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/birgermoell/32/2052_2.png) [@birgermoell](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbirgermoell)%5C
**Post date:** [March 18, 2021, 8:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%2F1 "2021-03-18T08:13:27Z")

</div>

Hey everyone. I trained the model in Swedish (just on the standard params) and I’m curious if we could figure out a good way to fine tune the parameters.  
My WER after 4000 steps was 0.511916 on a dataset of 402mb.  
I created a spreadsheet, maybe if people could fill out some parameters on how we trained we could figure out better parameters for training. ❤

> **[WAV2VEC2 Model language and WER](https://docs.google.com/spreadsheets/d/1JGzVk4UvkvmOO1pyyI-7tmctx-TLKnV2OGrUTuUcnSc/edit?usp=sharing)**
>
> Sheet1
> 
> Language,Training dataset,Training dataset size,WER,Training params,Trained on,Trained by,Training time
> Swedish,Common voice,402 mb,0.511916,Standard from the notebook,Colaboratory Pro,Birger Moëll,5:01:17
> Swedish,Common voice,402...

Here is a link to my Google Colaboratory.

> **[Google Colaboratory](https://colab.research.google.com/drive/1KkD4PeZwnIwxxxOP1bUE7XTZMK7-SzRj?usp=sharing)**

---

<div class="post-metadata">

**Author:** ![moonhouse](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@moonhouse](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmoonhouse)%5C
**Post date:** [March 18, 2021, 11:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%2F2 "2021-03-18T23:28:46Z")

</div>

I ran the same (didn’t change any parameters but did filter out apostrophe) tonight and got WER of 0.514714.

---

<div class="post-metadata">

**Author:** ![moonhouse](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@moonhouse](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmoonhouse)%5C
**Post date:** [March 19, 2021, 9:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%2F3 "2021-03-19T09:24:01Z")

</div>

Out of curiosity I took the inference part from the notebook and looped out the predicted text together with the original text.

```
for i in range(len(common_voice_test["input_values"])):
  input_dict = processor(common_voice_test["input_values"][i], return_tensors="pt", padding=True)

  logits = model(input_dict.input_values.to("cuda")).logits

  pred_ids = torch.argmax(logits, dim=-1)[0]
  print(str(i)+"\t"+processor.decode(pred_ids) + "\t" + common_voice_test_transcription["sentence"][i].lower())

```

I got 76 lines (out of 2027) before Colaboratory disconnected me. I had to remove 76 warnings about sampling\_rate not being provided. I tried to send sampling\_rate to 16000 but then it looked I got a different prediction result (but it could just being that you get different prediction result each time you run).

> **[Wav2Vec Common Voice Swedish](https://docs.google.com/spreadsheets/d/1ygG5zN0POfqiTcOJtpU47au0JMfzwOJ3wMnHxETJVg0/edit?usp=sharing)**
>
> Sheet1
> 
> Recognized speech,Original text
> 0,draknade också som en mån ligärning,det räknar jag också som en manlig gärning.
> 1,vi bisegrdet om i ni ör rmignter,de pissade på min jävla matta.
> 2,allesammansprang eller flaxade frammod pojtende medd fumat...

---

<div class="post-metadata">

**Author:** ![agrin](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@agrin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fagrin)%5C
**Post date:** [March 23, 2021, 8:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%2F4 "2021-03-23T08:49:17Z")

</div>

Did any of you start looking at using the NST database (I can see that it’s listed in the sheet)? Maybe this would be good to collaborate on?

---

<div class="post-metadata">

**Author:** ![birgermoell](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/birgermoell/32/2052_2.png) [@birgermoell](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbirgermoell)%5C
**Post date:** [March 23, 2021, 9:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fswedish-asr-fine-tuning-wav2vec2%2F4560%2F5 "2021-03-23T09:11:14Z")

</div>

The KB labb trained a model using the NST database that currently has the lowest WER

> **[KBLab/wav2vec2-large-xlsr-53-swedish · Hugging Face](https://huggingface.co/KBLab/wav2vec2-large-xlsr-53-swedish)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

The model was trained only on NST so a good next step might be to train on both NST and Common Voice
