Skip to content

Commit d7c096f

Browse files
rickstaaRUFFY-369
andauthored
feat(models): add Depth Anything V2 Large model (#79)
This commit adds the large variant of the Depth Anything V2 model to the comfystream container. Co-authored-by: RUFFY-369 <[email protected]>
1 parent a9080db commit d7c096f

File tree

4 files changed

+235
-5
lines changed

4 files changed

+235
-5
lines changed

configs/models.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ models:
1616
- url: "https://huggingface.co/aaronb/dreamshaper-8-dmd-1kstep/raw/main/config.json"
1717
path: "unet/dreamshaper-8-dmd-1kstep.json"
1818

19-
# Depth Anything ONNX model
19+
# Depth Anything V2 ONNX models
2020
depthanything-onnx:
2121
name: "DepthAnything ONNX"
2222
url: "https://huggingface.co/yuvraj108c/Depth-Anything-2-Onnx/resolve/main/depth_anything_v2_vitb.onnx?download=true"
2323
path: "tensorrt/depth-anything/depth_anything_vitl14.onnx"
24+
depth-anything-v2-large-onnx:
25+
name: "DepthAnything V2 Large ONNX"
26+
url: "https://huggingface.co/yuvraj108c/Depth-Anything-2-Onnx/resolve/main/depth_anything_v2_vitl.onnx?download=true"
27+
path: "tensorrt/depth-anything/depth_anything_v2_vitl.onnx"
2428

2529
# TAESD models
2630
taesd:
@@ -68,4 +72,4 @@ models:
6872
name: "ClipTextModel"
6973
url: "https://huggingface.co/Lykon/dreamshaper-8/resolve/main/text_encoder/model.fp16.safetensors"
7074
path: "text_encoders/CLIPText/model.fp16.safetensors"
71-
type: "text_encoder"
75+
type: "text_encoder"

configs/nodes.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ nodes:
1111

1212
comfyui-depthanything-tensorrt:
1313
name: "ComfyUI DepthAnything TensorRT"
14-
url: "https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt"
14+
url: "https://github.com/rickstaa/ComfyUI-Depth-Anything-Tensorrt"
15+
branch: "feature/add-export-trt-args"
1516
type: "tensorrt"
1617

1718
# Ryan's nodes
@@ -74,4 +75,4 @@ nodes:
7475
name: "ComfyUI Stream Pack"
7576
url: "https://github.com/livepeer/ComfyUI-Stream-Pack"
7677
branch: "main"
77-
type: "utility"
78+
type: "utility"

docker/entrypoint.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if [ "$1" = "--build-engines" ]; then
4949
# Build Static Engine for Dreamshaper
5050
python src/comfystream/scripts/build_trt.py --model /workspace/ComfyUI/models/unet/dreamshaper-8-dmd-1kstep.safetensors --out-engine /workspace/ComfyUI/output/tensorrt/static-dreamshaper8_SD15_\$stat-b-1-h-512-w-512_00001_.engine
5151

52-
# Build Engine for DepthAnything2
52+
# Build Engine for Depth Anything V2
5353
if [ ! -f "$DEPTH_ANYTHING_DIR/depth_anything_vitl14-fp16.engine" ]; then
5454
if [ ! -d "$DEPTH_ANYTHING_DIR" ]; then
5555
mkdir -p "$DEPTH_ANYTHING_DIR"
@@ -59,6 +59,14 @@ if [ "$1" = "--build-engines" ]; then
5959
else
6060
echo "Engine for DepthAnything2 already exists, skipping..."
6161
fi
62+
63+
# Build Engine for Depth Anything2 (large)
64+
if [ ! -f "$DEPTH_ANYTHING_DIR/depth_anything_v2_vitl-fp16.engine" ]; then
65+
cd "$DEPTH_ANYTHING_DIR"
66+
python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py --trt-path "${DEPTH_ANYTHING_DIR}/depth_anything_v2_vitl-fp16.engine" --onnx-path "${DEPTH_ANYTHING_DIR}/depth_anything_v2_vitl.onnx"
67+
else
68+
echo "Engine for DepthAnything2 (large) already exists, skipping..."
69+
fi
6270
shift
6371
fi
6472

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
{
2+
"1": {
3+
"inputs": {
4+
"image": "example.png"
5+
},
6+
"class_type": "LoadImage",
7+
"_meta": {
8+
"title": "Load Image"
9+
}
10+
},
11+
"2": {
12+
"inputs": {
13+
"engine": "depth_anything_v2_vitl-fp16.engine",
14+
"images": [
15+
"1",
16+
0
17+
]
18+
},
19+
"class_type": "DepthAnythingTensorrt",
20+
"_meta": {
21+
"title": "Depth Anything Tensorrt"
22+
}
23+
},
24+
"3": {
25+
"inputs": {
26+
"unet_name": "static-dreamshaper8_SD15_$stat-b-1-h-512-w-512_00001_.engine",
27+
"model_type": "SD15"
28+
},
29+
"class_type": "TensorRTLoader",
30+
"_meta": {
31+
"title": "TensorRT Loader"
32+
}
33+
},
34+
"5": {
35+
"inputs": {
36+
"text": "the hulk",
37+
"clip": [
38+
"23",
39+
0
40+
]
41+
},
42+
"class_type": "CLIPTextEncode",
43+
"_meta": {
44+
"title": "CLIP Text Encode (Prompt)"
45+
}
46+
},
47+
"6": {
48+
"inputs": {
49+
"text": "",
50+
"clip": [
51+
"23",
52+
0
53+
]
54+
},
55+
"class_type": "CLIPTextEncode",
56+
"_meta": {
57+
"title": "CLIP Text Encode (Prompt)"
58+
}
59+
},
60+
"7": {
61+
"inputs": {
62+
"seed": 446080115054598,
63+
"steps": 1,
64+
"cfg": 1,
65+
"sampler_name": "lcm",
66+
"scheduler": "normal",
67+
"denoise": 1,
68+
"model": [
69+
"3",
70+
0
71+
],
72+
"positive": [
73+
"9",
74+
0
75+
],
76+
"negative": [
77+
"9",
78+
1
79+
],
80+
"latent_image": [
81+
"16",
82+
0
83+
]
84+
},
85+
"class_type": "KSampler",
86+
"_meta": {
87+
"title": "KSampler"
88+
}
89+
},
90+
"8": {
91+
"inputs": {
92+
"control_net_name": "control_v11f1p_sd15_depth_fp16.safetensors"
93+
},
94+
"class_type": "ControlNetLoader",
95+
"_meta": {
96+
"title": "Load ControlNet Model"
97+
}
98+
},
99+
"9": {
100+
"inputs": {
101+
"strength": 1.0000000000000002,
102+
"start_percent": 0,
103+
"end_percent": 1,
104+
"positive": [
105+
"5",
106+
0
107+
],
108+
"negative": [
109+
"6",
110+
0
111+
],
112+
"control_net": [
113+
"10",
114+
0
115+
],
116+
"image": [
117+
"2",
118+
0
119+
]
120+
},
121+
"class_type": "ControlNetApplyAdvanced",
122+
"_meta": {
123+
"title": "Apply ControlNet"
124+
}
125+
},
126+
"10": {
127+
"inputs": {
128+
"backend": "inductor",
129+
"fullgraph": false,
130+
"mode": "reduce-overhead",
131+
"controlnet": [
132+
"8",
133+
0
134+
]
135+
},
136+
"class_type": "TorchCompileLoadControlNet",
137+
"_meta": {
138+
"title": "TorchCompileLoadControlNet"
139+
}
140+
},
141+
"11": {
142+
"inputs": {
143+
"vae_name": "taesd"
144+
},
145+
"class_type": "VAELoader",
146+
"_meta": {
147+
"title": "Load VAE"
148+
}
149+
},
150+
"13": {
151+
"inputs": {
152+
"backend": "inductor",
153+
"fullgraph": true,
154+
"mode": "reduce-overhead",
155+
"compile_encoder": true,
156+
"compile_decoder": true,
157+
"vae": [
158+
"11",
159+
0
160+
]
161+
},
162+
"class_type": "TorchCompileLoadVAE",
163+
"_meta": {
164+
"title": "TorchCompileLoadVAE"
165+
}
166+
},
167+
"14": {
168+
"inputs": {
169+
"samples": [
170+
"7",
171+
0
172+
],
173+
"vae": [
174+
"13",
175+
0
176+
]
177+
},
178+
"class_type": "VAEDecode",
179+
"_meta": {
180+
"title": "VAE Decode"
181+
}
182+
},
183+
"15": {
184+
"inputs": {
185+
"images": [
186+
"14",
187+
0
188+
]
189+
},
190+
"class_type": "PreviewImage",
191+
"_meta": {
192+
"title": "Preview Image"
193+
}
194+
},
195+
"16": {
196+
"inputs": {
197+
"width": 512,
198+
"height": 512,
199+
"batch_size": 1
200+
},
201+
"class_type": "EmptyLatentImage",
202+
"_meta": {
203+
"title": "Empty Latent Image"
204+
}
205+
},
206+
"23": {
207+
"inputs": {
208+
"clip_name": "CLIPText/model.fp16.safetensors",
209+
"type": "stable_diffusion",
210+
"device": "default"
211+
},
212+
"class_type": "CLIPLoader",
213+
"_meta": {
214+
"title": "Load CLIP"
215+
}
216+
}
217+
}

0 commit comments

Comments
 (0)