imvladikon
commited on
Commit
·
e5a06fe
1
Parent(s):
f31d770
readme
Browse files
README.md
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- generated_from_trainer
|
5 |
+
- he
|
6 |
+
- robust-speech-event
|
7 |
+
model-index:
|
8 |
+
- name: wav2vec2-xls-r-300m-lm-hebrew
|
9 |
+
results: []
|
10 |
+
datasets:
|
11 |
+
- imvladikon/hebrew_speech_kan
|
12 |
+
- imvladikon/hebrew_speech_coursera
|
13 |
+
language:
|
14 |
+
- he
|
15 |
+
metrics:
|
16 |
+
- wer
|
17 |
+
---
|
18 |
+
|
19 |
+
# wav2vec2-xls-r-300m-lm-hebrew
|
20 |
+
|
21 |
+
This model is a fine-tuned version of [facebook/wav2vec2-xls-r-300m](https://huggingface.co/facebook/wav2vec2-xls-r-300m) on the None dataset
|
22 |
+
with adding ngram models according to [Boosting Wav2Vec2 with n-grams in 🤗 Transformers](https://huggingface.co/blog/wav2vec2-with-ngram)
|
23 |
+
|
24 |
+
|
25 |
+
## Usage
|
26 |
+
|
27 |
+
check package: https://github.com/imvladikon/wav2vec2-hebrew
|
28 |
+
|
29 |
+
or use transformers pipeline:
|
30 |
+
|
31 |
+
```python
|
32 |
+
import torch
|
33 |
+
from datasets import load_dataset
|
34 |
+
from transformers import AutoModelForCTC, AutoProcessor
|
35 |
+
import torchaudio.functional as F
|
36 |
+
|
37 |
+
|
38 |
+
model_id = "imvladikon/wav2vec2-xls-r-300m-lm-hebrew"
|
39 |
+
|
40 |
+
sample_iter = iter(load_dataset("google/fleurs", "he_il", split="test", streaming=True))
|
41 |
+
|
42 |
+
sample = next(sample_iter)
|
43 |
+
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), sample["audio"]["sampling_rate"], 16_000).numpy()
|
44 |
+
|
45 |
+
model = AutoModelForCTC.from_pretrained(model_id)
|
46 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
47 |
+
|
48 |
+
input_values = processor(resampled_audio, return_tensors="pt").input_values
|
49 |
+
|
50 |
+
with torch.no_grad():
|
51 |
+
logits = model(input_values).logits
|
52 |
+
|
53 |
+
transcription = processor.batch_decode(logits.numpy()).text
|
54 |
+
print(transcription)
|
55 |
+
```
|
56 |
+
|
57 |
+
## Intended uses & limitations
|
58 |
+
|
59 |
+
More information needed
|
60 |
+
|
61 |
+
## Training and evaluation data
|
62 |
+
|
63 |
+
More information needed
|
64 |
+
|
65 |
+
## Training procedure
|
66 |
+
|
67 |
+
### Training hyperparameters
|
68 |
+
|
69 |
+
The following hyperparameters were used during training:
|
70 |
+
- learning_rate: 0.0003
|
71 |
+
- train_batch_size: 64
|
72 |
+
- eval_batch_size: 16
|
73 |
+
- seed: 42
|
74 |
+
- gradient_accumulation_steps: 2
|
75 |
+
- total_train_batch_size: 128
|
76 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
77 |
+
- lr_scheduler_type: linear
|
78 |
+
- lr_scheduler_warmup_steps: 500
|
79 |
+
- num_epochs: 100
|
80 |
+
- mixed_precision_training: Native AMP
|
81 |
+
|
82 |
+
### Training results
|
83 |
+
|
84 |
+
|
85 |
+
### Framework versions
|
86 |
+
|
87 |
+
- Transformers 4.16.0.dev0
|
88 |
+
- Pytorch 1.10.1+cu102
|
89 |
+
- Datasets 1.17.1.dev0
|
90 |
+
- Tokenizers 0.11.0
|