Problem
The README states the notebook "defaults to cuda:1; it falls back to CPU" and says to edit "the relevant line in the second cell" for a single GPU. In reality cuda:1 is hardcoded in two places (the GCN.forward device move and the Trainer.__init__ device), and the selection is "cuda:1" if torch.cuda.is_available() and use_cuda .... On a machine with a single GPU (cuda:0 only), torch.cuda.is_available() is True, so the code selects the non-existent cuda:1 and raises a CUDA device error instead of falling back. The fix is also not in "the second cell" — it is in two later cells.
Evidence (My First Malware.ipynb)
- Cell 11 (
GCN.forward): g.ndata['h'] = feature.to(torch.device("cuda:1" if torch.cuda.is_available() and use_cuda is True else "cpu"))
- Cell 17 (
Trainer.__init__): self.device = torch.device("cuda:1" if torch.cuda.is_available() and use_cuda is True else "cpu")
README.md:121-129 claims a CPU fallback and points to "the second cell".
Impact
Anyone with a single-GPU box (the common case) cannot run the notebook as shipped — it errors out rather than degrading to cuda:0 or CPU, despite the README implying it works.
Recommendation
Define the device once near use_cuda (cell 1) as device = torch.device('cuda' if use_cuda and torch.cuda.is_available() else 'cpu') and reference that variable everywhere, or make the GPU index configurable. Align the README's "second cell" wording with the actual location.
Severity: low · Category: bug · Filed by an automated multi-repo code review.
Problem
The README states the notebook "defaults to
cuda:1; it falls back to CPU" and says to edit "the relevant line in the second cell" for a single GPU. In realitycuda:1is hardcoded in two places (theGCN.forwarddevice move and theTrainer.__init__device), and the selection is"cuda:1" if torch.cuda.is_available() and use_cuda .... On a machine with a single GPU (cuda:0only),torch.cuda.is_available()isTrue, so the code selects the non-existentcuda:1and raises a CUDA device error instead of falling back. The fix is also not in "the second cell" — it is in two later cells.Evidence (
My First Malware.ipynb)GCN.forward):g.ndata['h'] = feature.to(torch.device("cuda:1" if torch.cuda.is_available() and use_cuda is True else "cpu"))Trainer.__init__):self.device = torch.device("cuda:1" if torch.cuda.is_available() and use_cuda is True else "cpu")README.md:121-129claims a CPU fallback and points to "the second cell".Impact
Anyone with a single-GPU box (the common case) cannot run the notebook as shipped — it errors out rather than degrading to
cuda:0or CPU, despite the README implying it works.Recommendation
Define the device once near
use_cuda(cell 1) asdevice = torch.device('cuda' if use_cuda and torch.cuda.is_available() else 'cpu')and reference that variable everywhere, or make the GPU index configurable. Align the README's "second cell" wording with the actual location.Severity: low · Category: bug · Filed by an automated multi-repo code review.