Skip to content

Commit e77824b

Browse files
Update CODE/vulnscan.py
The condition logic is incorrect. If torch.cuda.is_available() returns False, then torch.backends.cudnn.is_available() will also return False, making this condition always False. Consider simplifying to just check if CUDA is not available but the system has CUDA capabilities. Co-authored-by: Copilot <[email protected]> Signed-off-by: Shahm Najeeb <[email protected]>
1 parent 1f8e0ec commit e77824b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CODE/vulnscan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _load_model(self) -> None:
6060
map_location=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
6161
weights_only=False
6262
)
63-
if not torch.cuda.is_available() and torch.version.cuda and torch.backends.cudnn.is_available():
63+
if not torch.cuda.is_available() and torch.version.cuda:
6464
log.warning(
6565
"NVIDIA GPU detected but CUDA is not available. Check your PyTorch and CUDA installation to utilise as much power as possible.")
6666
log.debug(f"Model using device: {torch.device('cuda' if torch.cuda.is_available() else 'cpu')}")

0 commit comments

Comments
 (0)