Got this running on runpod serverless. Repo link in issue
https://github.com/juan-altatech/depth-flow
Feel free to copy into docs if you'd like to. Hope this helps someone!
Thanks for depthflow!
Thanks for the contribution!
I have also got it running on runpod last december with my docker images here on GHCR 🙂, though I need to update the docs at https://brokensrc.dev/get/docker/#runpod, proof logs below, with working GPU acceleration:
(Click to expand)
2024-12-11T21:26:21.982419927Z │DepthFlow├┤0'02.068├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/ShaderFlow
2024-12-11T21:26:21.983184485Z │DepthFlow├┤0'02.071├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/ShaderFlow/Dump
2024-12-11T21:26:23.671401430Z │DepthFlow├┤0'03.758├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/DepthFlow
2024-12-11T21:26:23.672244067Z │DepthFlow├┤0'03.760├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/DepthFlow/Data
2024-12-11T21:26:23.854555819Z │DepthFlow├┤0'03.942├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/DepthFlow/Cache
2024-12-11T21:26:25.909022569Z │DepthFlow├┤0'05.996├┤INFO │ ▸ Launching DepthFlow Server
2024-12-11T21:26:25.915603493Z --- Starting Serverless Worker | Version 1.3.0 ---
2024-12-11T21:26:26.044038542Z INFO: Started server process [19]
2024-12-11T21:26:26.044067488Z INFO: Waiting for application startup.
2024-12-11T21:26:26.044271053Z INFO: Application startup complete.
2024-12-11T21:26:26.044756925Z INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024-12-11T21:26:26.076873003Z │DepthFlow├┤0'06.163├┤INFO │ ▸ (Module 2 • DepthScene ) Initializing scene 'DepthScene' with backend headless
2024-12-11T21:26:26.078858596Z │DepthFlow├┤0'06.166├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/DepthFlow/Config
2024-12-11T21:26:26.081501516Z INFO | sync-2b655733-7560-40c7-a9b6-276f212daf84-u1 | Started
2024-12-11T21:26:26.569686913Z │DepthFlow├┤0'06.655├┤INFO │ ▸ (Module 2 • DepthScene ) OpenGL Renderer: NVIDIA A100 80GB PCIe/PCIe/SSE2
2024-12-11T21:26:26.594684831Z │DepthFlow├┤0'06.681├┤INFO │ ▸ (Module 1 • DepthScene ) Initializing scene 'DepthScene' with backend headless
2024-12-11T21:26:26.598860927Z │DepthFlow├┤0'06.686├┤INFO │ ▸ (Module 3 • DepthScene ) Initializing scene 'DepthScene' with backend headless
2024-12-11T21:26:26.675937659Z │DepthFlow├┤0'06.763├┤INFO │ ▸ (Module 1 • DepthScene ) OpenGL Renderer: NVIDIA A100 80GB PCIe/PCIe/SSE2
2024-12-11T21:26:26.756567495Z │DepthFlow├┤0'06.841├┤INFO │ ▸ (Module 3 • DepthScene ) OpenGL Renderer: NVIDIA A100 80GB PCIe/PCIe/SSE2
2024-12-11T21:26:26.781331530Z Rendering payload: {"input":{"image":"https://w.wallhaven.cc/full/ex/wallhaven-ex1yxk.jpg","depth":null},"estimator":{"model":"small","type":"depthanything2"},"animation":{"steps":[]},"upscaler":{"model":"any","width":0,"height":0,"scale":2,"passes":1,"format":"jpg","quality":95,"type":"none"},"render":{"width":1920,"height":null,"ratio":null,"bounds":null,"scale":1.0,"fps":60.0,"quality":50.0,"ssaa":1.0,"time":30.0,"loop":1,"buffers":2,"noturbo":false,"format":"mp4"},"ffmpeg":{"hide_banner":true,"shortest":false,"stream_loop":0,"time":0.0,"vsync":"cfr","loglevel":"info","hwaccel":null,"threads":0,"inputs":[],"filters":[],"outputs":[],"video_codec":{"type":"h264","preset":"slow","tune":null,"profile":null,"faststart":true,"rgb":false,"crf":20,"bitrate":null,"x264params":[]},"audio_codec":null}}
2024-12-11T21:26:27.078523833Z │DepthFlow├┤0'07.165├┤INFO │ ▸ (Module 3 • DepthScene ) Loading image: https://w.wallhaven.cc/full/ex/wallhaven-ex1yxk.jpg
2024-12-11T21:26:27.079293440Z │DepthFlow├┤0'07.166├┤INFO │ ▸ (Module 3 • DepthScene ) Loading depth: Estimating from image
2024-12-11T21:26:27.290733930Z │DepthFlow├┤0'07.377├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/Broken
2024-12-11T21:26:27.291674423Z │DepthFlow├┤0'07.378├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/Broken/Cache
2024-12-11T21:26:32.635686713Z The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a one-time only operation. You can interrupt this and resume the migration later on by calling `transformers.utils.move_cache()`.
2024-12-11T21:26:32.639463342Z
0it [00:00, ?it/s]
0it [00:00, ?it/s]
2024-12-11T21:26:32.682560953Z │DepthFlow├┤0'12.769├┤INFO │ ▸ Loading Depth Estimator model (depth-anything/Depth-Anything-V2-small-hf)
2024-12-11T21:26:38.199472697Z │DepthFlow├┤0'18.286├┤INFO │ ▸ Creating directory: /root/.local/share/BrokenSource/Broken/Externals
2024-12-11T21:26:38.203591333Z │DepthFlow├┤0'18.289├┤INFO │ ▸ Running command ('/usr/local/bin/ffmpeg', '-threads', '0', '-hide_banner', '-loglevel', 'error', '-f', 'rawvideo', '-s', '1920x1080', '-pix_fmt', 'rgb24', '-r', '60.0', '-i', '-', '-f', 'lavfi', '-t', '30.0', '-i', 'anullsrc=channel_layout=stereo:sample_rate=44100', '-c:v', 'libx264', '-movflags', '+faststart', '-preset', 'slow', '-crf', '20', '-vf', 'scale=1920:1080:flags=lanczos,vflip', '-pix_fmt', 'yuv420p', '/tmp/tmpch2lxdu1.mp4', '-y', '-t', '30.0') @ (/App)
2024-12-11T21:26:44.752148245Z
Scene #0 (DepthScene) → Video: 96%|█████████▌| 1720/1800 [00:12<02024-12-11T21:26:51.564062371Z │DepthFlow├┤0'31.651├┤INFO │ ▸ (Module 3 • DepthScene ) Waiting for FFmpeg process to finish (Queued writes, codecs lookahead, buffers, etc)
2024-12-11T21:26:52.043399790Z │DepthFlow├┤0'32.130├┤INFO │ ▸ (Module 3 • DepthScene ) Finished rendering (/tmp/tmpch2lxdu1.mp4)
2024-12-11T21:26:52.044583503Z │DepthFlow├┤0'32.131├┤INFO │ ▸ (Module 3 • DepthScene ) • Stats: (Took 13.82s) at (130.24fps | 2.17x Realtime) with (1800 Total Frames)
Sidenote: You should start the scene as DepthScene(backend="headless") in your repo so EGL is used for headless OpenGL and finding the GPU, not sure if you had issues with glfw and it fallbacking to software rendering (CPU) with llvmpipe (VERY slow), and if you can, please pin the version with pip install depthflow==0.8.0 so on a new release soon-ish it doesn't break for you 👍🏻
I'm working on having each scene to easily define a pydantic configuration class to have it on an local hosted API or in the cloud (stuff for the short/medium future), old screenshot below with FastAPI:
We might have the depthflow server runpod command in the current docker images with this exact this api structure, but it'll change in the future
The server/api code in this repo is currently broken but I'm almost figuring out how to do it in a nice way and have a second iteration of the infrastructure for it, definitely a v0.10 thing at least a month or two away
I'm really glad you made something that at least works for the time being, feel free to share it! 😅
Will keep the issue open until I've got better integrations for it !
awesome! thanks for the project, it's pretty sweet.