GithubHelp home page GithubHelp logo

Comments (4)

Hananel-Hazan avatar Hananel-Hazan commented on May 14, 2024

Hi @elliothe Thank you for using BindsNET.

Unfortunately I'm not getting the error you got:

$ python3 eth_mnist.py --gpu

Loading training images from serialized object file.

Loading training labels from serialized object file.

Begin training.

Progress: 0 / 60000 (0.0000 seconds)
Progress: 10 / 60000 (10.3445 seconds)

Can you make sure that you running the latest version of PyTorch and BindsNET?
Also, please make sure that PyTorch using GPU properly using this link

from bindsnet.

elliothe avatar elliothe commented on May 14, 2024

Hi @Hananel-Hazan,
I did use the pip install bindsnet to install the bindsnet under the conda environment.

There should be no problem for pytorch to use GPU.

Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.0.0'
>>> torch.cuda.current_device()
0
>>>

from bindsnet.

elliothe avatar elliothe commented on May 14, 2024

I reinstall the bindsnet with the cloned repository, and it works. However, if I wanna enable the figure plot, the same error comes back.

python eth_mnist.py --plot --gpu
Loading training images from serialized object file.

Loading training labels from serialized object file.


Begin training.

Progress: 0 / 60000 (0.0000 seconds)
Traceback (most recent call last):
  File "eth_mnist.py", line 150, in <module>
    inpt_axes, inpt_ims = plot_input(images[i].view(28, 28), inpt, label=labels[i])
  File "/home/elliot/Documents/DRC_2019/bindsnet-master/bindsnet/analysis/plotting.py", line 32, in plot_input
    ims = axes[0].imshow(image, cmap='binary'), axes[1].imshow(inpt, cmap='binary')
  File "/home/elliot/anaconda3/envs/pytorch_1.0/lib/python3.6/site-packages/matplotlib/__init__.py", line 1805, in inner
    return func(ax, *args, **kwargs)
  File "/home/elliot/anaconda3/envs/pytorch_1.0/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 5483, in imshow
    im.set_data(X)
  File "/home/elliot/anaconda3/envs/pytorch_1.0/lib/python3.6/site-packages/matplotlib/image.py", line 638, in set_data
    self._A = cbook.safe_masked_invalid(A, copy=True)
  File "/home/elliot/anaconda3/envs/pytorch_1.0/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 784, in safe_masked_invalid
    x = np.array(x, subok=True, copy=copy)
  File "/home/elliot/anaconda3/envs/pytorch_1.0/lib/python3.6/site-packages/torch/tensor.py", line 450, in __array__
    return self.numpy()
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copythe tensor to host memory first.

Morever, I found the code running on GPU is even slower than CPU version.

from bindsnet.

Hananel-Hazan avatar Hananel-Hazan commented on May 14, 2024

I pushed a fix to the plotting issue. Thank you for pointing it out

About the performance, the size of the network in this example is not enough to favorite GPU. CPU, in this case, will be faster (depending of course on the CPU model).
In much larger network, the GPU will be much faster. For example see the benchmark in link

from bindsnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.