joeddav / devol

Genetic neural architecture search with Keras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while exectuing demo notebook

tchaton opened this issue · comments

Genome encoding and accuracy data stored at Wed Jan 24 15:38:15 2018.csv

model 1/20 - generation 1/10:

An error occurred and the model could not train. Assigned poor score.


RuntimeError Traceback (most recent call last)
in ()
6
7 devol = DEvol(genome_handler)
----> 8 model = devol.run(dataset, num_generations, population_size, num_epochs)
9 model.summary()
10

/home/thomas/dsa-experimental/thomas/imagification/Ensemble_Testing/devol/devol.py in run(self, dataset, num_generations, pop_size, epochs, fitness, metric)
79 print("\nmodel {0}/{1} - generation {2}/{3}:\n"
80 .format(i + 1, len(members), 1, num_generations))
---> 81 res = self.evaluate(members[i], epochs)
82 v = res[metric_index]
83 del res

/home/thomas/dsa-experimental/thomas/imagification/Ensemble_Testing/devol/devol.py in evaluate(self, genome, epochs)
143 pass
144 self.bssf = met
--> 145 model.save('best-model.h5')
146
147 return model, loss, accuracy

/usr/local/lib/python2.7/dist-packages/keras/engine/topology.pyc in save(self, filepath, overwrite, include_optimizer)
2554 """
2555 from ..models import save_model
-> 2556 save_model(self, filepath, overwrite, include_optimizer)
2557
2558 def save_weights(self, filepath, overwrite=True):

/usr/local/lib/python2.7/dist-packages/keras/models.pyc in save_model(model, filepath, overwrite, include_optimizer)
114 else:
115 model_layers = model.layers
--> 116 topology.save_weights_to_hdf5_group(model_weights_group, model_layers)
117
118 if include_optimizer and hasattr(model, 'optimizer'):

/usr/local/lib/python2.7/dist-packages/keras/engine/topology.pyc in save_weights_to_hdf5_group(f, layers)
2850 g = f.create_group(layer.name)
2851 symbolic_weights = layer.weights
-> 2852 weight_values = K.batch_get_value(symbolic_weights)
2853 weight_names = []
2854 for i, (w, val) in enumerate(zip(symbolic_weights, weight_values)):

/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.pyc in batch_get_value(ops)
2200 """
2201 if ops:
-> 2202 return get_session().run(ops)
2203 else:
2204 return []

/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata)
887 try:
888 result = self._run(None, fetches, feed_dict, options_ptr,
--> 889 run_metadata_ptr)
890 if run_metadata:
891 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata)
1047 raise RuntimeError('Attempted to use a closed Session.')
1048 if self.graph.version == 0:
-> 1049 raise RuntimeError('The Session graph is empty. Add operations to the '
1050 'graph before calling run().')
1051

RuntimeError: The Session graph is empty. Add operations to the graph before calling run().

I had the same issue - for me what solved it was ensuring the response is in one-hot encoded form (i.e. for binary problem, the input is [[0,1],[1,0]] instead of [1,0])