You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fb210c3
Browse filesBrowse the repository at this point in the historyBrowse files
feat: add MLX builds for LFM2.5 and privacy-filter models (#1266)
## Description
Adds MLX (Apple GPU) builds for the LFM2.5 family and the privacy-filter
models, wiring the HF-hosted MLX variants into the model registry so
they
default to MLX on iOS (with the existing XNNPACK builds as the
simulator / Android fallback):
- LFM2.5 text — 350M, 1.2B
- LFM2.5-VL — 450M, 1.6B
- Privacy filter — openai, nemotron
Runner changes needed to drive the new builds:
- `vision_encoder` now reads its declared input dtype from method
metadata
and converts the preprocessed fp32 pixels to match (fp32 passthrough,
bf16, or fp16) instead of hardcoding `Float`. Required for bf16 MLX
vision encoders; the fp32 path stays zero-copy.
- The multimodal prefiller image-embed splice now handles `fp32 <->
bf16`
vision/text-embed dtype pairs (a hybrid where the vision encoder is fp32
and the decoder embeds are bf16), in addition to the existing
fp32<->fp16 cases.
- New `convert_from_float` helper in `runner/util.h`.
Review order: `modelUrls.ts` + `modelRegistry.ts` (the wiring) first,
then
the three `common/runner` files (the dtype handling).
### Introduces a breaking change?
- [ ] Yes
- [x] No
### Type of change
- [x] New feature (change which adds functionality)
### Tested on
- [x] iOS
### Testing instructions
1. On a physical iOS device, load each model via its accessor with the
default backend (resolves to MLX on iOS), e.g.
`models.llm.lfm2_5_vl_450m()`, `models.privacy_filter.openai()`.
2. Verify the privacy filters classify PII and the LFM2.5 / LFM2.5-VL
models generate correctly (the VL models with an image).
3. MLX requires a physical device; on the simulator the accessors fall
back to XNNPACK (or pass `{ backend: 'xnnpack' }` explicitly).
### Checklist
- [x] I have performed a self-review of my code
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments