Marigold
Marigold from ETH Zurich (PRS): depth from one image by diffusion on a Stable Diffusion UNet. Commercially usable under an OpenRAIL licence.
stable Fork of prs-eth/Marigold@2bfbdea · backends: portable, kernels
- Paper Repurposing Diffusion-Based Image Generators for Monocular Depth Estimation CVPR 2024 · first released 4 Dec 2023
Checkpoint marigold-depth-v1-1
Paper 2023 Added in 0.1.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import depth
model = depth.load("marigold-depth-v1-1") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.depth
result.backend # what ran: mode, device, dtype, kernels fastforks bench marigold-depth-v1-1 Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 963 | 0.46× | 6,406 MiB/6,804 MiB | 14.1 | 1.61 |
| Original fp16the authors' float16 model option; fp16 = upstream's own torch_dtype=float16 pipeline | fp16 | 439 | – | 3,414 MiB/3,580 MiB | 1.3 | 0.60 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 410 | 1.1× | 2,776 MiB/2,938 MiB | 11.0 | 0.41 |
| Kernels | fp16 | 261 | 1.7× | 2,343 MiB/2,500 MiB | 2.5 | 0.26 |
| Portable + torch.compile | 342 | 1.3× | 2,341 MiB/2,418 MiB | 127 (build) | – | |
| TensorRT fp16 | fp16 | 172 | 2.6× | 2,368 MiBenginenot comparable | 285 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-06 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12 | Original | fp32 | 3237 | 10.2 GiB process | matches | 994x1482 |
| Portable | fp16 | 2498 | 6,640 MiB process | matches | 994x1482 | |
| Portable | fp32 | 2970 | 9,709 MiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 457 | 2,756 MiB/2,920 MiB | – | 994x1482 |
| Kernels | fp16 | 346 | 2,331 MiB/2,480 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 140 | 2,756 MiB/2,920 MiB | – | 994x1482 |
| Kernels | fp16 | 128 | 2,331 MiB/2,480 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 341 | 2,756 MiB/2,920 MiB | – | 994x1482 |
| Kernels | fp16 | 260 | 2,331 MiB/2,480 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 177 | 2,756 MiB/2,920 MiB | – | 994x1482 |
| Kernels | fp16 | 200 | 2,521 MiB/2,622 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 99.7 | 2,780 MiB/2,940 MiB | – | 994x1482 |
| Kernels | fp16 | 74.8 | 2,355 MiB/2,500 MiB | – | 994x1482 | |
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0 LICENSELICENSE-MODELLICENSE-huggingface
- Weights
- LicenseRef-CreativeML-OpenRAIL-PlusPlus-M source
- Training data
- Stable Diffusion 2 (LAION-5B subsets) fine-tuned on the synthetic Hypersim and Virtual KITTI 2 datasets per the Marigold papers (arXiv 2312.02145, 2505.09358)
- The weights use the OpenRAIL++-M licence: commercial use is allowed but with use restrictions that must be passed on; the training data terms are not checked.
Our reading of the licences, not legal advice.
Weights
unet/diffusion_pytorch_model.safetensors 3.5 GB· hosted on Hugging Facevae/diffusion_pytorch_model.safetensors 335 MB· hosted on Hugging Facetext_encoder/model.safetensors 1.4 GB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download marigold-depth-v1-1).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
NYUv2 test
AbsRel / delta1
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0561 | 0.9703 | reference | 654 | 1070 |
| Original fp16 | fp16 | 0.0561 | 0.9703 | ±0.0000 | 654 | 470 |
| Portable fp32 | fp32 | 0.0561 | 0.9703 | ±0.0000 | 654 | 1047 |
| Portable | fp16 | 0.0561 | 0.9703 | ±0.0000 | 654 | 456 |
| Kernels | fp16 | 0.0561 | 0.9703 | ±0.0000 | 654 | 433 |
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
iBims-1
AbsRel / delta1
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0499 | 0.9721 | reference | 100 | 1075 |
| Original fp16 | fp16 | 0.0499 | 0.9721 | ±0.0000 | 100 | 472 |
| Portable fp32 | fp32 | 0.0499 | 0.9721 | ±0.0000 | 100 | 1052 |
| Portable | fp16 | 0.0499 | 0.9722 | ±0.0000 | 100 | 458 |
| Kernels | fp16 | 0.0499 | 0.9721 | ±0.0000 | 100 | 434 |
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
ETH3D two-view train left
AbsRel / delta1training data not stated: possibly seen
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.1141 | 0.8715 | reference | 27 | 830 |
| Original fp16 | fp16 | 0.1141 | 0.8715 | ±0.0000 | 27 | 379 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.1141 | 0.8715 | ±0.0000 | 27 | 360 |
| Kernels | fp16 | 0.1141 | 0.8716 | ±0.0000 | 27 | 228 |
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 491e248a, 2026-11-11.
Middlebury 2014 trainingH left
AbsRel / delta1training data not stated: possibly seen
| Run | dtype | AbsRel ↓ | δ1 ↑ | Δ AbsRel vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 0.0413 | 0.9899 | reference | 15 | 1016 |
| Original fp16 | fp16 | 0.0413 | 0.9899 | ±0.0000 | 15 | 466 |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 0.0413 | 0.9899 | ±0.0000 | 15 | 429 |
| Kernels | fp16 | 0.0413 | 0.9899 | ±0.0000 | 15 | 275 |
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 491e248a, 2026-11-11.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1 % and p99 <= 3 % of the reference's median |value| (absolute error of the output depth).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.0001 (relative) | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.01 (relative) | 0.00013 (relative) |
| GPU default dtypes, p99 |diff| | ≤ 0.03 (relative) | 0.00047 (relative) |
Recorded for marigold-depth-v1-1 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-29, with these kernels: cudnn_hacc
Details
Marigold (Ke et al. 2023): affine-invariant monocular depth by diffusion; a Stable Diffusion 2 UNet fine-tuned to denoise a depth latent conditioned on the image latent (depth v1-1, few DDIM steps).
- Input / output
- Input: one RGB image. Output: a depth or inverse-depth map.
What the numbers mean, and which models need the camera focal length
kind(a card field,result.kind) says what the numbers mean:metric= metres;scale_invariant,affine_invariant,affine_invariant_log(log depth) andaffine_invariant_inverseare relative (unknown scale or shift, not metres). Metric models that use the focal length takemodel(image, intrinsics=K)(K[3, 3], pixels of the input):metric3d-vit-largeandda3metric-largeneed it for correct metres (da3metric-large: metres = output x focal / 300; withoutintrinsics=a 300 px focal length is assumed, wrong for a real camera).unidepth-v2-vitl14,unik3d-vitl,depth-proand MoGe estimate the camera themselves (givenintrinsics=replacefx);zoedepth-nkand the relative models (da3mono-largetoo) take none. Normals-only models (kindnone) returnresult.normals[B, H, W, 3](unit vectors, camera frame: x right, y down, z forward). - Input size
- any H x W >= 8, resized or padded inside the model; tested up to 3000x4000 (3,033 MiB allocated)
- Options
steps=41 to 1000· changes the outputlong_side=768>= 0· changes the outputseed=2024· changes the output
- Outputs
depth- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Limitations
- Diffusion model: the seeded noise comes from a CPU generator and differs from the original code's CUDA generator for the same seed.
- A traced or exported module reuses the noise of its traced shape.
- Kernels time is dominated by unfused elementwise kernels (GroupNorm / SiLU / adds).
Full reference, generated from the repository
Marigold from ETH Zurich (PRS): depth from one image by diffusion on a Stable Diffusion UNet. Commercially usable under an OpenRAIL licence.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
marigold-depth-v1-1 | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 963 439 410 261 342 172 | 6406 / 6804 3414 / 3580 2776 / 2938 2343 / 2500 2341 / 2418 4263 / 4318 |
Details
- Original code: https://github.com/prs-eth/Marigold at
2bfbdea - Code licence: Apache-2.0 (permissive); files:
LICENSE,LICENSE-MODEL,LICENSE-huggingface - Weights licence: LicenseRef-CreativeML-OpenRAIL-PlusPlus-M
- Licence evidence: https://huggingface.co/prs-eth/marigold-depth-v1-1/blob/9571e7123e258cf052b4e54241f17971c290e9a8/README.md (License: CreativeML Open RAIL++-M)
- Training data: Stable Diffusion 2 (LAION-5B subsets) fine-tuned on the synthetic Hypersim and Virtual KITTI 2 datasets per the Marigold papers (arXiv 2312.02145, 2505.09358)
- Licence note: The weights use the OpenRAIL++-M licence: commercial use is allowed but with use restrictions that must be passed on; the training data terms are not checked.
- Options:
steps= 4 (1 to 1000),long_side= 768 (>= 0; alsoprocessing_res),seed= 2024 - Kernel libraries:
cudnn_hacc - Variants:
marigold-depth-v1-1 - Outputs: depth; kind:
affine_invariant - Input size: any H x W >= 8, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
marigold-depth-v1-13000x4000 (3.0 GiB peak allocated, 3.8 reserved) marigold-depth-v1-1994x1482, first call: portable + torch.compile 127 s (cold Inductor cache), TensorRT fp16 285 s (ONNX + engine).marigold-depth-v1-1original 994x1482: the authors' float16 model option; fp16 = upstream's own torch_dtype=float16 pipelinemarigold-depth-v1-1load / first call: original 1.32 s / 0.599 s, portable 11.04 s / 0.886 s (518x770), kernels 2.49 s / 0.504 s (518x770)- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
marigold-depth-v1-1 | NYUv2 test, AbsRel / delta1 | 0.0561 / 0.9703 | 0.0561 / 0.9703 | 0.0561 / 0.9703 | 0.0561 / 0.9703 | 0.0561 / 0.9703 | |
marigold-depth-v1-1 | iBims-1, AbsRel / delta1 | 0.0499 / 0.9721 | 0.0499 / 0.9721 | 0.0499 / 0.9722 | 0.0499 / 0.9721 | 0.0499 / 0.9721 | |
marigold-depth-v1-1 | ETH3D two-view train left, AbsRel / delta1 | 0.1141 / 0.8715 | 0.1141 / 0.8715 | 0.1141 / 0.8715 | 0.1141 / 0.8716 | possibly in the training data | |
marigold-depth-v1-1 | Middlebury 2014 trainingH left, AbsRel / delta1 | 0.0413 / 0.9899 | 0.0413 / 0.9899 | 0.0413 / 0.9899 | 0.0413 / 0.9899 | possibly in the training data |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 491e248a / 939adfe8, 2026-11-06 to 2026-11-11; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6d3bab64, 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 491e248a / 939adfe8, 2026-11-06 to 2026-11-11.
Parity
CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1 % and p99 <= 3 % of the reference's median |value| (absolute error of the output depth).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
marigold-depth-v1-1 | 0.00013 / 0.00047 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Limitations
- Diffusion model: the seeded noise comes from a CPU generator and differs from the original code's CUDA generator for the same seed.
- A traced or exported module reuses the noise of its traced shape.
- Kernels time is dominated by unfused elementwise kernels (GroupNorm / SiLU / adds).
Example output
One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).
Input: A cup of coffee, Rachel Michetti (CC0).