Skip to content

Keep TripoSG and the texture model loaded together - #390

Merged
lightningpixel merged 2 commits into
lightningpixel:devfrom
ahgsql:perf/keep-geometry-texture-models-resident
Oct 31, 2026
Merged

lightningpixel merged 2 commits into
lightningpixel:devfrom
ahgsql:perf/keep-geometry-texture-models-resident

Conversation

@ahgsql

@ahgsql ahgsql commented Oct 30, 2026

Copy link
Copy Markdown

I generate a lot of assets with TripoSG for the shape and then Trellis2 "Texture Mesh" for the texture. Every switch between the two goes through switch_model, which unloads the previous model, so both get reloaded for every single asset. On my 3090 Ti that was 20-27 s of "Loading..." per switch.

This adds a small _KEEP_RESIDENT_PAIRS list and skips the unload when you switch between the models in a pair. Right now the only pair is triposg/generate + trellis2/refine. Every other switch, and the LLM eviction above it, behaves exactly as before.

Numbers from my machine (two assets, 3000 faces, models already warm):

wall time
before 197 s
after 110 s

Peak VRAM with both loaded was around 10-11 GB on a 24 GB card, so this does assume a card with room for both. If you'd rather have this behind a setting or a free-VRAM check, I'm happy to change it.

Tested with pytest tests/test_generator_registry.py tests/test_model_router.py tests/test_agent_workflow_unload.py (45 passed, 2 skipped).

ahgsql and others added 2 commits October 30, 2026 23:29
switch_model unloads the previous model on every switch. When you run
TripoSG and then Trellis2 Texture Mesh on the same object, both models get
reloaded for every single asset, which cost me 20-27 s per switch on a
3090 Ti.

This keeps the two loaded side by side. Any other switch, and the LLM
eviction, works exactly as before.

Two assets (cart + soldier, 3000 faces, warm): 197 s -> 110 s.
… pair on VRAM

switch_model only unloaded the previous active model. After
TripoSG -> Trellis2 refine -> any other model, TripoSG was no longer
active but stayed loaded beside the new model until unload_all.
switch_model now unloads every loaded model except the target and its
resident partners.

Keeping both models resident also assumed a card with room for both
(~10-11 GB peak). Each pair now declares a minimum total VRAM; below it,
or when no NVIDIA GPU answers, switching behaves as before. The pair is
set to 19.5 GiB (24 GB cards), the configuration the speedup was
measured on. Manifests can't size this: TripoSG declares no vram_gb.
@lightningpixel
lightningpixel merged commit ca1b909 into lightningpixel:dev Oct 31, 2026
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.

2 participants