Only enable cuda malloc on cuda torch. (#9031)

This commit is contained in:
comfyanonymous 2025-07-23 16:37:43 -07:00 committed by GitHub
parent d3504e1778
commit e78d230496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,7 +74,8 @@ if not args.cuda_malloc:
module = importlib.util.module_from_spec(spec) module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module) spec.loader.exec_module(module)
version = module.__version__ version = module.__version__
if int(version[0]) >= 2: #enable by default for torch version 2.0 and up
if int(version[0]) >= 2 and "+cu" in version: #enable by default for torch version 2.0 and up only on cuda torch
args.cuda_malloc = cuda_malloc_supported() args.cuda_malloc = cuda_malloc_supported()
except: except:
pass pass