Skip to content

Commit de17a97

Browse files
Unload all models if there's an OOM error.
1 parent c14ac98 commit de17a97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

execution.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data, execute
188188
"current_inputs": input_data_formatted,
189189
"current_outputs": output_data_formatted
190190
}
191+
192+
if isinstance(ex, comfy.model_management.OOM_EXCEPTION):
193+
logging.error("Got an OOM, unloading all loaded models.")
194+
comfy.model_management.unload_all_models()
195+
191196
return (False, error_details, ex)
192197

193198
executed.add(unique_id)

0 commit comments

Comments
 (0)