fangwei123456 / spikingjelly

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.
https://spikingjelly.readthedocs.io
Other
1.22k stars 233 forks source link

Compatibility with the latest NumPy version 1.24 which removes "numpy.int" entry #401

Open CloudyDory opened 1 year ago

CloudyDory commented 1 year ago

Read before creating a new issue

For faster response

You can @ the corresponding developers for your issue. Here is the division:

Features Developers
Neurons and Surrogate Functions fangwei123456
Yanqi-Chen
CUDA Acceleration fangwei123456
Yanqi-Chen
Reinforcement Learning lucifer2859
ANN to SNN Conversion DingJianhao
Lyu6PosHao
Biological Learning (e.g., STDP) AllenYolk
Others Grasshlw
lucifer2859
AllenYolk
Lyu6PosHao
DingJianhao
Yanqi-Chen
fangwei123456

We are glad to add new developers who are volunteering to help solve issues to the above table.

Issue type

SpikingJelly version

0.0.0.0.14

Description numpy.int was deprecated in NumPy 1.20 and was removed in NumPy 1.24. However, the latest spikingjelly stable version 0.0.0.0.14 still uses it in some of the code, and will cause error.

For example, in spikingjelly\activation_based\auto_cuda\base.py line 233-250,

for key, value in py_dict.items():
    ctype: str = self.cparams[key]
    if isinstance(value, torch.Tensor):
        if value.dtype == torch.float:
            assert startswiths(ctype, ('const float', 'float'))

        elif value.dtype == torch.half:
            assert startswiths(ctype, ('const half2', 'half2'))

    if isinstance(value, cupy.ndarray):
        if value.dtype == np.float32:
            assert startswiths(ctype, ('const float', 'float'))

        elif value.dtype == np.float16:
            assert startswiths(ctype, ('const half2', 'half2'))

        elif value.dtype == np.int:
            assert startswiths(ctype, ('const int', 'int'))

Hope this can be fixed soon.

fangwei123456 commented 12 months ago

Hi, this problem has been fixed in the lastest master version. The released 0.0.0.0.14 version can not be modified. You can install SpikingJelly from the latest GitHub code to avoid this bug.

biphasic commented 11 months ago

I ran into the same error, if you could push a new release with the error fixed that would be great! Thank you

fangwei123456 commented 11 months ago

@biphasic You can try to install from github source code (not from pip), and check if it is ok.

biphasic commented 11 months ago

yes I did that and it worked well! I benchmarked SpikingJelly against other frameworks, congrats to being the fastest :D https://open-neuromorphic.org/p/snn-library-benchmarks/