Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: coreml
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
base_model: convaiinnovations/laya
|
| 6 |
+
tags:
|
| 7 |
+
- coreml
|
| 8 |
+
- laya
|
| 9 |
+
- apple-silicon
|
| 10 |
+
- neural-engine
|
| 11 |
+
- decision-model
|
| 12 |
+
- fluidaudio
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# laya-coreml
|
| 16 |
+
|
| 17 |
+
Core ML conversion of **laya-multilingual** (Convai Innovations, Apache-2.0): a 322M-parameter
|
| 18 |
+
mmBERT-base encoder with a typed decision head that answers `choice`, `score`, and `noul`
|
| 19 |
+
questions about a text state in one forward pass, returning calibrated probabilities and no
|
| 20 |
+
generated tokens. Weights are unchanged from
|
| 21 |
+
[`convaiinnovations/laya`](https://huggingface.co/convaiinnovations/laya) `multilingual/` at
|
| 22 |
+
revision `1c5edc17a7acd8701df6fc341c0d179f1c62c982`.
|
| 23 |
+
|
| 24 |
+
Runs through [FluidAudio](https://github.com/FluidInference/FluidAudio) (`LayaManager`) on
|
| 25 |
+
macOS 14+ / iOS 17+.
|
| 26 |
+
|
| 27 |
+
```swift
|
| 28 |
+
let laya = try await LayaManager.load() // downloads the 128 + 512 buckets and tokenizer.json
|
| 29 |
+
let answer = try await laya.answer(
|
| 30 |
+
state: "The T piece dropped at column 3 leaves one hole under it.",
|
| 31 |
+
question: .noul("Is this a clean placement?"))
|
| 32 |
+
print(answer.noul!) // P(true)
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
swift run -c release fluidaudiocli laya --state "…" --type choice \
|
| 37 |
+
--instructions "What does the customer want?" --options "refund|order status|technical help"
|
| 38 |
+
swift run -c release fluidaudiocli laya-tetris # headless Tetris played by laya decisions
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Files
|
| 42 |
+
|
| 43 |
+
| File | Tokens | Notes |
|
| 44 |
+
| --- | ---: | --- |
|
| 45 |
+
| `laya_multilingual_fp16_L128_options32.mlmodelc` | 128 | Short prompts; runs on CPU + Neural Engine |
|
| 46 |
+
| `laya_multilingual_fp16_L256_options32.mlmodelc` | 256 | |
|
| 47 |
+
| `laya_multilingual_fp16_L512_options32.mlmodelc` | 512 | Long states; GPU is faster than ANE here |
|
| 48 |
+
| `tokenizer.json` | | mmBERT / Gemma vocabulary (256k), byte fallback |
|
| 49 |
+
|
| 50 |
+
Each bucket is a complete FP16 model (614 MB, 393 MB of which is the embedding table) with
|
| 51 |
+
32 option slots. `FluidAudio` picks the smallest loaded bucket that fits a prompt and truncates
|
| 52 |
+
the state on the right for the largest one, exactly like laya's `max_len`.
|
| 53 |
+
|
| 54 |
+
Inputs: `input_ids` int32 `[1, L]`, `attention_mask` int32 `[1, L]`, `marker_map` float32
|
| 55 |
+
`[1, 32, L]` (one-hot `[MASK]` position per option), `question_type` float32 `[1, 3]`.
|
| 56 |
+
Outputs: `logits` `[1, 32]`, `probabilities` `[1, 32]`, `action_probabilities` `[1, 2]`.
|
| 57 |
+
Sequence format: `[CLS] <type> question: <instructions> [SEP] ([MASK] <option>)* [SEP] <state> [SEP]`.
|
| 58 |
+
|
| 59 |
+
## Parity and latency
|
| 60 |
+
|
| 61 |
+
Apple M5 Pro, macOS 27.0, 16 fixture questions vs. the unmodified PyTorch FP32 runtime:
|
| 62 |
+
16/16 argmax agreement on every bucket and compute-unit setting, max probability error 0.0021
|
| 63 |
+
(`ALL`) / 0.0126 (`CPU_AND_NE`). Per-question latency, warm:
|
| 64 |
+
|
| 65 |
+
| Bucket | CPU + ANE | All units |
|
| 66 |
+
| --- | ---: | ---: |
|
| 67 |
+
| L128 | **3.6 ms** | 3.9 ms |
|
| 68 |
+
| L256 | 9.9 ms | **5.2 ms** |
|
| 69 |
+
| L512 | 27.5 ms | **9.0 ms** |
|
| 70 |
+
|
| 71 |
+
Conversion pipeline, verification reports, and Swift parity fixtures:
|
| 72 |
+
[mobius `models/computer-use/laya/coreml`](https://github.com/FluidInference/mobius).
|
| 73 |
+
|
| 74 |
+
## License
|
| 75 |
+
|
| 76 |
+
Apache-2.0, following the upstream weights and code by Convai Innovations
|
| 77 |
+
([NandhaKishorM/laya](https://github.com/NandhaKishorM/laya)). Independent conversion; not an
|
| 78 |
+
official Convai Innovations release.
|