autonomio / talos

Hyperparameter Experiments with TensorFlow and Keras
https://autonom.io
MIT License
1.62k stars 268 forks source link

talos execution fails of very first example: #544

Closed moshiour closed 3 years ago

moshiour commented 3 years ago

1) Confirm the below

2) Include the output of:

talos.__version__

Talos 1.0.0

3) Explain clearly what you are trying to achieve

I want to get model optimization using talos with LSTM-RNN.

4) Explain what you have already tried

I was testing the the first example talos from Github.

5) Provide a code-complete reference

Reports:

0%| | 0/18 [00:00<?, ?it/s]

ValueError Traceback (most recent call last)

in ----> 1 t = talos.Scan(x=x, y=y, params=p, model=diabetes, experiment_name='diabetes') ~/anaconda3/lib/python3.8/site-packages/talos/scan/Scan.py in __init__(self, x, y, params, model, experiment_name, x_val, y_val, val_split, random_method, seed, performance_target, fraction_limit, round_limit, time_limit, boolean_limit, reduction_method, reduction_interval, reduction_window, reduction_threshold, reduction_metric, minimize_loss, disable_progress_bar, print_params, clear_session, save_weights) 194 # start runtime 195 from .scan_run import scan_run --> 196 scan_run(self) ~/anaconda3/lib/python3.8/site-packages/talos/scan/scan_run.py in scan_run(self) 24 # otherwise proceed with next permutation 25 from .scan_round import scan_round ---> 26 self = scan_round(self) 27 self.pbar.update(1) 28 ~/anaconda3/lib/python3.8/site-packages/talos/scan/scan_round.py in scan_round(self) 17 # fit the model 18 from ..model.ingest_model import ingest_model ---> 19 self.model_history, self.round_model = ingest_model(self) 20 self.round_history.append(self.model_history.history) 21 ~/anaconda3/lib/python3.8/site-packages/talos/model/ingest_model.py in ingest_model(self) 4 through Scan() model paramater.''' 5 ----> 6 return self.model(self.x_train, 7 self.y_train, 8 self.x_val, in diabetes(x_train, y_train, x_val, y_val, params) 10 11 # make sure history object is returned by model.fit() ---> 12 out = model.fit(x=x, 13 y=y, 14 validation_data=[x_val, y_val], ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing) 1129 model=self, 1130 steps_per_execution=self._steps_per_execution) -> 1131 val_logs = self.evaluate( 1132 x=val_x, 1133 y=val_y, ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py in evaluate(self, x, y, batch_size, verbose, sample_weight, steps, callbacks, max_queue_size, workers, use_multiprocessing, return_dict) 1387 with trace.Trace('test', step_num=step, _r=1): 1388 callbacks.on_test_batch_begin(step) -> 1389 tmp_logs = self.test_function(iterator) 1390 if data_handler.should_sync: 1391 context.async_wait() ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds) 826 tracing_count = self.experimental_get_tracing_count() 827 with trace.Trace(self._name) as tm: --> 828 result = self._call(*args, **kwds) 829 compiler = "xla" if self._experimental_compile else "nonXla" 830 new_tracing_count = self.experimental_get_tracing_count() ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds) 869 # This is the first call of __call__, so we have to initialize. 870 initializers = [] --> 871 self._initialize(args, kwds, add_initializers_to=initializers) 872 finally: 873 # At this point we know that the initialization is complete (or less ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in _initialize(self, args, kwds, add_initializers_to) 723 self._graph_deleter = FunctionDeleter(self._lifted_initializer_graph) 724 self._concrete_stateful_fn = ( --> 725 self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access 726 *args, **kwds)) 727 ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _get_concrete_function_internal_garbage_collected(self, *args, **kwargs) 2967 args, kwargs = None, None 2968 with self._lock: -> 2969 graph_function, _ = self._maybe_define_function(args, kwargs) 2970 return graph_function 2971 ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _maybe_define_function(self, args, kwargs) 3359 3360 self._function_cache.missed.add(call_context_key) -> 3361 graph_function = self._create_graph_function(args, kwargs) 3362 self._function_cache.primary[cache_key] = graph_function 3363 ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _create_graph_function(self, args, kwargs, override_flat_arg_shapes) 3194 arg_names = base_arg_names + missing_arg_names 3195 graph_function = ConcreteFunction( -> 3196 func_graph_module.func_graph_from_py_func( 3197 self._name, 3198 self._python_function, ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py in func_graph_from_py_func(name, python_func, args, kwargs, signature, func_graph, autograph, autograph_options, add_control_dependencies, arg_names, op_return_value, collections, capture_by_value, override_flat_arg_shapes) 988 _, original_func = tf_decorator.unwrap(python_func) 989 --> 990 func_outputs = python_func(*func_args, **func_kwargs) 991 992 # invariant: `func_outputs` contains only Tensors, CompositeTensors, ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in wrapped_fn(*args, **kwds) 632 xla_context.Exit() 633 else: --> 634 out = weak_wrapped_fn().__wrapped__(*args, **kwds) 635 return out 636 ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs) 975 except Exception as e: # pylint:disable=broad-except 976 if hasattr(e, "ag_error_metadata"): --> 977 raise e.ag_error_metadata.to_exception(e) 978 else: 979 raise ValueError: in user code: /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:1233 test_function * return step_function(self, iterator) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:1224 step_function ** outputs = model.distribute_strategy.run(run_step, args=(data,)) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py:1259 run return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py:2730 call_for_each_replica return self._call_for_each_replica(fn, args, kwargs) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py:3417 _call_for_each_replica return fn(*args, **kwargs) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:1217 run_step ** outputs = model.test_step(data) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:1183 test_step y_pred = self(x, training=False) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py:998 __call__ input_spec.assert_input_compatibility(self.input_spec, inputs, self.name) /home/moshiour/anaconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/input_spec.py:204 assert_input_compatibility raise ValueError('Layer ' + layer_name + ' expects ' + ValueError: Layer sequential expects 1 input(s), but it received 2 input tensors. Inputs received: [, ] ---
mikkokotila commented 3 years ago

Something is wrong with your input data shape. See the error message for more information:

ValueError: Layer sequential expects 1 input(s), but it received 2 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(None, 8) dtype=float32>, <tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=float32>]

Closing here, feel free to open new issue if anything.