Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
base_model:
|
6 |
+
- facebook/wav2vec2-large-xlsr-53
|
7 |
+
---
|
8 |
+
# Wav2Vec2 Fine-Tuned for Pronunciation Correction
|
9 |
+
|
10 |
+
This is a fine-tuned Wav2Vec2 model for phoneme-level pronunciation correction. It analyzes speech and provides transcriptions in phonetic notation.
|
11 |
+
|
12 |
+
CER = 0.1
|
13 |
+
|
14 |
+
## Usage
|
15 |
+
|
16 |
+
```python
|
17 |
+
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
18 |
+
import librosa
|
19 |
+
import torch
|
20 |
+
|
21 |
+
# Load model and processor
|
22 |
+
model = Wav2Vec2ForCTC.from_pretrained("moxeeeem/wav2vec2-finetuned-pronunciation-correction")
|
23 |
+
processor = Wav2Vec2Processor.from_pretrained("moxeeeem/wav2vec2-finetuned-pronunciation-correction")
|
24 |
+
|
25 |
+
def transcribe_audio(speech, sampling_rate):
|
26 |
+
inputs = processor(speech, sampling_rate=sampling_rate, return_tensors="pt")
|
27 |
+
with torch.no_grad():
|
28 |
+
logits = model(inputs.input_values).logits
|
29 |
+
pred_ids = torch.argmax(logits, dim=-1)
|
30 |
+
return processor.batch_decode(pred_ids)[0]
|
31 |
+
|
32 |
+
speech, sample_rate = librosa.load("example_audio.wav", sr=16000)
|
33 |
+
transcription = transcribe_audio(speech, sample_rate)
|
34 |
+
print("Transcription:", transcription) # example: pɪŋɡwɪnz lɪv nɪ ði aɪsi ænɑɹtɪk
|