Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- mlx
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
### Descript Audio Codec — MLX
|
| 8 |
+
|
| 9 |
+
This model is reshaped for MLX from the original weights and is designed for use with [descript-mlx](https://github.com/lucasnewman/descript-mlx)
|
| 10 |
+
|
| 11 |
+
## Installation
|
| 12 |
+
|
| 13 |
+
```bash
|
| 14 |
+
pip install descript-mlx
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Usage
|
| 18 |
+
|
| 19 |
+
You can load a pretrained model from Python like this:
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
import mlx.core as mx
|
| 23 |
+
|
| 24 |
+
from descript_mlx import DAC
|
| 25 |
+
|
| 26 |
+
dac = DAC.from_pretrained("44khz")
|
| 27 |
+
audio = mx.array(...)
|
| 28 |
+
|
| 29 |
+
# encode into latents and codes
|
| 30 |
+
z, codes, latents, commitment_loss, codebook_loss = dac.encode(audio)
|
| 31 |
+
|
| 32 |
+
# reconstruct from latents/codes to audio
|
| 33 |
+
reconstucted_audio = dac.decode(z)
|
| 34 |
+
|
| 35 |
+
# compress audio to a DAC file
|
| 36 |
+
dac_file = dac.compress(audio)
|
| 37 |
+
dac_file.save("/path/to/file.dac")
|
| 38 |
+
|
| 39 |
+
# decompress audio from a DAC file
|
| 40 |
+
reconstructed_audio = dac.decompress("/path/to/file.dac")
|
| 41 |
+
```
|