From 7fdaefda0b8612663efb3c5b360f25e32ee0d50d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 5 Aug 2026 14:38:37 +0200 Subject: [PATCH] aux prevent race condition Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 2 +- modules/sd_offload_aux.py | 4 ++++ pipelines/anima/anima_image.py | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14c0d6cc3..ad2ab9896 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Change Log for SD.Next +\# Change Log for SD.Next ## Update for 2026-08-05 diff --git a/modules/sd_offload_aux.py b/modules/sd_offload_aux.py index 26c8c9fa7..e8cf54d50 100644 --- a/modules/sd_offload_aux.py +++ b/modules/sd_offload_aux.py @@ -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: diff --git a/pipelines/anima/anima_image.py b/pipelines/anima/anima_image.py index 233a35a96..c24fe8706 100644 --- a/pipelines/anima/anima_image.py +++ b/pipelines/anima/anima_image.py @@ -1,14 +1,12 @@ """Anima img2img and inpainting pipelines (built dynamically from the runtime-imported base class).""" from typing import Callable, Dict, List, Optional, Union - import torch import torch.nn.functional as F from PIL import Image from diffusers.callbacks import MultiPipelineCallbacks, PipelineCallback from diffusers.image_processor import PipelineImageInput from diffusers.utils.torch_utils import randn_tensor - from modules import devices