Instructions to use BasinShapers/wilor-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use BasinShapers/wilor-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir wilor-mlx BasinShapers/wilor-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Publish WiLoR MLX checkpoint
Browse files- README.md +119 -0
- wilor-mlx-int4.safetensors +3 -0
- wilor-mlx.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: mlx
|
| 4 |
+
tags:
|
| 5 |
+
- mlx
|
| 6 |
+
- hand-pose-estimation
|
| 7 |
+
- apple-silicon
|
| 8 |
+
- wilor
|
| 9 |
+
- mano
|
| 10 |
+
datasets:
|
| 11 |
+
- hand-pose
|
| 12 |
+
base_model: warmshao/WiLoR-mini
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# WiLoR-MLX: Hand Pose Estimation on Apple Silicon
|
| 16 |
+
|
| 17 |
+
MLX port of [WiLoR-mini](https://github.com/warmshao/WiLoR-mini) for native Apple Silicon inference. Complete pipeline: ViT-H/16 backbone + MANO hand model + RefineNet refinement.
|
| 18 |
+
|
| 19 |
+
**Code:** [github.com/lyonsno/wilor-mlx](https://github.com/lyonsno/wilor-mlx)
|
| 20 |
+
|
| 21 |
+
## Available Weights
|
| 22 |
+
|
| 23 |
+
| Variant | File | Size | Precision | Notes |
|
| 24 |
+
|---|---|---|---|---|
|
| 25 |
+
| **float32** | `wilor-mlx.safetensors` | 2.4 GB | Full | Reference quality, recommended |
|
| 26 |
+
| **int4** | `wilor-mlx-int4.safetensors` | 490 MB | 4-bit quantized | 5x smaller download, same speed |
|
| 27 |
+
|
| 28 |
+
Both variants produce near-identical inference speed on Apple Silicon (see benchmarks below). Choose based on download size and precision needs.
|
| 29 |
+
|
| 30 |
+
These weights contain only ViT backbone, RefineNet, and learned embedding parameters — no MANO data is bundled or rehosted. `WiLoR.from_pretrained()` handles MANO automatically by fetching upstream [WiLoR-mini](https://huggingface.co/warmshao/WiLoR-mini) assets and converting locally on your machine. The [MANO hand model](https://mano.is.tue.mpg.de/) is separately licensed by the Max Planck Institute.
|
| 31 |
+
|
| 32 |
+
## Performance
|
| 33 |
+
|
| 34 |
+
**Apple M4 Max, single-image (1×256×256×3), float32:**
|
| 35 |
+
|
| 36 |
+
### Same-harness Perceptasia saved-frame route
|
| 37 |
+
|
| 38 |
+
| Stage | Backend | p50 | p90 | p95 | p99 |
|
| 39 |
+
|---|---|---|---|---|---|
|
| 40 |
+
| model | **MLX (wilor-mlx)** | **37.0 ms** | **37.3 ms** | **37.4 ms** | **37.7 ms** |
|
| 41 |
+
| model | PyTorch MPS | 48.8 ms | 49.6 ms | 49.8 ms | 54.2 ms |
|
| 42 |
+
| full route | **MLX (wilor-mlx)** | **48.8 ms** | **49.5 ms** | **49.5 ms** | **49.6 ms** |
|
| 43 |
+
| full route | PyTorch MPS | 60.1 ms | 60.8 ms | 61.1 ms | 62.1 ms |
|
| 44 |
+
|
| 45 |
+
Same M4 Max machine, same saved-frame harness, 40 recent active Perceptasia frames. MLX is about 1.3x faster on the pose/reconstruction model stage and about 1.2x faster on the full saved-frame route. This replaces the older app-tail telemetry as the launch comparison denominator.
|
| 46 |
+
|
| 47 |
+
### Isolated model benchmark
|
| 48 |
+
|
| 49 |
+
| Backend | p50 | p90 | min | FPS |
|
| 50 |
+
|---|---|---|---|---|
|
| 51 |
+
| **MLX (wilor-mlx)** | **36 ms** | **36 ms** | **36 ms** | **28** |
|
| 52 |
+
| PyTorch MPS (2.5.0) | 50 ms | 51 ms | 49 ms | 20 |
|
| 53 |
+
|
| 54 |
+
1.4x faster in pure model compute. Same deterministic input, 100 iterations after 30 warmup, batched timing.
|
| 55 |
+
|
| 56 |
+
### Quantization impact on speed
|
| 57 |
+
|
| 58 |
+
| Variant | p50 | FPS | Notes |
|
| 59 |
+
|---|---|---|---|
|
| 60 |
+
| float32 | 36 ms | 28 | Reference |
|
| 61 |
+
| float16 | 36 ms | 28 | Equal ALU throughput on M4 Max |
|
| 62 |
+
| int4 | 37 ms | 27 | Dequant overhead ≈ bandwidth savings |
|
| 63 |
+
|
| 64 |
+
On Apple Silicon, float16 and int4 do not improve latency for this model size (210 tokens × 1280 dim). The GPU is compute-overhead-bound, not bandwidth-bound. Int4's value is purely download size reduction (2.4 GB → 490 MB).
|
| 65 |
+
|
| 66 |
+
## Numerical Accuracy
|
| 67 |
+
|
| 68 |
+
Compared against PyTorch WiLoR-mini on identical float32 inputs:
|
| 69 |
+
|
| 70 |
+
| Variant | pred_vertices max diff | pred_keypoints_3d max diff |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| float32 | 0.006 (sub-mm) | 0.006 (sub-mm) |
|
| 73 |
+
| int4 | 0.044 (< 2mm) | 0.044 (< 2mm) |
|
| 74 |
+
|
| 75 |
+
Both are within visual tolerance for real-time hand tracking.
|
| 76 |
+
|
| 77 |
+
## Quick Start
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from wilor_mlx import WiLoR
|
| 81 |
+
import mlx.core as mx
|
| 82 |
+
|
| 83 |
+
# Everything downloads and caches automatically
|
| 84 |
+
# First run requires torch for one-time MANO conversion; after that, torch is not used
|
| 85 |
+
model = WiLoR.from_pretrained()
|
| 86 |
+
|
| 87 |
+
# Inference
|
| 88 |
+
image = mx.array(your_256x256_hand_crop) # (1, 256, 256, 3) uint8
|
| 89 |
+
result = model(image)
|
| 90 |
+
mx.eval(result)
|
| 91 |
+
|
| 92 |
+
keypoints = result['pred_keypoints_3d'] # (1, 21, 3)
|
| 93 |
+
vertices = result['pred_vertices'] # (1, 778, 3)
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
See [github.com/lyonsno/wilor-mlx](https://github.com/lyonsno/wilor-mlx) for full documentation.
|
| 97 |
+
|
| 98 |
+
## Architecture
|
| 99 |
+
|
| 100 |
+
- **ViT-H/16 backbone:** 1280 embed dim, 32 layers, 16 heads, 210 tokens (192 patches + 18 learnable)
|
| 101 |
+
- **MANO hand model:** 778 vertices, 16 joints, Linear Blend Skinning with kinematic chain
|
| 102 |
+
- **RefineNet:** Multi-scale deconvolution + bilinear grid sampling + MANO parameter refinement
|
| 103 |
+
- **Total parameters:** ~610M
|
| 104 |
+
|
| 105 |
+
## Citation
|
| 106 |
+
|
| 107 |
+
```bibtex
|
| 108 |
+
@article{zhan2024wilor,
|
| 109 |
+
title={WiLoR: End-to-end 3D Hand Localization and Reconstruction in-the-wild},
|
| 110 |
+
author={Zhan, Rolandos Alexandros and others},
|
| 111 |
+
year={2024}
|
| 112 |
+
}
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## License
|
| 116 |
+
|
| 117 |
+
The wilor-mlx code and these weight files are MIT licensed. The weights contain only ViT backbone, RefineNet, and learned embedding parameters — no MANO data is bundled or rehosted.
|
| 118 |
+
|
| 119 |
+
The [MANO hand model](https://mano.is.tue.mpg.de/) is separately licensed by the Max Planck Institute. `WiLoR.from_pretrained()` fetches upstream [WiLoR-mini](https://huggingface.co/warmshao/WiLoR-mini) assets and converts MANO data locally on your machine. You can also supply your own MANO data via `mano_path=...`.
|
wilor-mlx-int4.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e43b1ba75eeeee4f7d7dc7938d4c2103f4d66f19918f5121b1b57522d0d277e
|
| 3 |
+
size 512479104
|
wilor-mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b81d32af65df273e58126b21c7261c57648b7f06035569ff346d4980872c0ee1
|
| 3 |
+
size 2557175539
|