Error running benchmark with nano

I am trying to run the benchmark as is (no modifications) on nano. I get the following output when I run the model.fit_generator module in the iPython notebook. I would appreciate any feedback on what this error is, and how to fix it so we can get the benchmark working:

ValueError Traceback (most recent call last)
in ()
4 epochs=2,
5 validation_data=data.val_batches(),
----> 6 validation_steps=2, # data.num_val_batches to validate on full set
7 )

/home/venv/lib/python3.5/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
85 warnings.warn('Update your ' + object_name + 86 ' call to the Keras 2 API: ’ + signature, stacklevel=2)
—> 87 return func(*args, **kwargs)
88 wrapper._original_function = func
89 return wrapper

/home/venv/lib/python3.5/site-packages/keras/models.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1221 use_multiprocessing=use_multiprocessing,
1222 shuffle=shuffle,
-> 1223 initial_epoch=initial_epoch)
1224
1225 @interfaces.legacy_generator_methods_support

/home/venv/lib/python3.5/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
85 warnings.warn('Update your ' + object_name + 86 ' call to the Keras 2 API: ’ + signature, stacklevel=2)
—> 87 return func(*args, **kwargs)
88 wrapper._original_function = func
89 return wrapper

/home/venv/lib/python3.5/site-packages/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
2112 outs = self.train_on_batch(x, y,
2113 sample_weight=sample_weight,
-> 2114 class_weight=class_weight)
2115
2116 if not isinstance(outs, list):

/home/venv/lib/python3.5/site-packages/keras/engine/training.py in train_on_batch(self, x, y, sample_weight, class_weight)
1824 sample_weight=sample_weight,
1825 class_weight=class_weight,
-> 1826 check_batch_axis=True)
1827 if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
1828 ins = x + y + sample_weights + [1.]

/home/venv/lib/python3.5/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_batch_axis, batch_size)
1409 output_shapes,
1410 check_batch_axis=False,
-> 1411 exception_prefix=‘target’)
1412 sample_weights = _standardize_sample_weights(sample_weight,
1413 self._feed_output_names)

/home/venv/lib/python3.5/site-packages/keras/engine/training.py in _standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
126 if len(array.shape) == 1:
127 array = np.expand_dims(array, 1)
–> 128 arrays[i] = array
129
130 # Check shapes compatibility.

ValueError: could not broadcast input array from shape (24,1) into shape (24)

1 Like

I had the same error…
Seems to be some problem with the newest Keras release.
I solved it by downgrading Keras to 2.0.8.

1 Like

I was using Keras 2.1.1 (newest) and had the same problem.
I downgraded one by one from the newest and checked what is the latest version that works with the benchmark code.
It turned out that 2.1.0 and 2.0.9 also don’t work (because of a different error).
The newest, compatible version of Keras is 2.0.8 as mentioned by @simon.g.