You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running multiple workflows just after each other #94
If I try to run a second comfyscript workflow before the first one is done, I receive the following error. Otherwise, workflow works perfectly fine.
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm)
Are you using real mode? What do you exactly mean by "run a second comfyscript workflow before the first one is done"? Multiple threads? Or one with Workflow() inside another with Workflow()?
Are you using real mode? What do you exactly mean by "run a second comfyscript workflow before the first one is done"? Multiple threads? Or one with Workflow() inside another with Workflow()?
I am indeed using real mode and I mean multiple threads. I am calling a function with 'Workflow()' twice. Whenever i call the same function 2nd time, before the first call ends, I receive this error.
I can't reproduce this, both with sleep and without. Maybe it's related to specific nodes. Which node do you received this error? What are its parent nodes (inputs)?
I can't reproduce this, both with sleep and without. Maybe it's related to specific nodes. Which node do you received this error? What are its parent nodes (inputs)?
I will share a simple demonstrative script, tomorrow
So looks like at least models can't be shared freely. Maybe your error is also caused by some shared states, like top-level global varaibles or some global varaibles used inside some nodes.
Adding some locks may fix this type of errors. For example, to use the same model:
Ok, here is a demonstration. When I run test2.py (importing the workflow from test1.py) with threading as you suggested, I receive that error. test1.py, test2.py and test_log.txt are attached.
Can you tell me which node has the error and upload the full error log (full stack trace) here? I just realized that I don't have a NVIDIA GPU at the moment so my tensors will never be on two different devices to get the same error.
The problematic node is FooocusKSampler node. How can I upload the full error log (full stack trace), can you help me please? Do I need to run a logger?
Activity
Chaoses-Ib commentedon Feb 6, 2025
Are you using real mode? What do you exactly mean by "run a second comfyscript workflow before the first one is done"? Multiple threads? Or one
with Workflow()inside anotherwith Workflow()?cihangoksu commentedon Feb 6, 2025
I am indeed using real mode and I mean multiple threads. I am calling a function with 'Workflow()' twice. Whenever i call the same function 2nd time, before the first call ends, I receive this error.
Chaoses-Ib commentedon Feb 6, 2025
I can't reproduce this, both with sleep and without. Maybe it's related to specific nodes. Which node do you received this error? What are its parent nodes (inputs)?
cihangoksu commentedon Feb 6, 2025
I will share a simple demonstrative script, tomorrow
Chaoses-Ib commentedon Feb 6, 2025
Not exactly the same, but I've got the following error when I shared the model between the two threads:
So looks like at least models can't be shared freely. Maybe your error is also caused by some shared states, like top-level global varaibles or some global varaibles used inside some nodes.
Adding some locks may fix this type of errors. For example, to use the same model:
Though locking sampling is not ideal. Cloning the model patcher may be better, if workable.
cihangoksu commentedon Feb 7, 2025
Ok, here is a demonstration. When I run test2.py (importing the workflow from test1.py) with threading as you suggested, I receive that error. test1.py, test2.py and test_log.txt are attached.
test1.txt
test2.txt
test_log.txt
Chaoses-Ib commentedon Feb 7, 2025
Can you tell me which node has the error and upload the full error log (full stack trace) here? I just realized that I don't have a NVIDIA GPU at the moment so my tensors will never be on two different devices to get the same error.
cihangoksu commentedon Feb 7, 2025
The problematic node is FooocusKSampler node. How can I upload the full error log (full stack trace), can you help me please? Do I need to run a logger?