Comfy-Org / Comfy-Org/ComfyUI

SAM3.1 OOM

Open
#13,717 1 comment 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Custom Node Testing

- [x] 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

Fix this problem.

### Actual Behavior

Load the video, then run the tracking, repeat this several times, and you will notice that the memory usage has significantly increased.

Image

Image

Image

### Steps to Reproduce

[SAM3.1.json](https://github.com/user-attachments/files/27409413/SAM3.1.json)
After running the program multiple times, it can be observed that the memory usage shown in the Windows Task Manager has significantly increased.

### Debug Logs

```powershell
got prompt
model weight dtype torch.float16, manual cast: None
model_type FLOW
WARNING: No VAE weights detected, VAE not initalized.
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
Requested to load SAM3ClipModelWrapper

No erroneous output
```

### Other

After multiple runs, the memory will reach an upper limit. Running any further will not increase the memory. However, this portion of memory cannot be released. The subsequent LTX workflow I connected will experience an Out Of Memory (OOM) error. All cleaning nodes, including the ones provided by ComfyUI, are unable to restore the memory to its normal state. This has a significant impact on my looping workflow.

Contributor guide

Open the contributing guide

Research direction

Start with the attached SAM3.1.json workflow and reproduce repeated video tracking runs while monitoring memory in Windows Task Manager. Done means repeated runs no longer retain unreleased memory and the subsequent LTX workflow does not encounter an out-of-memory error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.