tbkazakova
commited on
Commit
•
e634abd
1
Parent(s):
cf4b139
Update README.md
Browse files
README.md
CHANGED
@@ -39,7 +39,20 @@ It achieves the following results on the evaluation set:
|
|
39 |
|
40 |
## Model description
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
## Intended uses & limitations
|
45 |
|
|
|
39 |
|
40 |
## Model description
|
41 |
|
42 |
+
```
|
43 |
+
from transformers import AutoModelForCTC, Wav2Vec2BertProcessor
|
44 |
+
|
45 |
+
model = AutoModelForCTC.from_pretrained("tbkazakova/wav2vec-bert-2.0-even-pakendorf")
|
46 |
+
processor = Wav2Vec2BertProcessor.from_pretrained("tbkazakova/wav2vec-bert-2.0-even-pakendorf")
|
47 |
+
|
48 |
+
data, sampling_rate = librosa.load('audio.wav')
|
49 |
+
librosa.resample(data, orig_sr=sampling_rate, target_sr=16000)
|
50 |
+
logits = model(torch.tensor(processor(data,
|
51 |
+
sampling_rate=16000).input_features[0]).unsqueeze(0)).logits
|
52 |
+
|
53 |
+
pred_ids = torch.argmax(logits, dim=-1)[0]
|
54 |
+
print(processor.decode(pred_ids))
|
55 |
+
```
|
56 |
|
57 |
## Intended uses & limitations
|
58 |
|