Update README.md
Browse files
README.md
CHANGED
@@ -176,7 +176,6 @@ pip install git+https://github.com/MahmoudAshraf97/ctc-forced-aligner.git
|
|
176 |
```
|
177 |
## Usage
|
178 |
|
179 |
-
```python
|
180 |
from ctc_forced_aligner import (
|
181 |
load_audio,
|
182 |
load_alignment_model,
|
@@ -189,6 +188,7 @@ from ctc_forced_aligner import (
|
|
189 |
|
190 |
audio_path = "your/audio/path"
|
191 |
text_path = "your/text/path"
|
|
|
192 |
|
193 |
audio_waveform = load_audio(audio_path, model.dtype, model.device)
|
194 |
emissions, stride = generate_emissions(
|
@@ -202,10 +202,7 @@ text = "".join(line for line in lines).replace("\n", " ").strip()
|
|
202 |
alignment_model, alignment_tokenizer, alignment_dictionary = load_alignment_model(
|
203 |
device,
|
204 |
dtype=torch.float16 if device == "cuda" else torch.float32,
|
205 |
-
model_path="MahmoudAshraf/mms-300m-1130-forced-aligner"
|
206 |
)
|
207 |
-
# also compatible with other Wav2Vec2 Checkpoints such as
|
208 |
-
# "jonatasgrosman/wav2vec2-large-xlsr-53-arabic"
|
209 |
|
210 |
|
211 |
emissions, stride = generate_emissions(
|
@@ -213,14 +210,10 @@ emissions, stride = generate_emissions(
|
|
213 |
)
|
214 |
|
215 |
|
216 |
-
# romanization should be enabled when using multilingual models
|
217 |
-
# it should be changed to `False` when using models that support the
|
218 |
-
# native vocabulary of the text
|
219 |
-
|
220 |
tokens_starred, text_starred = preprocess_text(
|
221 |
text,
|
222 |
romanize=True,
|
223 |
-
language=
|
224 |
)
|
225 |
|
226 |
|
|
|
176 |
```
|
177 |
## Usage
|
178 |
|
|
|
179 |
from ctc_forced_aligner import (
|
180 |
load_audio,
|
181 |
load_alignment_model,
|
|
|
188 |
|
189 |
audio_path = "your/audio/path"
|
190 |
text_path = "your/text/path"
|
191 |
+
language = "iso" # ISO-639-3 Language code
|
192 |
|
193 |
audio_waveform = load_audio(audio_path, model.dtype, model.device)
|
194 |
emissions, stride = generate_emissions(
|
|
|
202 |
alignment_model, alignment_tokenizer, alignment_dictionary = load_alignment_model(
|
203 |
device,
|
204 |
dtype=torch.float16 if device == "cuda" else torch.float32,
|
|
|
205 |
)
|
|
|
|
|
206 |
|
207 |
|
208 |
emissions, stride = generate_emissions(
|
|
|
210 |
)
|
211 |
|
212 |
|
|
|
|
|
|
|
|
|
213 |
tokens_starred, text_starred = preprocess_text(
|
214 |
text,
|
215 |
romanize=True,
|
216 |
+
language=language,
|
217 |
)
|
218 |
|
219 |
|