Automatic Speech Recognition
Transformers
Safetensors
Korean
English
wav2vec2
ctc
korean
english
code-switching
Instructions to use raniczan/wav2vec2-xls-r-300m-korean-english with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use raniczan/wav2vec2-xls-r-300m-korean-english with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="raniczan/wav2vec2-xls-r-300m-korean-english")# Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("raniczan/wav2vec2-xls-r-300m-korean-english") model = AutoModelForCTC.from_pretrained("raniczan/wav2vec2-xls-r-300m-korean-english", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,16 +12,13 @@ tags:
|
|
| 12 |
- korean
|
| 13 |
- english
|
| 14 |
- code-switching
|
| 15 |
-
- forced-alignment
|
| 16 |
---
|
| 17 |
|
| 18 |
# wav2vec2-xls-r-300m-korean-english
|
| 19 |
|
| 20 |
-
A **jamo + Latin CTC acoustic model
|
| 21 |
for **Korean / English code-switched** speech. It emits per-frame character
|
| 22 |
-
probabilities
|
| 23 |
-
as a **streaming CTC forced aligner** — pair the emissions with known text + a
|
| 24 |
-
Viterbi pass to get per-character timestamps (~20 ms granularity).
|
| 25 |
|
| 26 |
## Training
|
| 27 |
|
|
@@ -34,7 +31,7 @@ Viterbi pass to get per-character timestamps (~20 ms granularity).
|
|
| 34 |
## Important: jamo preprocessing
|
| 35 |
|
| 36 |
The vocab is **jamo (decomposed Hangul) + Latin**, not raw syllables. You MUST
|
| 37 |
-
decompose
|
| 38 |
|
| 39 |
```python
|
| 40 |
import unicodedata
|
|
@@ -44,10 +41,10 @@ def from_jamo(t): # model output -> readable text
|
|
| 44 |
return unicodedata.normalize("NFC", t)
|
| 45 |
```
|
| 46 |
|
| 47 |
-
## Usage
|
| 48 |
|
| 49 |
```python
|
| 50 |
-
import
|
| 51 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
| 52 |
|
| 53 |
proc = Wav2Vec2Processor.from_pretrained("raniczan/wav2vec2-xls-r-300m-korean-english")
|
|
@@ -58,6 +55,3 @@ x = proc(wav, sampling_rate=16000, return_tensors="pt").input_values
|
|
| 58 |
ids = model(x).logits.argmax(-1)[0]
|
| 59 |
print(unicodedata.normalize("NFC", proc.decode(ids)))
|
| 60 |
```
|
| 61 |
-
|
| 62 |
-
For **forced alignment**, run the same logits through `torchaudio.functional.forced_align`
|
| 63 |
-
(or a custom streaming Viterbi) against your jamo-decomposed known text.
|
|
|
|
| 12 |
- korean
|
| 13 |
- english
|
| 14 |
- code-switching
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
# wav2vec2-xls-r-300m-korean-english
|
| 18 |
|
| 19 |
+
A **jamo + Latin CTC** acoustic model fine-tuned from `facebook/wav2vec2-xls-r-300m`
|
| 20 |
for **Korean / English code-switched** speech. It emits per-frame character
|
| 21 |
+
probabilities over a compact jamo + Latin vocabulary.
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Training
|
| 24 |
|
|
|
|
| 31 |
## Important: jamo preprocessing
|
| 32 |
|
| 33 |
The vocab is **jamo (decomposed Hangul) + Latin**, not raw syllables. You MUST
|
| 34 |
+
decompose target text the same way, and recompose model output:
|
| 35 |
|
| 36 |
```python
|
| 37 |
import unicodedata
|
|
|
|
| 41 |
return unicodedata.normalize("NFC", t)
|
| 42 |
```
|
| 43 |
|
| 44 |
+
## Usage
|
| 45 |
|
| 46 |
```python
|
| 47 |
+
import soundfile as sf, unicodedata
|
| 48 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
| 49 |
|
| 50 |
proc = Wav2Vec2Processor.from_pretrained("raniczan/wav2vec2-xls-r-300m-korean-english")
|
|
|
|
| 55 |
ids = model(x).logits.argmax(-1)[0]
|
| 56 |
print(unicodedata.normalize("NFC", proc.decode(ids)))
|
| 57 |
```
|
|
|
|
|
|
|
|
|