tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

Unknown Layer: AttentionDecoder

Open auzair92 opened this issue 8 years ago • 8 comments

TensorFlow.js version 0.6.2

Browser version Firefox Quantum 62.0.2

Describe the problem or feature request

When trying to load a Tensorflow saved model (obtained with the Tensorflow.js converter) in the browser, I get the following error message: Error: Unknown layer: AttentionDecoder

Code to reproduce the bug / link to feature request

const model = await tf.loadModel(MODEL_PATH);

auzair92 avatar Oct 05 '18 08:10 auzair92

@auzair92 have you converted the model using tfjs converter and in went through without any issue?

these are the supported operations for now. I have to implement a few also for my projects but docs are scarce... I suppose that we have to update the python converter locally plus my js code... I'm figuring out how. I don't want to use ts also, however I understand that others can benefit of my work if I PR it.

I think that a bootstrap project with a dummy layer with a way to keep updated the converter would be very helpful.

DavidGOrtega avatar Oct 05 '18 09:10 DavidGOrtega

Yes I used tfjs converter for the keras model conversion and it went fine. However the problem still sustains. I think I have to implement a custom layer as a part of solution.

auzair92 avatar Oct 05 '18 12:10 auzair92

Can anyone add Bahdanau Attention Decoder Layer to the tensorflowjs layers repo. It would be immensely helpful.

Raza25 avatar Oct 09 '18 05:10 Raza25

Hi @Raza25 , The layers repo includes layers that are part of the Keras common API. As far as I can tell, the AttentionDecoder layer is a custom layer, right? If so, the right solution is to also add a AttentionDecoder custom layer implementation to your own application. There is an example of how to add custom layers in the tfjs-examples repo.

bileschi avatar Oct 09 '18 14:10 bileschi

@bileschi do we have a tensorflowjs version of AttentionDecoder available?

Raza25 avatar Oct 11 '18 10:10 Raza25

There is not, AFAIK

However: if you don't need to maintain the keras structure, and you don't need to continue training on the javascript side, you can convert your SavedModel using the following instructions:

https://js.tensorflow.org/tutorials/import-saved-model.html

This will work, so long as all of the ops required are implemented in JS. If some ops are not available in JS, the converter will report it. Please follow up here if this works for you! :)

On Thu, Oct 11, 2018 at 6:09 AM Raza Khan [email protected] wrote:

@bileschi https://github.com/bileschi do we have a tensorflowjs version of AttentionDecoder available?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/tfjs/issues/763#issuecomment-428899322, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhZTrpZf3VNVdXBPWVp8Q8SVOFWfyU1ks5ujxj1gaJpZM4XJvwF .

-- Stan Bileschi Ph.D. | SWE | [email protected] | 617-230-8081

bileschi avatar Oct 11 '18 13:10 bileschi

If you end up implementing the AttentionDecoder layer, and you wish to share, contributions are welcome to the tfjs-models repository :)

https://github.com/tensorflow/tfjs-models

bileschi avatar Oct 11 '18 13:10 bileschi

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

rthadur avatar Nov 07 '18 22:11 rthadur