Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: can't multiply sequence by non-int of type 'float' #125

Open
sauravtii opened this issue Aug 12, 2022 · 4 comments
Open

TypeError: can't multiply sequence by non-int of type 'float' #125

sauravtii opened this issue Aug 12, 2022 · 4 comments
Assignees

Comments

@sauravtii
Copy link

sauravtii commented Aug 12, 2022

I am trying out this tutorial (https://www.youtube.com/watch?v=FxTMH9VRsgk) in which he converts the LeNet-5 architecture to SNN and then simulates it using 'INI; simulator. I am following the exact same tutorial, the only difference is, I am using spinnaker instead of INI, and it is giving me the following error. I have also provided my config file below.

Link to the github repo mentioned in the tutorial:
https://github.com/iCAS-Lab/neuro_comp_class

Can anyone please help me on this ?

The whole output after calling out the main function:

SNN toolbox WARNING: Delay (0.0) must be at least one time step (1.0). Setting delay = dt.

SNN toolbox WARNING: For optimal correspondence between the original ANN and the converted SNN simulated on pyNN, the threshold should be 0.01. Current value: 1.0.
Temporarily setting batch_size to 1 because simulator does not support parallel testing of multiple samples.
Initializing spiNNaker simulator...

Detected PyNN version 0.9.5 and Neo version 0.6.1
['/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spinn_front_end_common/interface/spinnaker.cfg', '/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/spynnaker.cfg', '/home/saurav/.spynnaker.cfg']
2022-08-12 11:07:26 INFO: Read cfg files: /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spinn_front_end_common/interface/spinnaker.cfg, /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/spynnaker.cfg, /home/saurav/.spynnaker.cfg
2022-08-12 11:07:26 INFO: Will search these locations for binaries: /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spinn_front_end_common/common_model_binaries : /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/model_binaries
Traceback (most recent call last):
  File "/home/saurav/Desktop/icas_spinnaker_snntoolbox/neuro_comp_class/tutorials/snntb/snntb.py", line 80, in <module>
    main(config_filepath)
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/snntoolbox/bin/run.py", line 31, in main
    run_pipeline(config)
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/snntoolbox/bin/utils.py", line 57, in run_pipeline
    spiking_model = target_sim.SNN(config, queue)
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/snntoolbox/simulation/target_simulators/pyNN_target_sim.py", line 46, in __init__
    AbstractSNN.__init__(self, config, queue)
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/snntoolbox/simulation/utils.py", line 167, in __init__
    self.sim = initialize_simulator(config)
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/snntoolbox/bin/utils.py", line 558, in initialize_simulator
    sim.setup(timestep=config.getfloat('simulation', 'dt'))
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker8/__init__.py", line 347, in setup
    SpiNNaker(
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker8/spinnaker.py", line 100, in __init__
    super(SpiNNaker, self).__init__(
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/abstract_spinnaker_common.py", line 150, in __init__
    self._set_up_timings(
  File "/home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/abstract_spinnaker_common.py", line 194, in _set_up_timings
    if (max_delay is not None and max_delay * 1000.0 >
TypeError: can't multiply sequence by non-int of type 'float'

.spynnaker.cfg file:

[Machine]
#-------
# Information about the target SpiNNaker board or machine:
# machineName: The name or IP address or the target board

# One and only one of the three machineName, spalloc_server or virtual_board = True must be set

# machine name is typically a URL and then version is required
machineName = 192.168.240.1
version = 5

# spalloc_server is typically a URL and then port and user are required
spalloc_server = None
spalloc_port = 22244
spalloc_user = None

# If using virtual_board both width and height must be set
virtual_board = False
# Allowed values pairs are (2,2)  (8,8)   (n*12,m*12)  and (n*12+4, m*12+4)
width = None
height = None

# Time scale factor allows the slowing down of the simulation
time_scale_factor = None

[Reports]
# options are DEFAULT or a file path
# In all cases oldest folders are automatically deleted to max_reports_kept=
default_report_file_path = DEFAULT

# options are DEFAULT, or a file path
# In all cases oldest folders are automatically deleted to max_reports_kept=
default_application_data_file_path = DEFAULT

[Mode]
# mode = Production or Debug
# In Debug mode all report boolean config values are automatically overwritten to True
mode = Production



# Additional config options can be found in:
# /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spinn_front_end_common/interface/spinnaker.cfg
# /home/saurav/miniconda3/envs/tf/lib/python3.9/site-packages/spynnaker/pyNN/spynnaker.cfg

# Copy any additional settings you want to change here including section headings

Config file creation:

# Generate Config file
config = configparser.ConfigParser()
config['paths'] = {
    'path_wd': WORKING_DIR,
    'dataset_path': DATASET_DIR,
    'filename_ann': MODEL_NAME,
    'runlabel': MODEL_NAME+'_'+str(NUM_STEPS_PER_SAMPLE)
}
config['tools'] = {
    'evaluate_ann': True,
    'parse': True,
    'normalize': True,
    'simulate': True
}
config['simulation'] = {
    'simulator': 'spiNNaker',
    'duration': NUM_STEPS_PER_SAMPLE,
    'num_to_test': NUM_TEST_SAMPLES,
    'batch_size': BATCH_SIZE,
    'keras_backend': 'tensorflow'
}
config['output'] = {
    'verbose': 0,
    'plot_vars': {
        'input_image',
        'spiketrains',
        'spikerates',
        'spikecounts',
        'operations',
        'normalization_activations',
        'activations',
        'correlation',
        'v_mem',
        'error_t'
    },
    'overwrite': True
}
# Write the configuration file
config_filepath = os.path.join(WORKING_DIR, 'config')
with open(config_filepath, 'w') as configfile:
    config.write(configfile)
@rbodo
Copy link
Contributor

rbodo commented Aug 15, 2022

I can't offer support for spinnaker-related questions at the moment; perhaps @ej159 has some insights?

@ej159
Copy link
Contributor

ej159 commented Aug 15, 2022

This sounds like it could be a problem with SpiNNaker toolchain versions. You can try checking the versions of your sPyNNaker and other tools in pip.

Unfortunately I don't have an enormous amount of bandwidth at the moment to properly troubleshoot the problems you are coming up with, but in a couple of weeks' time I will be able to.

@sauravtii
Copy link
Author

I did checked the version of sPyNNaker and other tools and they all are up to date.

@sauravtii
Copy link
Author

Just wanted to follow up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants