aux prevent race condition

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-08-05 14:38:37 +02:00
parent c26149b80e
commit 7fdaefda0b
3 changed files with 5 additions and 3 deletions
+4
View File
@@ -22,6 +22,8 @@ aux_models: dict[str, AuxModel] = {}
def register_aux(name: str, model: torch.nn.Module) -> None:
if model is None:
return
size = sum(p.numel() * p.element_size() for p in model.parameters()) / 1024**3
aux_models[name] = AuxModel(model=model, name=name, size=size)
debug_move(f'Offload: type=aux op=register name={name} size={size:.3f}')
@@ -42,6 +44,8 @@ def evict_aux(exclude: str | None = None, reason: str = 'evict') -> None:
def _do_move_to_cpu(model, op_label, size):
if model is None:
return
if shared.opts.diffusers_offload_streams:
global move_stream # pylint: disable=global-statement
if move_stream is None: