torch.cuda.is_available() check for SdOptimizationXformers

This commit is contained in:
Vivek K. Vasishtha 2023-06-03 21:54:27 +05:30 committed by GitHub
parent b6af0a3809
commit b1a72bc7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ class SdOptimizationXformers(SdOptimization):
priority = 100
def is_available(self):
return shared.cmd_opts.force_enable_xformers or (shared.xformers_available and torch.version.cuda and (6, 0) <= torch.cuda.get_device_capability(shared.device) <= (9, 0))
return shared.cmd_opts.force_enable_xformers or (shared.xformers_available and torch.cuda.is_available() and (6, 0) <= torch.cuda.get_device_capability(shared.device) <= (9, 0)
def apply(self):
ldm.modules.attention.CrossAttention.forward = xformers_attention_forward