prefetch: guard against no offload (#13703)

cast_ will return no stream if there is no work to do. guard against
this is the consume logic.
This commit is contained in:
rattus 2026-05-05 05:56:05 +10:00 committed by GitHub
parent c33d26c283
commit c47633f3be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,7 +37,8 @@ def prefetch_queue_pop(queue, device, module):
consumed = queue.pop(0)
if consumed is not None:
offload_stream, prefetch_state = consumed
offload_stream.wait_stream(comfy.model_management.current_stream(device))
if offload_stream is not None:
offload_stream.wait_stream(comfy.model_management.current_stream(device))
_, comfy_modules = prefetch_state
if comfy_modules is not None:
cleanup_prefetched_modules(comfy_modules)