API OOM!!! but the workflow in the ComfyUI is working.
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Discussed in https://github.com/comfyanonymous/ComfyUI/discussions/5924
Originally posted by **monster-echo** December 5, 2024
I have a workflow running in the ComfyUI.
But When I export it as API json, and invoke it in a python console, it will OOM at the second invoke.
It seems like the comfyUI reuse the VRAM when running a same workflow or other mechanism, the VRAM is not cleaned waiting the next invoked.
But with the API, the reserved VRAM is always not reused.
Here is the python console code
``` python
import json
import requests
from ollama import random_prompt
import time
with open("workflows/1.json", "r", encoding="utf-8") as f:
data = json.loads(f.read())
headers = {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'Comfy-User': ''
}
session = requests.Session()
for i in range(5000):
print(f"iteration {i}")
data["prompt"]["3"]["inputs"]["text"] = random_prompt("crazy weird art, All kinds of scenarios, like a dream or a nightmare.")
resp = session.post("http://localhost:8188/api/prompt", json=data, headers=headers)
print(resp.json())
time.sleep(70)
print("done")
```
Contributor guide
Assessment
This issue has not been assessed yet.