Error trying to run a KNIME example

Hi I downloaded a neural network example from this link Image Recognition for Retail Use Case: Data Preparation & Building Convolutional Neural Network (CNN) Workflow – KNIME Community Hub
and have been trying to run it but when I run the node DL python network creator it shows this error:

ERROR DL Python Network Creator 0:285:88 Execute failed: Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ref() as the key.
Traceback (most recent call last):
File “”, line 5, in
File “C:\Program Files\KNIME\plugins\org.knime.dl.python_4.1.0.v201909231406\py\DLPythonNetworkSpecToDataFrameConverter.py”, line 96, in get_layer_data_specs_as_data_frames
extractor = DLPythonNetworkSpecToDataFrameConverter(network.spec)
File “C:\Program Files\KNIME\plugins\org.knime.dl.keras_4.1.0.v201911110939\py\DLKerasNetwork.py”, line 150, in spec
self._spec = self._extract_model_spec()
File “C:\Program Files\KNIME\plugins\org.knime.dl.keras_4.1.0.v201911110939\py\DLKerasTensorFlowNetwork.py”, line 87, in _extract_model_spec
return DLKerasTensorFlowNetworkSpecExtractor(self._model).extract_spec()
File “C:\Program Files\KNIME\plugins\org.knime.dl.keras_4.1.0.v201911110939\py\DLKerasNetworkSpecExtractor.py”, line 95, in extract_spec
self._extract_node_input_tensor_specs(layer, node_idx)
File “C:\Program Files\KNIME\plugins\org.knime.dl.keras_4.1.0.v201911110939\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 “C:\Users\user\Anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py”, line 705, in hash
raise TypeError("Tensor is unhashable if Tensor equality is enabled. "
TypeError: Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ref() as the key.

Can anyone help? I already installed everything necesary for this exercise. Thanks

Hi @Gregorio96,

This problem has already been answered in this forum post: ERROR Keras Network Learner 0:14 Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ref() as the key.

KNIME currently does not support TensorFlow 2. Please make sure to have Keras 2.1.6 and TensorFlow 1.8.0 installed in your Python environment instead. Please refer to this installation guide to learn how this can be done directly within KNIME.

Marcel

4 Likes

And answer given by @MarcelW is correct. The versions are causing the problems. Once I downloaded those I faced another error of “can’t decode string” while checking the log of KNIME.

So, I don’t want to write much but, I am giving the configurations below. If you follow them your Deep Network will work for sure.

Python: 3.6.0
Keras: 2.1.6 (as suggested)
Tensorflow: 1.8.0 (as suggested)
Pandas: 0.20.0

Now if you simply run the model you will still face an error. So for that you will have to “reinstall” the h5py library. Which could be easily done by writing:

pip install h5py==2.10.0 --force-reinstall

Thus, you will need h5py: 2.10.0 version.

And there you go!


Note: If you are unable to download the tensorflow and keras versions specified with anaconda, then I would suggest to download simple python 3.6 from its site and then pip install all versions accordingly.

You’re welcome.

4 Likes

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