Comfy-Org / Comfy-Org/ComfyUI

Trellis2 PixelArtistry_Pixal3D_native PostProcessing > Remesh Mesh to a Small Image, Out of Memory

Open
#15,996 2 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [ ] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

Expect Trellis2 PixelArtistry Pixal3D from image input to 3D model.

### Actual Behavior

Crash midway when PostProcessing Remesh Mesh node is running.

### Steps to Reproduce

# System Info

System RAM: 32GB
Video Card: GTX 4070 12GB
OS: Windows 10
ComfyUI settings:
version: 3.14.3

Image

Workflow: PixelArtistry_Pixal3D_native.json from https://drive.google.com/file/d/1Pi5_MiMajUFDW1NkJf4iuQp4KMLsZTRg/view?usp=drive_link
Diffusion Model: pixal3d_int8_convrot.safetensors

### Debug Logs

```powershell
Initial State: 1.4/12GB VRAM, 0GB Shared GPU Memory Usage

When step reaches Shape Generation: 9.3/12GB VRAM, 3.5GB Shared GPU Memory 3GB
Log: Requested to load ShapeVae Model ShapeVae prepared for dynamic VRAM loading. 277MB Staged. 0 patches attached. Force pre-loaded 196 weights: 785738 KB

After 2 mins of Shape Generation: 9.3/12GB VRAM, 6.3GB Shared GPU RAM Memory 3GB
Log: Model Trellis2 prepared for dynamic VRAM loading. 5320MB Staged. 0 patches attached. Force pre-loaded 720 weights: 6259 KB.

When step reaches Texture Generation: 6.8/12GB VRAM, 7.8GB Shared GPU RAM Memory 3GB
Log: Model Trellis2 prepared for dynamic VRAM loading. 5320MB Staged. 0 patches attached. Force pre-loaded 720 weights: 6259 KB.

When step reaches PostProcessing > Remesh Mesh => CRASH
Log:

Model TextureVae prepared for dynamic VRAM loading. 137MB Staged. 0 patches attached. Force pre-loaded 154 weights: 785704 KB.
[INFO] [GetMeshInfo]
Vertices: 15,430,624 (15.43M)
Faces: 31,428,998 (31.43M)
Attributes: none
Remesh DC: 24%|███████▉ | 7/29 [00:08<00:35, 1.62s/it][ERROR] !!! Exception during processing !!! Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 18.01 GiB
Requested : 567.05 MiB
Device limit : 11.99 GiB
Free (according to CUDA): 0 bytes
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB
[ERROR] Traceback (most recent call last):
File "F:\ComfyUI-Easy-Install\ComfyUI\execution.py", line 545, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\execution.py", line 344, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\execution.py", line 318, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "F:\ComfyUI-Easy-Install\ComfyUI\execution.py", line 306, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_api\internal\__init__.py", line 149, in wrapped_func
return method(locked_class, **inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_api\latest\_io.py", line 1990, in EXECUTE_NORMALIZED
to_return = cls.execute(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\nodes_mesh_postprocess.py", line 2429, in execute
result = _process_mesh_batch(mesh, _fn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\nodes_mesh_postprocess.py", line 2185, in _process_mesh_batch
v_i, f_i, c_i = process_single(v_i, f_i, c_i, bar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\nodes_mesh_postprocess.py", line 2163, in process_single
v, f, c = per_item_fn(v, f, c)
^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\nodes_mesh_postprocess.py", line 2411, in _fn
rv, rf, rc = remesh_narrow_band_dc(
^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\mesh3d\postprocess\remesh.py", line 1034, in remesh_narrow_band_dc
short_hash = _build_tri_spatial_hash(centroids, tri_radii, short_hash_cell_t)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\ComfyUI-Easy-Install\ComfyUI\comfy_extras\mesh3d\postprocess\remesh.py", line 168, in _build_tri_spatial_hash
cz = cell_lo[rep, 2] + lz
~~~~~~~~~~~~~~~~^~~~
torch.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 18.01 GiB
Requested : 567.05 MiB
Device limit : 11.99 GiB
Free (according to CUDA): 0 bytes
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB

[INFO] Memory summary:
|===========================================================================|
| PyTorch CUDA memory summary, device ID 0 |
|---------------------------------------------------------------------------|
| CUDA OOMs: 0 | cudaMalloc retries: 0 |
|===========================================================================|
| Metric | Cur Usage | Peak Usage | Tot Alloc | Tot Freed |
|---------------------------------------------------------------------------|
| Allocated memory | 17879 MiB | 18446 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Active memory | 17879 MiB | 18446 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Requested memory | 0 B | 0 B | 0 B | 0 B |
| from large pool | 0 B | 0 B | 0 B | 0 B |
| from small pool | 0 B | 0 B | 0 B | 0 B |
|---------------------------------------------------------------------------|
| GPU reserved memory | 18144 MiB | 19232 MiB | 0 B | 0 B |
| from large pool | 0 MiB | 0 MiB | 0 B | 0 B |
| from small pool | 0 MiB | 0 MiB | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Non-releasable memory | 0 B | 0 B | 0 B | 0 B |
| from large pool | 0 B | 0 B | 0 B | 0 B |
| from small pool | 0 B | 0 B | 0 B | 0 B |
|---------------------------------------------------------------------------|
| Allocations | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Active allocs | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| GPU reserved segments | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Non-releasable allocs | 0 | 0 | 0 | 0 |
| from large pool | 0 | 0 | 0 | 0 |
| from small pool | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Oversize allocations | 0 | 0 | 0 | 0 |
|---------------------------------------------------------------------------|
| Oversize GPU segments | 0 | 0 | 0 | 0 |
|===========================================================================|

[ERROR] Got an OOM, unloading all loaded models.
```

### Other

Other trials: running ComfyUI with options: --disable-dynamic-vram --disable-all-custom-nodes
Result: still CRASH

Contributor guide

Open the contributing guide

Research direction

Start by reproducing PixelArtistry_Pixal3D_native.json with custom nodes disabled, then read comfy_extras/nodes_mesh_postprocess.py around the Remesh Mesh execution and comfy_extras/mesh3d/postprocess/remesh.py around remesh_narrow_band_dc and _build_tri_spatial_hash. Use the reported 15.43M-vertex mesh and CUDA traceback to trace memory growth; done means PostProcessing > Remesh Mesh completes without an out-of-memory crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-graphics, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.