NeuromorphicProcessorProject / snn_toolbox

Toolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
MIT License
362 stars 105 forks source link

UnboundLocalError with Neuron or Nest #36

Closed aclyde11 closed 5 years ago

aclyde11 commented 5 years ago

I am getting the following error if I use nest or neuron. The simulation runs with the INI simulator. I checked another git issue and I am using pyNN==0.9.2 and keras=2.15

it looks like a PyNN error but I am not sure if you have seen this before.

Evaluating parsed model on 10 samples...
/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/theano/tensor/subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  rval = inputs[0].__getitem__(inputs[1:])
Top-1 accuracy: 100.00%
Top-5 accuracy: 100.00%

Building spiking model...
Building layer: 00Conv2D_6x24x24
......
/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py:221: RuntimeWarning: Biases are implemented but might have no effect. Please check!
  "Please check!", RuntimeWarning)
Traceback (most recent call last):
  File "/homes/aclyde11/.conda/envs/pynn/bin/snntoolbox", line 10, in <module>
    sys.exit(main())
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/run.py", line 50, in main
    test_full(config)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/utils.py", line 111, in test_full
    spiking_model.build(parsed_model)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/utils.py", line 431, in build
    self.build_convolution(layer)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 119, in build_convolution
    self.sim.FromListConnector(self._conns, ['weight', 'delay'])))
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/connectors.py", line 497, in __init__
    if n_columns != len(self.column_names) + 2:
UnboundLocalError: local variable 'n_columns' referenced before assignment
aclyde11 commented 5 years ago

(If you run with the latest pyNN the error is:

Building spiking model...
Building layer: 00Conv2D_6x24x24
......
/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py:221: RuntimeWarning: Biases are implemented but might have no effect. Please check!
  "Please check!", RuntimeWarning)
Traceback (most recent call last):
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/parameters.py", line 59, in __init__
    value(0.0)
  File "<string>", line 1, in <lambda>
NameError: name 'auto' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/parameters.py", line 311, in update
    dtype=expected_dtype)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/parameters.py", line 61, in __init__
    raise errors.InvalidParameterValueError(errmsg + str(err))
pyNN.errors.InvalidParameterValueError: Value should be a string expressing a function of d. name 'auto' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/homes/aclyde11/.conda/envs/pynn/bin/snntoolbox", line 10, in <module>
    sys.exit(main())
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/run.py", line 50, in main
    test_full(config)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/bin/utils.py", line 111, in test_full
    spiking_model.build(parsed_model)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/utils.py", line 431, in build
    self.build_convolution(layer)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 119, in build_convolution
    self.sim.FromListConnector(self._conns, ['weight', 'delay'])))
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/neuron/projections.py", line 41, in __init__
    space, label)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/common/projections.py", line 106, in __init__
    self.synapse_type = synapse_type or self._static_synapse_class()
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/models.py", line 108, in __init__
    shape=None)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/parameters.py", line 250, in __init__
    self.update(**parameters)
  File "/homes/aclyde11/.conda/envs/pynn/lib/python3.6/site-packages/pyNN/parameters.py", line 313, in update
    raise errors.InvalidParameterValueError("For parameter %s expected %s, got %s" % (name, expected_dtype, type(value)))
pyNN.errors.InvalidParameterValueError: For parameter delay expected <class 'float'>, got <class 'str'>
rbodo commented 5 years ago

Yes, looks like a compatibility issue with this version of pyNN/Neuron... Unfortunately, I have no way of debugging this right now. If possible, I'd recommend using nest as pyNN backend. I've been able to run a network with nest version 2.14 recently.

aclyde11 commented 5 years ago

Yes nest 2.14 is working for me now. Thank you! (You may want to put a notice on the readme about using nest 2.14 and the neruon errors...)