Commit
•
15bc8ce
1
Parent(s):
aad7b2d
Update README.md
Browse files
README.md
CHANGED
@@ -30,14 +30,14 @@ The original model can be found under https://github.com/pytorch/fairseq/tree/ma
|
|
30 |
To transcribe audio files the model can be used as a standalone acoustic model as follows:
|
31 |
|
32 |
```python
|
33 |
-
from transformers import Wav2Vec2Tokenizer,
|
34 |
from datasets import load_dataset
|
35 |
import soundfile as sf
|
36 |
import torch
|
37 |
|
38 |
# load model and tokenizer
|
39 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
|
40 |
-
model =
|
41 |
|
42 |
# define function to read in sound file
|
43 |
def map_to_array(batch):
|
@@ -66,7 +66,7 @@ To transcribe audio files the model can be used as a standalone acoustic model a
|
|
66 |
|
67 |
```python
|
68 |
from datasets import load_dataset
|
69 |
-
from transformers import
|
70 |
import soundfile as sf
|
71 |
import torch
|
72 |
from jiwer import wer
|
@@ -74,7 +74,7 @@ from jiwer import wer
|
|
74 |
|
75 |
librispeech_eval = load_dataset("librispeech_asr", "clean", split="test")
|
76 |
|
77 |
-
model =
|
78 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-base-960h-lv60-self")
|
79 |
|
80 |
def map_to_array(batch):
|
|
|
30 |
To transcribe audio files the model can be used as a standalone acoustic model as follows:
|
31 |
|
32 |
```python
|
33 |
+
from transformers import Wav2Vec2Tokenizer, Wav2Vec2ForCTC
|
34 |
from datasets import load_dataset
|
35 |
import soundfile as sf
|
36 |
import torch
|
37 |
|
38 |
# load model and tokenizer
|
39 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
|
40 |
+
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
|
41 |
|
42 |
# define function to read in sound file
|
43 |
def map_to_array(batch):
|
|
|
66 |
|
67 |
```python
|
68 |
from datasets import load_dataset
|
69 |
+
from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer
|
70 |
import soundfile as sf
|
71 |
import torch
|
72 |
from jiwer import wer
|
|
|
74 |
|
75 |
librispeech_eval = load_dataset("librispeech_asr", "clean", split="test")
|
76 |
|
77 |
+
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-960h-lv60-self").to("cuda")
|
78 |
tokenizer = Wav2Vec2Tokenizer.from_pretrained("facebook/wav2vec2-base-960h-lv60-self")
|
79 |
|
80 |
def map_to_array(batch):
|