File size: 2,367 Bytes
f535954
6adec17
b43007a
d5183eb
 
 
 
 
 
6adec17
08e444a
 
f535954
 
d5183eb
 
f535954
5e3ddd2
f535954
5e3ddd2
d5183eb
745851a
 
f535954
d5183eb
f535954
5e3ddd2
f535954
5e3ddd2
 
 
 
f535954
5e3ddd2
 
 
f535954
5e3ddd2
 
f535954
5e3ddd2
 
 
 
 
f535954
d5183eb
f535954
d5183eb
f535954
d5183eb
04687ec
d5183eb
 
 
 
 
 
 
04687ec
b43007a
d5183eb
f535954
d5183eb
f535954
d5183eb
 
745851a
 
 
 
 
f535954
 
d5183eb
f535954
d5183eb
 
 
08e444a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
license: mit
base_model: UmarRamzan/w2v2-bert-urdu
tags:
- generated_from_trainer
metrics:
- wer
model-index:
- name: w2v2-bert-urdu
  results: []
language:
- ur
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# Wav2Vec-Bert-2.0-Urdu

This model is a fine-tuned version of [facebook/w2v-bert-2.0](https://huggingface.co/facebook/w2v-bert-2.0) on the Urdu split of the [Common Voice 17](https://huggingface.co/datasets/mozilla-foundation/common_voice_17_0) dataset.
It achieves the following results on the evaluation set:
- Loss: 0.3681
- Wer: 0.2929

## Model description

## Usage Instructions

```python
from transformers import AutoFeatureExtractor, Wav2Vec2BertModel
import torch
from datasets import load_dataset

dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate

processor = AutoProcessor.from_pretrained("UmarRamzan/w2v2-bert-urdu")
model = Wav2Vec2BertModel.from_pretrained("UmarRamzan/w2v2-bert-urdu")

# audio file is decoded on the fly
inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)
```

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 5e-06
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 100
- num_epochs: 1
- mixed_precision_training: Native AMP

### Training results

| Training Loss | Epoch  | Step | Validation Loss | Wer    |
|:-------------:|:------:|:----:|:---------------:|:------:|
| 0.4362        | 0.1695 | 50   | 0.4144          | 0.3213 |
| 0.3776        | 0.3390 | 100  | 0.4029          | 0.3137 |
| 0.3918        | 0.5085 | 150  | 0.4095          | 0.3060 |
| 0.3968        | 0.6780 | 200  | 0.3961          | 0.3060 |
| 0.3685        | 0.8475 | 250  | 0.3681          | 0.2929 |


### Framework versions

- Transformers 4.40.2
- Pytorch 2.2.1+cu121
- Datasets 2.19.1
- Tokenizers 0.19.1