How can I stop outputing "spikerates"

13 views
Skip to first unread message

Xingyu DENG

unread,
Mar 7, 2022, 1:23:28 AM3/7/22
to SpiNNaker Users Group

Hi, I am Prof. Steve Furber’s student, and I am doing my project.

I would like to ask a question about how can I stop outputting “spikerate” when running simulation on spiNNaker on snn toolbox.

 

Here is my configuration of snn toolbox simulation (except red highlighted).

configparser = import_configparser()

config = configparser.ConfigParser()

 

config['paths'] = {

    'path_wd': path_wd,             # Path to model.

    'dataset_path': path_wd,        # Path to dataset.

    'filename_ann': model_name      # Name of input model.

}

 

config['tools'] = {

    'evaluate_ann': True,           # Test ANN on dataset before conversion.

    'normalize': True,              # Normalize weights for full dynamic range.

}

 

config['simulation'] = {

'simulator': 'spiNNaker',

    'duration' : '200',

    'dt' : '1',

    'batch_size' : '1',

    'num_to_test' : '10000',

}

 

config['input'] = {

    'poisson_input': True          # Images are encodes as spike trains.

}

 

config['output'] = {

    'plot_vars': {                  # Various plots (slows down simulation).

        'spikerates',

        'error_t'}

}

 

When I run the simulation, there is error called “ConfigurationException: This population has not been set to record spikes” (I attached full error output of it at the end)

I changed parameter 'simulator' of simulation configuration from ‘spiNNaker’ to ‘INI’, then it works.

I added parameter 'spikerates' of output configuration above, then it works.

Hence, I believe that the error only happens when I use spiNNaker as simulator without outputting ‘spikerates’.

 

How can I solve it?

The spiNNaker on toolbox only support sequential test, which means it outputs a result for each test sample. 

It unpractical if I have to output figures of “spikerates” for each test sample.

 

Thank you very much in advance!

 

Xingyu :D


---------------------------------------------------------------------------

ConfigurationException                    Traceback (most recent call last)

<ipython-input-2-14d6fb19a662> in <module>

      2 ###################

      3

----> 4 main(config_filepath)

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/bin/run.py in main(filepath)

     29     if filepath is not None:

     30         config = update_setup(filepath)

---> 31         run_pipeline(config)

     32         return

     33

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/bin/utils.py in run_pipeline(config, queue)

    143

    144         # Simulate network

--> 145         results = run(spiking_model, **testset)

    146

    147         # Clean up

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/bin/utils.py in wrapper(snn, **testset)

    218                           "{} = {:.2f}\n".format(param_name, p))

    219

--> 220                 results.append(run_single(snn, **testset))

    221

    222             # Plot and return results of parameter sweep.

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/bin/utils.py in run(snn, **test_set)

    140         @run_parameter_sweep(config, queue)

    141         def run(snn, **test_set):

--> 142             return snn.run(**test_set)

    143

    144         # Simulate network

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/utils.py in run(self, x_test, y_test, dataflow, **kwargs)

    604             # of the simulation.

    605             print("\nStarting new simulation...\n")

--> 606             output_b_l_t = self.simulate(**data_batch_kwargs)

    607

    608             # Halt if model is to be serialised only.

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/target_simulators/spiNNaker_target_sim.py in simulate(self, **kwargs)

    381         self.sim.run(self._duration)

    382         print("\nCollecting results...")

--> 383         output_b_l_t = self.get_recorded_vars(self.layers)

    384

    385         return output_b_l_t

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/utils.py in get_recorded_vars(self, layers)

    960         """

    961

--> 962         self.set_spiketrain_stats_input()

    963

    964         self.reset_container_counters()

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py in set_spiketrain_stats_input(self)

    514

    515     def set_spiketrain_stats_input(self):

--> 516         AbstractSNN.set_spiketrain_stats_input(self)

    517

    518

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/utils.py in set_spiketrain_stats_input(self)

   1022

   1023         if self._poisson_input or self._is_aedat_input:

-> 1024             spiketrains_b_l_t = self.get_spiketrains_input()

   1025             if self.input_b_l_t is not None:

   1026                 self.input_b_l_t = spiketrains_b_l_t

 

~/sPyNNaker/lib/python3.8/site-packages/snntoolbox/simulation/target_simulators/spiNNaker_target_sim.py in get_spiketrains_input(self)

    387     def get_spiketrains_input(self):

    388         shape = list(self.parsed_model.input_shape) + [self._num_timesteps]

--> 389         spiketrains_flat = self.layers[0].get_data(

    390             'spikes').segments[-1].spiketrains

    391         spiketrains_b_l_t = self.reshape_flattened_spiketrains(

 

~/sPyNNaker/lib/python3.8/site-packages/spynnaker/pyNN/models/populations/population.py in get_data(self, variables, gather, clear, annotations)

    376                         "not be supported by all platforms.")

    377

--> 378         return self._recorder.extract_neo_block(

    379             variables, None, clear, annotations)

    380

 

~/sPyNNaker/lib/python3.8/site-packages/spynnaker/pyNN/models/recorder.py in extract_neo_block(self, variables, view_indexes, clear, annotations)

    323

    324         # add to the segments the new block

--> 325         self.__append_current_segment(block, variables, view_indexes, clear)

    326

    327         # add fluff to the neo block

 

~/sPyNNaker/lib/python3.8/site-packages/spynnaker/pyNN/models/recorder.py in __append_current_segment(self, block, variables, view_indexes, clear)

    434                 self.__read_in_spikes(

    435                     segment=segment,

--> 436                     spikes=self.get_spikes(),

    437                     t=get_simulator().get_current_time(),

    438                     n_neurons=self.__population.size,

 

~/sPyNNaker/lib/python3.8/site-packages/spynnaker/pyNN/models/recorder.py in get_spikes(self)

    267                 "This population has not got the capability to record spikes")

    268         if not self.__vertex.is_recording_spikes():

--> 269             raise ConfigurationException(

    270                 "This population has not been set to record spikes")

    271

 

ConfigurationException: This population has not been set to record spikes

Reply all
Reply to author
Forward
0 new messages