StableNormal turbo
StableNormal turbo from Stable-X (Ye et al., SIGGRAPH Asia 2024): surface normals from one image in one step on a Stable Diffusion UNet with a ControlNet image encoder. Apache-2.0 code and weights.
experimental Fork of Stable-X/StableNormal@594b934 · backends: portable, kernels
- Paper StableNormal: Reducing Diffusion Variance for Stable and Sharp Normal SIGGRAPH Asia 2024 · first released 24 Jun 2024
Checkpoint stablenormal-turbo
Paper 2024 Added in 0.2.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("stablenormal-turbo") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.normals
result.backend # what ran: mode, device, dtype, kernels fastforks bench stablenormal-turbo 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.
Input: synthetic, 994x1482 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16the authors' mixed-precision option (float16); upstream YOSONormalsPipeline (turbo, t_start 0), diffusers 0.41.0, latents seed 0 | fp16 | 299 | – | 4,156 MiB/4,374 MiB | 0.9 | 0.54 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 289 | 1.0× | 3,463 MiB/3,628 MiB | 2.9 | 0.54 |
| Kernels | fp16 | 180 | 1.7× | 3,037 MiB/3,172 MiB | 3.3 | 0.35 |
| Portable + torch.compile | 238 | 1.3× | 3,019 MiB/3,106 MiB | 76 (build) | – | |
| TensorRT fp16 | fp16 | 118 | 2.5× | 3,016 MiBenginenot comparable | 199 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-13. 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-13 | Original | fp32 | 51987 | 11.2 GiB process | – | 994x1482 |
| Portable | fp16 | 1690 | 8,985 MiB process | matches | 994x1482 | |
| Portable | fp32 | 2718 | 10.8 GiB process | matches | 994x1482 | |
| Kernels | fp16 | not implemented | – | 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 LICENSE
- Weights
- Apache-2.0 source
- Training data
- Stable Diffusion 2 (LAION-5B subsets) fine-tuned on synthetic and real normals datasets (Hypersim, Replica, ScanNet and others per the StableNormal paper, arXiv 2406.16864)
Our reading of the licences, not legal advice.
Weights
unet/diffusion_pytorch_model.fp16.safetensors 1.7 GB· hosted on Hugging Facevae/diffusion_pytorch_model.fp16.safetensors 167 MB· hosted on Hugging Facetext_encoder/model.fp16.safetensors 681 MB· hosted on Hugging Facecontrolnet/diffusion_pytorch_model.fp16.safetensors 728 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download stablenormal-turbo).
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.
iBims-1 normals
mean / median angle deg, % < 11.25 / < 30 deg
| Run | dtype | ang_mean ↑ | ang_median ↑ | a11.25 ↑ | a30 ↑ | Δ ang_mean vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 17.46 | 8.26 | 63.83 | 82.71 | reference | 100 | 669 |
| Original fp16 | fp16 | 17.46 | 8.26 | 63.83 | 82.70 | −0.00 | 100 | 328 |
| Portable fp32 | fp32 | 17.46 | 8.26 | 63.83 | 82.71 | ±0.00 | 100 | 652 |
| Portable | fp16 | 17.46 | 8.26 | 63.83 | 82.71 | −0.00 | 100 | 317 |
| Kernels | fp16 | 17.46 | 8.26 | 63.83 | 82.71 | −0.00 | 100 | 198 |
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-13; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks aee4b565, 2026-11-13.
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| <= 1e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00046 and p99 <= 0.0021 (absolute error of the output normals).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.00001 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.00046 | 0.0003 |
| GPU default dtypes, p99 |diff| | ≤ 0.0021 | 0.00138 |
Recorded for stablenormal-turbo on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-13, with these kernels: cudnn_hacc
Details
StableNormal turbo (Ye et al., SIGGRAPH Asia 2024): surface normals in one step (YOSO, v0.3); a Stable Diffusion 2 UNet denoises a normals latent with the image latent fed through a ControlNet encoder.
- 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 >= 1, resized or padded inside the model; tested up to 3000x4000 (3,710 MiB allocated)
- Options
long_side=768>= 0· changes the outputseed=0· changes the output
- Outputs
normals- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Limitations
- Normals only: no depth.
- Diffusion model: the seeded noise comes from a CPU generator; upstream draws it from the unseeded global RNG, so its outputs vary from call to call (slightly).
- Upstream's `Predictor` wrapper (pre-resize to a multiple of 64 near 1024 px, uint8 round trip, LANCZOS back) is not applied: the runners follow its pipeline (768 px).
- A traced or exported module reuses the noise of its traced shape.
Full reference, generated from the repository
StableNormal turbo from Stable-X (Ye et al., SIGGRAPH Asia 2024): surface normals from one image in one step on a Stable Diffusion UNet with a ControlNet image encoder. Apache-2.0 code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
stablenormal-turbo | synthetic (994x1482) | original portable kernels portable + torch.compile TensorRT fp16 | 299 289 180 238 118 | 4156 / 4374 3463 / 3628 3037 / 3172 3019 / 3106 5587 / 5626 |
Details
- Original code: https://github.com/Stable-X/StableNormal at
594b934630ab - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- Licence evidence: https://github.com/Stable-X/StableNormal/blob/594b934630ab3bc71f35c77d14ec7feb98480cd0/LICENSE.txt (Apache-2.0); https://huggingface.co/Stable-X/yoso-normal-v0-3/blob/2202fcb69960d94b437e06c19c556a12ceeb57c0/README.md (license: apache-2.0)
- Training data: Stable Diffusion 2 (LAION-5B subsets) fine-tuned on synthetic and real normals datasets (Hypersim, Replica, ScanNet and others per the StableNormal paper, arXiv 2406.16864)
- Options:
long_side= 768 (>= 0; alsoprocessing_res),seed= 0 - Kernel libraries:
cudnn_hacc - Variants:
stablenormal-turbo - Outputs: normals; kind:
none - Input size: any H x W >= 1, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
stablenormal-turbo3000x4000 (3.6 GiB peak allocated, 4.8 reserved) stablenormal-turbo994x1482, first call: portable + torch.compile 76 s (cold Inductor cache), TensorRT fp16 198 s (ONNX + engine).stablenormal-turbooriginal 994x1482: the authors' mixed-precision option (float16); upstream YOSONormalsPipeline (turbo, t_start 0), diffusers 0.41.0, latents seed 0stablenormal-turboload / first call: original 6.36 s / 1.128 s, portable 2.94 s / 0.544 s, kernels 3.25 s / 0.352 s- 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 |
|---|---|---|---|---|---|---|---|
stablenormal-turbo | iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg | 17.46 / 8.26 / 63.83 / 82.71 | 17.46 / 8.26 / 63.83 / 82.70 | 17.46 / 8.26 / 63.83 / 82.71 | 17.46 / 8.26 / 63.83 / 82.71 | 17.46 / 8.26 / 63.83 / 82.71 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks aee4b565, 2026-11-13.
Parity
CPU, float32: max |diff| <= 1e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00046 and p99 <= 0.0021 (absolute error of the output normals).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
stablenormal-turbo | 0.0003 / 0.00138 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Limitations
- Normals only: no depth.
- Diffusion model: the seeded noise comes from a CPU generator; upstream draws it from the unseeded global RNG, so its outputs vary from call to call (slightly).
- Upstream's
Predictorwrapper (pre-resize to a multiple of 64 near 1024 px, uint8 round trip, LANCZOS back) is not applied: the runners follow its pipeline (768 px). - A traced or exported module reuses the noise of its traced shape.
Example output
No example rendered for this checkpoint yet.