InstantMesh icon indicating copy to clipboard operation
InstantMesh copied to clipboard

Out of memory running the gradio example

Open Zankaster opened this issue 1 year ago • 2 comments

After installing all the dependencies for the repo I ran the gradio app, but any model I try to generate from the available examples returns the same error:

File "/InstantMesh/src/models/renderer/synthesizer_mesh.py", line 76, in get_geometry_prediction grid_features = torch.index_select(input=sampled_features, index=flexicubes_indices.reshape(-1), dim=1) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 15.00 GiB. GPU 0 has a total capacty of 23.64 GiB of which 12.47 GiB is free. Including non-PyTorch memory, this process has 9.95 GiB memory in use. Of the allocated memory 9.19 GiB is allocated by PyTorch, and 300.33 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

I'm running the app from Debian 12 with a NVIDIA 4090 with 24GB of memory, isn't this enough or there is some setting I can change to make it work with the available memory? Just to be clear the 12.47GB allocated have been allocated by the gradio app, I run nvidia-smi --query-gpu=memory.free --format=csv just before to launch the app and it shows basically all memory available

EDIT I tried running the command python run.py configs/instant-mesh-large.yaml examples/hatsune_miku.png --save_video And it worked quite fast and without memory issues, at this point I'd just like to understand what's so different in the gradio demo

Zankaster avatar Jul 15 '24 20:07 Zankaster

Any answer on this? The same is happening to me. Running from command line it works perfectly but from Gradio I get CUDA out of memory 😅

pfirmino avatar Nov 12 '24 17:11 pfirmino

instant-mesh-base.yaml you can use this instead of instant-mesh-large.yaml

jinchengli2022 avatar Feb 05 '25 17:02 jinchengli2022