Deep Learning - Keras installation

keras
#1

Hi,
I am currently playing around with the the Keras nodes and tried to get an example workflow running but something seems to be wrong with my Python setup. As recommended, I used the “new environmenr” option in the Python Deep Learning preferences to create a new environment. Package versions are now:

keras - 2.2.4
tensorflow - 1.12.0
python - 3.6.9

Executing the ‘Keras Network Learner’ fails with the following error:

ERROR Keras Network Learner 2:16       Failed to save Keras deep learning network.
Traceback (most recent call last):
File "<string>", line 3, in <module>
  File "/Users/niederle/knimeInUse/knime-apps/KNIME 4.0.0.app/Contents/Eclipse/plugins/org.knime.dl.keras_4.0.0.v201906111427/py/DLKerasNetwork.py", line 235, in save
    raise RuntimeError('Failed to save Keras deep learning network.') from e
RuntimeError: Failed to save Keras deep learning network.

ERROR Keras Network Learner 2:16       Execute failed: An error occurred while creating the Keras network from its layer specifications.
This could be due to a version mismatch between Keras and TensorFlow.
Please make sure that Keras 2.1.6 and TensorFlow 1.8.0 are installed in your Python environment.
See log for details.
You can install the correct version of Keras and TensorFlow on the 'Python Deep Learning' preference page.

I will now try to downgrade Keras and Tensorflow to the suggested versions and see whether that helps. Any other ideas?

0 Likes

#2

Hi @niederle,

generally both keras - 2.2.4 with tensorflow - 1.12.0 and keras - 2.1.6 with tensorflow - 1.8.0 should work. Could you maybe attach the full log file and an example workflow?

Cheers,
David

0 Likes

#3

Hi David,

here is the knime.log (11.8 KB)
(I deleted the log-file before restarting KNIME - so it’s pretty short).

The (example-)workflow: Building CNN from scratch with Keras Layer nodes.knwf

Best,
Antje

0 Likes

#4

I guess, I found the solution today. It has nothing to do with my setup. As I said, I imported this workflow (which is already executed) and only reset the ‘Keras Network Learner’ before trying to execute it again.
As I could successfully execute another example workflow (“03_Train_MNIST_classifier”), I thought it has something to do with the network and tried to compare. As the ‘Keras Writer’ also failed, I tried to export the network with the model writer which gave me the following error:

Execute failed: Failed copying file stores to local handler

Finally, I tried to also reset and reexecute the predecessor Keras node (which is a ‘Keras Dense Layer’) and now things work!

I hope this will help to fix this example workflow (or the node) as I assume that such problems should not occur. Beside that, the Keras error message is pretty misleading - maybe things could be improved there. I spent a lot of troubleshooting with my Keras/Python setup which was not a problem at all…

Best,
Antje

3 Likes