From a1e99ddd1ea6597c181e2136109177a235355ffd Mon Sep 17 00:00:00 2001 From: Matrix Yao Date: Wed, 14 May 2025 06:40:21 +0000 Subject: [PATCH] enhance value guard Signed-off-by: Matrix Yao --- src/diffusers/utils/testing_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffusers/utils/testing_utils.py b/src/diffusers/utils/testing_utils.py index 00aad9d71a61..ec220ff973be 100644 --- a/src/diffusers/utils/testing_utils.py +++ b/src/diffusers/utils/testing_utils.py @@ -1212,8 +1212,8 @@ def _device_agnostic_dispatch(device: str, dispatch_table: Dict[str, Callable], # Some device agnostic functions return values. Need to guard against 'None' instead at # user level - if fn is None: - return None + if not callable(fn): + return fn return fn(*args, **kwargs)