My model and data on CUDA but get RuntimeError about finding at least two devices, cuda:0 and cpu

Viewed 39

I am trying to run inference on my model weight modified tensors from the result of training with STDP, however, I encounter this error message even after placing my model on CUDA and if I run on 'cpu', I get NotImplementedError.

bindsnet.pipeline.environment_pipeline, bindsnet.pipeline.dataloader_pipeline, bindsnet.pipeline.action, bindsnet.pipeline, bindsnet.evaluation.evaluation, bindsnet.evaluation, bindsnet.conversion.nodes, bindsnet.conversion.topology, bindsnet.conversion.conversion, bindsnet.conversion, bindsnet, self_models.modified_bindsnet, self_models

 Run on time: 2022-09-19 10:13:57.515296

 Arguments: 
     gpu                  : True
     seed                 : 0
     dataset              : MNIST
     batch_size           : 1
     n_epochs             : 2
     n_test               : None
     update_interval      : 500
     n_neurons            : 900
     exc                  : 22.5
     inh                  : 22.5
     theta_plus           : 0.05
     pattern_time         : 250
     network              : DiehlAndCook2015
     dt                   : 1.0
     n_workers            : -1
     pretrained_snn       : 
     test_acc_every_batch : False
     train_acc_batches    : 200
     devices              : 0
     test_only            : False
     pretrained_ann       : 
     lr_interval          : 0.00 0.00 0.00
     log                  : False
     n_inpt               : 784
     norm                 : 78.4
     tc_theta_decay       : 10000000.0
     inpt_shape           : None
     nu                   : (0, 0.01)
     wmax                 : 1.0
     wmin                 : 0.0
Traceback (most recent call last):

  File Z:\workspace\stdp-nmnist-main\snn_2.py:424 in <module>
    model = DiehlAndCook2015(n_inpt = 784, n_neurons = 900, exc = 22.5, inh = 22.5, dt = 1.0, norm = 78.4,

  File Z:\workspace\stdp-nmnist-main\bindsnet\models\models.py:198 in __init__
    self.add_layer(exc_layer, name="Ae")

  File Z:\workspace\stdp-nmnist-main\bindsnet\network\network.py:130 in add_layer
    layer.set_batch_size(self.batch_size)

  File Z:\workspace\stdp-nmnist-main\bindsnet\network\nodes.py:1144 in set_batch_size
    self.v = self.rest * torch.ones(batch_size, *self.shape, device=self.v.device)

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu

Screenshot of script

0 Answers
Related