mlboydaisuke commited on
Commit
29bd4a4
·
verified ·
1 Parent(s): dea6346

Add model card

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: coreml
4
+ pipeline_tag: text-to-speech
5
+ base_model: hexgrad/Kokoro-82M
6
+ base_model_relation: quantized
7
+ tags:
8
+ - coreml
9
+ - core-ml
10
+ - ios
11
+ - macos
12
+ - apple
13
+ - on-device
14
+ - tts
15
+ - styletts2
16
+ - istftnet
17
+ - arxiv:2306.07691
18
+ ---
19
+
20
+ # Kokoro-82M — Core ML
21
+
22
+ *Multilingual TTS*
23
+
24
+ English + Japanese text-to-speech. 24 kHz. StyleTTS2 + iSTFTNet vocoder. Multiple voices.
25
+
26
+ Core ML conversion of [hexgrad/Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) for on-device inference on iPhone, iPad and Mac. Converted with `coremltools`; the packages are stateless, so all sequencing and buffering lives in your Swift code.
27
+
28
+ | | |
29
+ |---|---|
30
+ | Task | text to speech |
31
+ | Upstream | [hexgrad/Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) |
32
+ | Packages | 4 |
33
+ | Download size | 724 MB |
34
+ | Minimum iOS | 17.0 |
35
+ | Peak RAM | ~1000 MB |
36
+
37
+ ## Files
38
+
39
+ | File | Size | Compute units | SHA-256 |
40
+ |---|---:|---|---|
41
+ | `Kokoro_Predictor.mlpackage.zip` | 69 MB | `cpuAndGPU` | `af1d55dc842980c3…` |
42
+ | `Kokoro_Decoder_128.mlpackage.zip` | 219 MB | `cpuAndGPU` | `cece0d072f5ba6aa…` |
43
+ | `Kokoro_Decoder_256.mlpackage.zip` | 219 MB | `cpuAndGPU` | `36d5e16d5c5ccb50…` |
44
+ | `Kokoro_Decoder_512.mlpackage.zip` | 219 MB | `cpuAndGPU` | `0a44484c327e4fe8…` |
45
+ | `kokoro_vocab.json` | 1 KB | `-` | `70abefbe8a1c8865…` |
46
+ | **Total** | **724 MB** | | |
47
+
48
+ `compute_units` is not a suggestion -- it is the configuration the conversion was verified against. Moving a package to a different compute unit can silently change the numerics (FP16 attention overflow) or crash on the GPU.
49
+
50
+ ## Download
51
+
52
+ ```bash
53
+ hf download mlboydaisuke/coreml-zoo --include "kokoro/*" --local-dir ./kokoro
54
+ unzip './kokoro/kokoro/*.zip' -d ./kokoro
55
+ ```
56
+
57
+ ## Use in Swift
58
+
59
+ ```swift
60
+ import CoreML
61
+
62
+ let config = MLModelConfiguration()
63
+ config.computeUnits = .cpuAndGPU // as converted — see the table above
64
+
65
+ // Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
66
+ // at build time:
67
+ let model = try Kokoro_Predictor(configuration: config)
68
+
69
+ // ...or compile a downloaded .mlpackage at runtime:
70
+ let compiled = try await MLModel.compileModel(at: mlpackageURL)
71
+ let model = try MLModel(contentsOf: compiled, configuration: config)
72
+ ```
73
+
74
+ > This model is split into 4 Core ML packages that are driven in sequence from Swift. Load them one at a time, copy the outputs out of the `MLMultiArray` buffers and release each model before loading the next — two large Core ML models resident at once will OOM on an iPhone.
75
+
76
+ ## Demo
77
+
78
+ - **Sample app** — [`sample_apps/KokoroDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/KokoroDemo), a standalone SwiftUI project.
79
+ - **Models Zoo** — this model is downloadable and runnable inside the [Models Zoo app](https://apps.apple.com/app/id6762083207) on the App Store, no build required.
80
+
81
+ ## Conversion
82
+
83
+ - Script: [`convert_kokoro.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_kokoro.py)
84
+ - Pitfalls hit during conversion (FP16 overflow, ANE buffer limits, stride handling): [`docs/coreml_conversion_notes.md`](https://github.com/john-rocky/CoreML-Models/blob/master/docs/coreml_conversion_notes.md)
85
+ - Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
86
+
87
+ ## License
88
+
89
+ The conversion inherits the upstream license: **Apache-2.0**.
90
+
91
+ ## Credits
92
+
93
+ - Upstream authors: [hexgrad/Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M), 2024
94
+ - Core ML conversion: john-rocky (Daisuke Majima)