Skip to content

Support <=12GB GPUs: lazy depth model, frame resize, lower tracker caps - #26

Open
Jpalmer95 wants to merge 1 commit into
Seed3D:mainfrom
Jpalmer95:low-vram-12gb-fixes
Open

Support <=12GB GPUs: lazy depth model, frame resize, lower tracker caps#26
Jpalmer95 wants to merge 1 commit into
Seed3D:mainfrom
Jpalmer95:low-vram-12gb-fixes

Conversation

@Jpalmer95

Copy link
Copy Markdown

Three small, opt-in-compatible fixes that let the video-guided animation pipeline run on consumer 12GB cards (tested: RTX 4070 Ti, torch 2.1.1/cu118) without changing behavior on larger GPUs.

Changes

  1. animation/optimization.py — lazy DepthModule. Skip loading Video-Depth-Anything (~1.5GB VRAM) when depth/depth_gt_raw.pt already exists. New companion script precompute_depth.py (repo root) runs VDA standalone so the model is freed before the optimization loop starts. This alone was the difference between OOM and a comfortable run at 512px.

  2. animation/optimization.py — resize frames to --img_size on load. The loader previously assumed extracted frames already matched --img_size, producing RuntimeError: The size of tensor a (512) must match the size of tensor b (960) whenever the source video's native resolution differed. Now resizes with LANCZOS when needed.

  3. animation/utils/save_utils.py — lower tracker caps 15000/4000 → 6000/2000. Dense meshes from modern image-to-3D models (200k+ verts, e.g. TRELLIS.2 outputs) OOM'd CoTracker3's corr-volume einsum even at 512px in 'full' tracking mode. Sampled mode with 2000 points still converges well.

Verification

End-to-end on a 31-joint rigged insect mesh (31k verts after decimation), 40-frame 384px driving video: 300 optimization iterations at ~11.6GB peak VRAM, output motion visually matches the reference video. The stock deer example also still runs (200 iters, 512px, ~8GB peak).

Happy to gate any of these behind CLI flags instead if you'd prefer the defaults unchanged.

Three small fixes that let the video-guided animation pipeline run on
consumer 12GB cards (tested RTX 4070 Ti) without changing results on
larger GPUs:

1. optimization.py: skip loading Video-Depth-Anything (~1.5GB VRAM) when
   depth/depth_gt_raw.pt already exists. Companion script
   precompute_depth.py (new, repo root) runs VDA standalone and frees it
   before the optimization loop.
2. optimization.py: resize loaded frames to --img_size (upstream assumed
   extracted frames already matched, crashing with tensor size mismatch
   whenever the source video's resolution differed).
3. save_utils.py: lower CoTracker full-mode caps 15000/4000 -> 6000/2000.
   Dense meshes (200k+ verts from modern image-to-3D models) OOM'd the
   corr-volume einsum even at 512px.

Verified end-to-end: rigged 31-joint insect mesh (68k->31k verts after
decimation), 40-frame 384px driving video, 300 optimization iterations
at ~11.6GB peak, output motion visually matches the reference video.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant