Я использую Tensorflow 2.1 и получаю следующую ошибку при попытке выполнить мой код:
ValueError: No data provided for "embedding_input". Need data for each key in: ['embedding_input']
Код:
history = model.fit(train_ds,
validation_data=val_ds,
epochs=5,
steps_per_epoch=32,
validation_steps=32
)
Данные:
('train_ds type', <class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'>)
('train_ds ', <BatchDataset shapes: ({Text: (32, 200), Intensity: (32,)}, (32,)), types: ({Text: tf.int32, Intensity: tf.float64}, tf.int64)>)
('val_ds type', <class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'>)
('val_ds ', <BatchDataset shapes: ({Text: (32, 200), Intensity: (32,)}, (32,)), types: ({Text: tf.int32, Intensity: tf.float32}, tf.int64)>)
Модель:
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, None, 16) 20224
_________________________________________________________________
global_average_pooling1d (Gl (None, 16) 0
_________________________________________________________________
dense (Dense) (None, 1) 17
=================================================================
Total params: 20,241
Trainable params: 20,241
Non-trainable params: 0
_________________________________________________________________
None
Ошибка:
Traceback (most recent call last):
File "Mood recognition.py", line 71, in <module>
steps_per_epoch=32
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training.py", line 819, in fit
use_multiprocessing=use_multiprocessing)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 235, in fit
use_multiprocessing=use_multiprocessing)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 593, in _process_training_inputs
use_multiprocessing=use_multiprocessing)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 706, in _process_inputs
use_multiprocessing=use_multiprocessing)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/data_adapter.py", line 702, in __init__
x = standardize_function(x)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 684, in standardize_function
return dataset.map(map_fn, num_parallel_calls=dataset_ops.AUTOTUNE)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 1591, in map
self, map_func, num_parallel_calls, preserve_cardinality=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3926, in __init__
use_legacy_function=use_legacy_function)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3147, in __init__
self._function = wrapper_fn._get_concrete_function_internal()
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/eager/function.py", line 2395, in _get_concrete_function_internal
*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/eager/function.py", line 2389, in _get_concrete_function_internal_garbage_collected
graph_function, _, _ = self._maybe_define_function(args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/eager/function.py", line 2703, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/eager/function.py", line 2593, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/framework/func_graph.py", line 978, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3140, in wrapper_fn
ret = _wrapper_helper(*args)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3082, in _wrapper_helper
ret = autograph.tf_convert(func, ag_ctx)(*nested_args)
File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in converted code:
/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_v2.py:677 map_fn
batch_size=None)
/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training.py:2410 _standardize_tensors
exception_prefix='input')
/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/keras/engine/training_utils.py:510 standardize_input_data
'for each key in: ' + str(names))
ValueError: No data provided for "embedding_input". Need data for each key in: ['embedding_input']
Любая помощь приветствуется.