joeddav / devol

Genetic neural architecture search with Keras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while executing the demo notebook

tchaton opened this issue · comments

Genome encoding and accuracy data stored at Wed Jan 24 16:22:07 2018.csv

model 1/20 - generation 1/10:


ValueError Traceback (most recent call last)
in ()
4
5 devol = DEvol(genome_handler)
----> 6 model = devol.run(dataset, num_generations, population_size, num_epochs)
7 model.summary()

/home/thomas/dsa-experimental/thomas/imagification/Ensemble_Testing/devol/devol.pyc 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.pyc in evaluate(self, genome, epochs)
114
115 def evaluate(self, genome, epochs):
--> 116 model = self.genome_handler.decode(genome)
117 loss, accuracy = None, None
118 try:

/home/thomas/dsa-experimental/thomas/imagification/Ensemble_Testing/devol/genome_handler.pyc in decode(self, genome)
121 genome[offset + 1], (3, 3),
122 padding='same')
--> 123 model.add(convolution)
124 if genome[offset + 2]:
125 model.add(BatchNormalization())

/usr/local/lib/python2.7/dist-packages/keras/models.pyc in add(self, layer)
462 # and create the node connecting the current layer
463 # to the input layer we just created.
--> 464 layer(x)
465
466 if len(layer.inbound_nodes[-1].output_tensors) != 1:

/usr/local/lib/python2.7/dist-packages/keras/engine/topology.pyc in call(self, inputs, **kwargs)
574 'layer.build(batch_input_shape)')
575 if len(input_shapes) == 1:
--> 576 self.build(input_shapes[0])
577 else:
578 self.build(input_shapes)

/usr/local/lib/python2.7/dist-packages/keras/layers/convolutional.pyc in build(self, input_shape)
132 name='kernel',
133 regularizer=self.kernel_regularizer,
--> 134 constraint=self.kernel_constraint)
135 if self.use_bias:
136 self.bias = self.add_weight(shape=(self.filters,),

/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.pyc 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

/usr/local/lib/python2.7/dist-packages/keras/engine/topology.pyc in add_weight(self, name, shape, dtype, initializer, regularizer, trainable, constraint)
398 dtype=dtype,
399 name=name,
--> 400 constraint=constraint)
401 if regularizer is not None:
402 self.add_loss(regularizer(weight))

/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.pyc in variable(value, dtype, name, constraint)
383 v._uses_learning_phase = False
384 return v
--> 385 v = tf.Variable(value, dtype=tf.as_dtype(dtype), name=name)
386 if isinstance(value, np.ndarray):
387 v._keras_shape = value.shape

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.pyc in init(self, initial_value, trainable, collections, validate_shape, caching_device, name, variable_def, dtype, expected_shape, import_scope, constraint)
211 dtype=dtype,
212 expected_shape=expected_shape,
--> 213 constraint=constraint)
214
215 def repr(self):

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.pyc in _init_from_args(self, initial_value, trainable, collections, validate_shape, caching_device, name, dtype, expected_shape, constraint)
320 "construct, such as a loop or conditional. When creating a "
321 "variable inside a loop or conditional, use a lambda as the "
--> 322 "initializer." % name)
323 # pylint: enable=protected-access
324 shape = (self._initial_value.get_shape()

ValueError: Initializer for variable conv2d_4/kernel/ is from inside a control-flow construct, such as a loop or conditional. When creating a variable inside a loop or conditional, use a lambda as the initializer.