Instructions to use Ko033/distill-any-depth-base-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Ko033/distill-any-depth-base-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('depth-estimation', 'Ko033/distill-any-depth-base-onnx');
Distill-Any-Depth-Base (ONNX, transformers.js-ready)
ONNX weights of Distill Any Depth (Base, ViT-B, 97.5M params) for use with
transformers.js (depth-estimation pipeline).
- Converted from lc700x/Distill-Any-Depth-Base-hf (transformers-format checkpoint of the original Distill Any Depth release).
- Architecture-compatible with Depth Anything V2 (
model_type: depth_anything, relative depth, 518 input, DPT preprocessing). - Variants:
onnx/model_fp16.onnx(WebGPU),onnx/model_quantized.onnx(q8, WASM),onnx/model_q4f16.onnx(q4 weights + fp16 activations, low-memory WebGPU option). - Export notes (patches applied before
torch.onnx.export, verified against PyTorch on square and non-square inputs, fp32 max abs diff < 2e-5):- The upstream depth head bakes the output resize to a constant under ONNX tracing; patched so output size follows input size dynamically.
- torch >= 2.13 exports the SDPA attention scale (
scale=None) as a dynamic Shape->Slice->Cast->Sqrt chain; after fp16 conversion the fp16 Sqrt lands on the CPU EP, which has no fp16 Sqrt kernel, and session creation fails on the WebGPU EP (onnxruntime-web). Patched to pass a constant scale so the chain is never emitted.
Usage (transformers.js)
import { pipeline } from '@huggingface/transformers';
const depth = await pipeline('depth-estimation', 'Ko033/distill-any-depth-base-onnx', {
device: 'webgpu', dtype: 'fp16', // or device: 'wasm', dtype: 'q8'
});
const output = await depth('image.jpg');
License
MIT, following the upstream Distill Any Depth release. Credit: Distill Any Depth: Distillation Creates a Stronger Monocular Depth Estimator (He et al., 2025).
- Downloads last month
- 73
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support