Struggling with Keras Example "10_Generate_Product_Names_With_LSTM"

Dear KNIME Analytic community,

I am working through example “10_Generate_Product_Names_With_LSTM” in the example library. This is a wonderful example and I would encourage all to work through it.
When I want to change it to test my understanding of it all by loading a CSV file with only a 100 records instead of the much larger set that is read directly from a KNIME ‘table’ it all goes well.

It goes well until the “TensorFlow Network Executer” on the Deployment workflow.

Differences I see:
• Under the configuration settings (of the first instance of TensorFlow Network Executer) of the Input I can see that the order of inputs changed although I did not do so explicitly
• I can also see that the outputs are different, one is not there
• I can see that the ‘variable’ (not even sure this is the right term for it) [?]state 10 has this question mark in it, which I think is directly linked to my problems. If I click on it, it evaporates into thin air without a warning.
• The output table no longer contains the column as can be seen below
• The new data I am loading is not anything weird, just the counting words one, two, three….but in my own language where not each number is described by one word as in English.

• Before this is how it looked when it still worked with the original dataset

• I am also not sure why there is a second instance of the TensorFlow Network Executer Node
• The second one is not firing up, but it is the former that is causing the trouble
• I just want to mention that I get very much the same behaviour with the original dataset if I stop the learning before it is completed in the Keras Network Learner node; I was wondering why it would allow me to stop something and export half a model that would never work

Would much appreciate some insights,
Leon

Hi Leon,

for me it looks like the first TensorFlow Network Executor doesn’t output the first hidden state any more.

To change this you can go into the configuration window of the first TensorFlow Network Executor node, scroll to the bottom and click on the “add output” button. You should be able to select lstm_1/while/Exit2:0. Next, please make sure to select “To List of Number(double)” as conversion type and state 1 as the “Output column prefix”.

Below you can find an answer to your other great questions inline:
• I am also not sure why there is a second instance of the TensorFlow Network Executer Node

The example works on character level (not word level). Based on the output of the first executor node we predict the first character. Then we start a loop. In each iteration we predict the next character. In this blog post we describe the different steps https://www.datanami.com/2019/04/04/product-naming-with-deep-learning/. Please let me know in case of any further questions.

• The second one is not firing up, but it is the former that is causing the trouble

The second one is not working because it misses the first hidden state as input. Adding the output state should fix this problem.

• I just want to mention that I get very much the same behaviour with the original dataset if I stop the learning before it is completed in the Keras Network Learner node; I was wondering why it would allow me to stop something and export half a model that would never work

Hm that’s strange. I just tried to reproduce this problem, but for me it works all fine. Did this happen only once or can you reproduce the problem? If yes, can you please share your workflow with the trained model with me?

Cheers,
Kathrin

1 Like

Dear Kathrin,

Many thanks for trying to help me!

Regarding the ‘TensorFlow Network Executor’ firstly. I have done that before, but that does not fix my problem. Also things does not look like the template example anymore.

The order of the output variables have changed and it looks like this now.

You can see the one I added end of “4:0” which is different than what you suggest.

Furthermore I have noticed now that the first notable difference occurs after the 'TensorFlow Network Reader". The Network is defined in this way, notably the order of the input variables are different. Starting with Input 3

Many thanks for helping me,
Leon

Hi Leon,

is this a screenshot of the first Network Executor node?

Can you please try to rename the “Output columns prefix” setting option of the last output to state 1?

Cheers,
Kathrin

1 Like

Thanks Kathrin,

That is indeed the outputs for the 1st instance of TFNE. I did also try what you suggest, but I still get an error on the 2nd TFNE.

I am sure it is all still related to that [?]state 10 that is missing

Very kind of you to help,
Leon

Would you mind either uploading your workflow to the KNIME Hub or exporting and attaching it to this thread? Then I could have a quick look and try to fix it.

1 Like

Additional Information. In the second TFNE-er:

Firstly it goes green and when I run it, it comes up with an error.

On the second TFNE this is how the input displays in the customizing.

For me it still looks like the column state 10 is missing.

Can you please check whether the first TFNE has an output column state 10. If yes can you check in addition whether the Recursive Loop Start node has an output column state 10?

1 Like

Hi Kathrin,

Thanks will check. Also wanted to upload the KNIME workflow here, but it was to big. I have not uploaded anything to the hub but will do if we do not get traction quickly. I know it is easier for you.

Thanks,
Leon

MountainNames.xlsx (9.3 KB)

Apologies, you will have to convert to csv, since I am not allowed to upload csv file here.
The changed example is on My-KNIME-Hub

image

Hope you can get it!
Leon

To answer your question “Can you please check whether the first TFNE has an output column state 10. If yes can you check in addition whether the Recursive Loop Start node has an output column state 10?”

There is no State 10 in the output. That state is definitely missing and I dont know how to add it.

Thanks,
Leon

Hi,

thank you for uploading it to the hub. It was already neeeaarly correct. Only one last little thing in the second TFNE was wrong.

In the output settings you have to select “To List of Number (double)” as the conversion type for the hidden states. Like in the first TFNE.

Does it work now?

Kathrin

1 Like

Hi Kathrin,

On my side it does not like it at all (for the second TFNE):

Here the output one and it does not look right

I am sorry for the trouble,
Did it actually compile and give an output on your side?

Leon

Hi Leon,

no problem. On my side it compiles and gives me an output.

I uploaded my version to the hub as well.

Can you please try whether this version works for you as well?

Cheers,
Kathrin

1 Like

Thanks Kathrin,

That is insane. Usually I would pick up the difference pretty quickly, but I cannot find it.

What is really unusual is that my workflow works on your end and when you pass it back to me, it indeed works on my end.

But the original one I built on my end does not work. I am still convinced it has something to do with the Input section on the second TFNE.

As you can see above the strange [?] state 10 ( I would say, not known), but even more worrying the next input has nothing included (since state is not known).

Are you really sure you changed nothing after I sent you that example?

Many thanks for your continuous help,

Leon

Hi Leon,

I really just changed the conversion type.

But I think I know why you are getting the warning. I assume you are trying to change the setting after running in into the error. This means in the second iteration. Please try to reset your loop (this means the loop start node), make the changes and try to execute.

Cheers,
Kathrin

2 Likes

Your understanding of my problem is perfect! Thanks you very, very much for your help! Hope to speak to you next time on my next problem.

You KNIME consultant are really very helpful!
Leon

1 Like

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