ERROR Keras Network Learner 4:148 Execute failed: An error occurred while creating the Keras network from its layer specifications. Details:

Hi everyone I’m trying to test the keras network learner module, I followed the guide on how to configure an anaconda environment to install tensorflow, but every time I go to run network training I always get this error:

Tensors are unhashable (this tensor: KerasTensor(type_spec=TensorSpec(shape=(64, 2000, 1), dtype=tf.float32, name=‘input_layer_1’), name=‘input_layer_1’, description=“created by layer ‘input_layer_1’”)). Instead, use tensor.ref() as the key.
Traceback (most recent call last):
File “”, line 5, in
File “/home/User/apps/knime_4.7.2/plugins/org.knime.dl.python_4.7.0.v202211082354/py/DLPythonNetworkSpecToDataFrameConverter.py”, line 92, in get_layer_data_specs_as_data_frames
extractor = DLPythonNetworkSpecToDataFrameConverter(network.spec)
File “/home/User/apps/knime_4.7.2/plugins/org.knime.dl.keras_4.7.0.v202211082354/py/DLKerasNetwork.py”, line 150, in spec
self._spec = self._extract_model_spec()
File “/home/User/apps/knime_4.7.2/plugins/org.knime.dl.keras_4.7.0.v202211082354/py/DLKerasTensorFlowNetwork.py”, line 87, in _extract_model_spec
return DLKerasTensorFlowNetworkSpecExtractor(self._model).extract_spec()
File “/home/User/apps/knime_4.7.2/plugins/org.knime.dl.keras_4.7.0.v202211082354/py/DLKerasNetworkSpecExtractor.py”, line 95, in extract_spec
self._extract_node_input_tensor_specs(layer, node_idx)
File “/home/User/apps/knime_4.7.2/plugins/org.knime.dl.keras_4.7.0.v202211082354/py/DLKerasNetworkSpecExtractor.py”, line 149, in _extract_node_input_tensor_specs
if input_tensor in self._model_inputs and input_tensor not in self._visited_inputs:
File “/home/User/anaconda3/lib/python3.9/site-packages/keras/engine/keras_tensor.py”, line 242, in hash
raise TypeError(f’Tensors are unhashable (this tensor: {self}). ’
TypeError: Tensors are unhashable (this tensor: KerasTensor(type_spec=TensorSpec(shape=(64, 2000, 1), dtype=tf.float32, name=‘input_layer_1’), name=‘input_layer_1’, description=“created by layer ‘input_layer_1’”)). Instead, use tensor.ref() as the key

can someone help me ?

Hi @mvozza and welcome to the forum.

Is the workflow that you are testing one you made from scratch, or one you’re trying from the KNIME Community Hub? In either case, would you be able to upload the workflow here for others to try out? That would at least help us determine if it’s a Python environment problem, or an issue with the workflow itself.

hi @ScottF this is the wrorkflow that i try to import and test.

the version in the conda env is:
tensorflow=2.2.0 and i have created the environment directly in knime

Hi @mvozza -

I am running the workflow now on my laptop and the Keras Network Learner is training, so I think there must be an issue with the setup of your Python backend.

Can you post a screenshot of your KNIME Preferences → Python Deep Learning? Mine looks like this:

1 Like

@ScottF


this is my set-up in the deep learning preferences, the difference is that you have installed the tensorflow library 1.1.12 and i have the automatic installed 2.2.0 and the serialisation library. i’m unable to understand your version of keras.

Since this workflow uses the Keras Network Learner, I think we are more interested in the Keras setup in your above screenshot. Right now the environment associated with Keras is set to “base”, which I assume means the required packages aren’t being used. Can you adjust that?

1 Like

thanks @ScottF i solved my problem installing a keras environment and replacing the version of tf 2.2.0 with 1.12.0

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.