tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.51k stars 1.94k forks source link

Query: Convert Tensorflow NMT with attention model to tfjs #4566

Closed kabyanil closed 3 years ago

kabyanil commented 3 years ago

I'm following the TensorFlow NMT with attention (link) guide to build a character level transliteration model. I'm able to train the model and make inference calls in an .ipynb notebook. I'm able to save training checkpoints and load them later. However, my front end application is built on electron js. Therefore, I need to convert the encoder-decoder model to tfjs. Would anybody provide some guidance to convert my model to tfjs? I'd be happy to provide source code if needed.

rthadur commented 3 years ago

@kabyanil did you check this old discussion on google groups https://groups.google.com/a/tensorflow.org/g/tfjs/c/OOz4JMu4kOg/m/z7Oig2ytAgAJ ?

kabyanil commented 3 years ago

@rthadur thanks for replying. going through the group discussion, i ended up on the tensorflow/ tfjs repository. it contains a note saying -

Note: Session bundle format have been deprecated in TensorFlow.js 1.0. Please use the TensorFlow.js 0.15.x backend to convert session bundle, available in tfjs-converter 0.8.6.

i don't seem to understand what this means. how do i install tensorflow.js 0.15.x?

rthadur commented 3 years ago

please check step 7 as how to install lower version in VM here https://github.com/tensorflow/tfjs/blob/master/tfjs-converter/README.md. Thank you

kabyanil commented 3 years ago

i followed step 7 as mentioned...

i created a venv and tried installing tensorflowjs 0.8.6.

i got the following error -

Collecting tensorflowjs==0.8.6
  Using cached tensorflowjs-0.8.6-py3-none-any.whl (39 kB)
ERROR: Could not find a version that satisfies the requirement tensorflow==1.13.1 (from tensorflowjs)
ERROR: No matching distribution found for tensorflow==1.13.1

how do i install tensorflowjs 0.8.6 and convert my session bundle to tfjs?

rthadur commented 3 years ago

tensorflow has stopped supporting 1.13.1 so we do not support session bundle anymore as there is underlying dependency. Updated README here https://github.com/tensorflow/tfjs/pull/4583

kabyanil commented 3 years ago

Thanks for the information. You may as well remove the 7th point in the README file.

rthadur commented 3 years ago

Sure , opened a new PR to remove , thank you

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No