Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / library / ml / AGENTS.md

AGENTS.md2.5 KiBRenderedCodeRaw
1# AGENTS.md — library/ml/ (':library:ml')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `library/ml/` + allowed shared modules. Do not root-scan.
4
5<!-- last-reviewed: 2026-10-16 -->
6- Gradle: :library:ml / dir: library/ml/
7- Package roots present: (on-device inference runtimes — one package + Rust/native bridges)
8- Entry files: per-model `*Handle` (no MainActivity/Route — library)
9- Deps: (none — ONNX/LiteRT/ExecuTorch/Vulkan sessions live here)
10- Metadata: metadata_data/library-ml.md (absent — libraries have none by design)
11- Rust: yes / screenshotTest: no
12
13## Overview
14**Purpose:** All on-device inference — session wrappers for every runtime (ONNX, LiteRT, ExecuTorch, Vulkan compute) plus per-model handles: Whisper (speech), NLLB (translate), Gemma (assistant), Maia (chess), CLIP/faces/segmentation (photos/camera), Supertonic (TTS), OCR post. No vendor SDKs.
15**How to use:** Pick the runtime session (`OnnxSessions` / `LiteRtSessions` / `ExecutorchSessions` / `VulkanSessions`), then the model handle (`WhisperHandle`, `NllbHandle`, `GemmaTypes`, `MaiaHandle`, `ClipHandle`, `SelfieSegmenter`, …). Pre/post via `OnnxPreprocess`, `OcrPost`, `SegmentationMask`.
16**Entry points:** The `*Handle` for your model → its `*Sessions` runtime → `VulkanBridge`/`VulkanWire` if GPU.
17**Gotchas:** Model files are large and versioned per consumer — never share weights across models without checking compatibility; GPU paths need device-specific testing.
18
19## Key files
20- com/vayunmathur/library/ml/OnnxSessions.kt
21- com/vayunmathur/library/ml/LiteRtSessions.kt
22- com/vayunmathur/library/ml/ExecutorchSessions.kt
23- com/vayunmathur/library/ml/VulkanSessions.kt
24- com/vayunmathur/library/ml/VulkanBridge.kt
25- com/vayunmathur/library/ml/VulkanWire.kt
26- com/vayunmathur/library/ml/WhisperHandle.kt
27- com/vayunmathur/library/ml/NllbHandle.kt
28- com/vayunmathur/library/ml/GemmaTypes.kt
29- com/vayunmathur/library/ml/MaiaHandle.kt
30- com/vayunmathur/library/ml/ClipHandle.kt
31- com/vayunmathur/library/ml/Faces.kt
32- com/vayunmathur/library/ml/SelfieSegmenter.kt
33- com/vayunmathur/library/ml/SubjectSegmenter.kt
34- com/vayunmathur/library/ml/SegmentationMask.kt
35- com/vayunmathur/library/ml/SupertonicSynthesizer.kt
36- com/vayunmathur/library/ml/TextRecognizer.kt
37- com/vayunmathur/library/ml/TextRecognizerEt.kt
38- com/vayunmathur/library/ml/EtTensors.kt
39- com/vayunmathur/library/ml/OcrPost.kt
40- com/vayunmathur/library/ml/OnnxPreprocess.kt
41
42## Verify (this module only)
43```
44./gradlew :library:ml:compileDevKotlin
45./gradlew :library:ml:lint
46```