Skip to content

Commit 577e635

Browse files
authored
Fix workflows and readme (#5)
* fix readme * format * fix workflows * add librosa
1 parent 301f016 commit 577e635

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
3939
- name: Run Python tests
4040
run: |
41-
cd tts/
41+
cd mlx_audio/tts/
4242
pytest -s ./tests

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ Kokoro is a multilingual TTS model that supports various languages and voice sty
2424
#### Example Usage
2525

2626
```python
27-
from tts.models.kokoro import KokoroModel, KokoroPipeline
27+
from mlx_audio.tts.models.kokoro import KokoroPipeline
28+
from mlx_audio.tts.utils import load_model
2829
from IPython.display import Audio
2930
import soundfile as sf
3031

3132
# Initialize the model
32-
model = KokoroModel(repo_id='prince-canuma/Kokoro-82M')
33+
model_id = 'prince-canuma/Kokoro-82M'
34+
model = load_model(model_id)
3335

3436
# Create a pipeline with American English
35-
pipeline = KokoroPipeline(lang_code='a', model=model)
37+
pipeline = KokoroPipeline(lang_code='a', model=model, repo_id=model_id)
3638

3739
# Generate audio
3840
text = "The MLX King lives. Let him cook!"
@@ -58,16 +60,17 @@ for _, _, audio in pipeline(text, voice='af_heart', speed=1, split_pattern=r'\n+
5860
You can quantize models for improved performance:
5961

6062
```python
61-
from tts.models.kokoro import KokoroModel
62-
from tts.utils import quantize_model
63+
from mlx_audio.tts.utils import quantize_model, load_model
6364
import json
6465
import mlx.core as mx
6566

66-
model = KokoroModel(repo_id='prince-canuma/Kokoro-82M')
67+
model = load_model(repo_id='prince-canuma/Kokoro-82M')
6768
config = model.config
6869

6970
# Quantize to 8-bit
70-
weights, config = quantize_model(model, config, 64, 8)
71+
group_size = 64
72+
bits = 8
73+
weights, config = quantize_model(model, config, group_size, bits)
7174

7275
# Save quantized model
7376
with open('./8bit/config.json', 'w') as f:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ torch>=2.5.1
1212
transformers>=4.49.0
1313
sentencepiece>=0.2.0
1414
huggingface_hub>=0.27.0
15+
librosa>=0.10.2.post1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@
4242
"mlx_audio.tts.generate = mlx_audio.tts.generate:main",
4343
]
4444
},
45-
)
45+
)

0 commit comments

Comments
 (0)