Depth Pro 2 H+, MLX, 8-bit encoder (groups of 64)
Changelog
2026-12-03: weights replaced.
- What was wrong: the first weights returned NaN or inf for part of the image on some inputs. Every fifth frame of 12 Sintel scenes as single images: 31 of 115 frames, on 4 scenes, up to 40% of the pixels. In video, 5 of 12 scenes. The iBims-1 and KITTI test images were all finite, so the check before release did not catch it. The first card also said that single images were not affected, which was wrong.
- When found: 2026-12-02 (IST), the day after the release, when the study's Sintel video runs finished.
- Cause: two float16 overflows. The output of the last encoder block passes float16's maximum (65504) on some inputs, and MLX's Winograd convolution on the GPU overflows inside the decoder although its inputs and outputs are in range.
- What changed: the last encoder block, the reassemble stage that reads it and the decoder are now float32. The rest stays float16 and the encoder keeps the same 8-bit recipe. Every frame of the same 12 scenes (571 frames): 0 with a non-finite pixel, as single images and in both video modes (video with the fix of mlx-vlm PR #2864, see below).
- Old weights: still in this repository's history, at revision
332ed37. Do not use them.
2026-12-02: card corrected to describe the problem, before the fix was known.
2026-12-01: first release.
What this is
Unofficial; derived from Apple's Depth Pro 2; not endorsed by Apple. For non-commercial scientific research only.
Apple's Depth Pro 2 H+ for mlx-vlm on Apple Silicon, with every linear layer of the encoder's transformer blocks quantized to 8 bits (160 layers, affine, groups of 64). The rest is float16, except float32 where float16 overflows (see Modifications). Its output is within the deployment spread on both of the study's full test sets.
Check the output for non-finite values. "Finite" is tested, not proven: 300 test images and 571 Sintel frames. Use
mx.isfinite(result["inverse_depth"]).all(), on the inverse depth: depth itself is infinite where the inverse depth is zero, such as sky. Where it fails, use Apple's float32 weights.
Use
import mlx.core as mx
from mlx_vlm import load
from mlx_vlm.models.depth_pro_2.generate import DepthPro2Predictor, read_image
model, processor = load("shubhambaid/shallowend-dp2-h-mlx-w8g64")
predictor = DepthPro2Predictor(model, processor)
result = predictor.infer(read_image("image.jpg"))
assert mx.isfinite(result["inverse_depth"]).all()
depth_m = result["depth"]
Do not call model.to_float16() or set_dtype on it: that would undo the float32 parts.
Video needs mlx-vlm PR #2864. Released mlx-vlm averages the frames' prefix tokens in float16 before each cross-frame block, and for H+ that sum overflows. This is in the library's code, so the weights cannot fix it. The fix (average in float32) is PR #2864; the video checks above were run with it.
Results
Fidelity to Apple's PyTorch model at FP32, full test sets:
| Test set | Images | Mean difference from FP32 | Upper 95% bound | Deployment spread | Verdict |
|---|---|---|---|---|---|
| iBims-1 (indoor) | 100 | 0.088% | 0.098% | 0.161% | within deployment spread |
| KITTI Eigen (outdoor) | 200 | 0.117% | 0.123% | 0.270% | within deployment spread |
Accuracy against ground truth:
| Test set | Model | delta1 | AbsRel |
|---|---|---|---|
| iBims-1 | Apple's PyTorch model, FP32 | 0.9443 | 0.0853 |
| iBims-1 | the same port, float16, unquantized | 0.9443 | 0.0853 |
| iBims-1 | this model | 0.9443 | 0.0853 |
| KITTI | Apple's PyTorch model, FP32 | 0.9774 | 0.0575 |
| KITTI | the same port, float16, unquantized | 0.9775 | 0.0574 |
| KITTI | this model | 0.9775 | 0.0574 |
Speed and size (one 640x480 frame, Mac mini M4 Pro, 24 GB, MLX on the GPU). Timed back to back in one session:
| Median latency | p90 | Weights | Peak process memory | |
|---|---|---|---|---|
| these weights | 528.7 ms | 528.9 ms | 0.99 GiB | 8.91 GiB |
| first release (replaced) | 518.4 ms | 518.6 ms | 0.94 GiB | 8.36 GiB |
The unquantized float16 port took 490 ms with 1.67 GiB of weights in an earlier session. What 8 bits buys here is a smaller download, not speed.
Modifications from Apple's release
- Converted from Apple's PyTorch checkpoint (
apple/DepthPro2-H) and focal estimator (apple/DepthPro2-focal) to the mlx-vlm Depth Pro 2 port, in the layout of the converted mlx-vlm checkpoints (focal estimator bundled). - Encoder, reassemble stages and the focal estimator's trunk cast to float16, except the last encoder block and the last reassemble stage, which are float32. The decoder, the inverse-depth head and the focal head are float32.
- Every
Linearin the encoder's transformer blocks quantized withmlx.nn.quantize(8 bits, group size 64, affine). Nothing else is quantized. - No retraining, no change to the architecture.
Reloading this folder with stock mlx_vlm.load gives parameters and outputs bitwise identical to the model the study
evaluated (checked on 3 iBims-1 images). model.safetensors SHA-256: 042abad83a2f3cf89f1d7e580f1ebea755b00e9c417d1fce9c403397919b0469.
License and terms
Apple Machine Learning Research Model is licensed under the Apple Machine Learning Research Model License Agreement.
The weights are Apple's Depth Pro 2 H+ weights, modified as listed above, and remain under the
Apple Machine Learning Research Model License Agreement, included as LICENSE (byte-identical to Apple's
LICENSE_MODEL). They are for non-commercial scientific research only. This is an unofficial release derived from
Apple's Depth Pro 2; it is not made, reviewed or endorsed by Apple.
Evaluation data
iBims-1 (100 test images) and the KITTI Eigen test split (200 images used here) are not included. Fidelity is the mean relative difference of inverse depth from Apple's PyTorch model at FP32 on the same image, with a bootstrap 95% interval. The deployment spread is the largest such difference among Apple's own full-precision paths (bf16 on the GPU, Core ML FP16 on the GPU and on the Neural Engine) on the same images, at its upper 95% bound: "within" means no more different from FP32 than choosing another of Apple's official paths. Accuracy uses the ground-truth focal length. Every number here is generated from the study's result files.
More
Study, method and all results: https://shallowend.alethic-labs.com. Code and per-image results: https://github.com/shubhambaid/shallow-end.