muhanzhang / pytorch_DGCNN

PyTorch implementation of DGCNN
MIT License
372 stars 122 forks source link

Torch not compiled with CUDA enabled in CPU mode #10

Open matgreco opened 5 years ago

matgreco commented 5 years ago

When i run the command ./run_DGCNN.sh in CPU mode i get the following error.

I set the var gpu_or_cpu=cpu, and i don't have cuda on this pc.

How can i fix this error?

====== begin of s2v configuration ====== | msg_average = 0 ====== end of s2v configuration ====== Namespace(batch_size=50, data='DD', dropout=True, extract_features=False, feat_dim=0, fold=10, gm='DGCNN', hidden=128, latent_dim=[32, 32, 32, 1], learning_rate=1e-05, max_lv=4, mode='cpu', num_class=0, num_epochs=200, out_dim=0, printAUC=False, seed=1, sortpooling_k=0.6, test_number=0) loading data

classes: 2

maximum node tag: 82

train: 1061, # test: 117

k used in SortPooling is: 291 Initializing DGCNN 0%| | 0/21 [00:00<?, ?batch/s]Traceback (most recent call last): File "main.py", line 187, in avg_loss = loop_dataset(train_graphs, classifier, train_idxes, optimizer=optimizer) File "main.py", line 131, in loop_dataset logits, loss, acc = classifier(batch_graph) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, *kwargs) File "main.py", line 107, in forward embed = self.s2v(batch_graph, node_feat, None) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, **kwargs) File "/home/mat/Escritorio/DGCNN/pytorch_DGCNN/DGCNN_embedding.py", line 58, in forward if isinstance(node_feat, torch.cuda.FloatTensor): File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/init.py", line 161, in _lazy_init _check_driver() File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/init.py", line 75, in _check_driver raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

muhanzhang commented 5 years ago

Hi, very sorry for the late reply as I was busying with a paper. I have reproduced your bug and updated the code. It should work in cpu mode now.

matgreco commented 5 years ago

Thank's for your answer.

After to make a pull, I have tried to run the code and i get the followin error:

Traceback (most recent call last): File "main.py", line 187, in <module> avg_loss = loop_dataset(train_graphs, classifier, train_idxes, optimizer=optimizer) File "main.py", line 131, in loop_dataset logits, loss, acc = classifier(batch_graph) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "main.py", line 107, in forward embed = self.s2v(batch_graph, node_feat, None) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/home/mat/Escritorio/DGCNN/pytorch_DGCNN/DGCNN_embedding.py", line 58, in forward if isinstance(node_feat, torch.cuda.FloatTensor): File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init _check_driver() File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 75, in _check_driver raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

I used a venv whit torch==1.0.0 and set have setted the gpu_or_cpu var as cpu.

muhanzhang commented 5 years ago

Hi, I checked your bug information, the line 58 seems to be still the old version. In the new version, it has changed to "if torch.cuda.is_available() and isinstance(node_feat, torch.cuda.FloatTensor):". Can you check if your DGCNN_embedding.py is the new version?