From 6954e3e247857fae33fdee17c8ee831002370aa1 Mon Sep 17 00:00:00 2001 From: doctorpangloss <2229300+doctorpangloss@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:37:20 -0700 Subject: [PATCH] Fix torch.compiler.is_compiling missing on torch 2.3 and earlier --- comfy/ops.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/ops.py b/comfy/ops.py index 0bfad193f..c705460e1 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -29,10 +29,13 @@ from .float import stochastic_rounding logger = logging.getLogger(__name__) +_RUN_EVERY_OP_ENABLED = model_management.torch_version_numeric >= (2, 5) + def run_every_op(): - # this is available on torch 2.3 - if torch.compiler.is_compiling(): # pylint: disable=no-member + global _RUN_EVERY_OP_ENABLED + # this is not available on torch 2.3 by testing + if not _RUN_EVERY_OP_ENABLED or torch.compiler.is_compiling(): # pylint: disable=no-member return throw_exception_if_processing_interrupted()