I've saved a model I created with Python Tensorflow. Is it possible to load this with Tensorflow.js?
Save
tf.saved_model.save(translator, 'ipa_translator',
signatures={'serving_default': translator.tf_translate})
Load
reloaded = tf.saved_model.load('ipa_translator')
result = reloaded.tf_translate(input_text)
I've found Tensorflow import_saved_model which looks like it'll handle the conversion, but I can't figure out how it's meant to be used.
I also tried following this guide, but got errors about mismatching model types.
There appears to be a wizard script pip3 install tensorflowjs[wizard], when I try to install it I get no matches found: tensorflowjs[wizard]
This is the model that I want to convert if that helps: https://colab.research.google.com/drive/16ge-HE2RZ6TmG9_zS2_L4dLKOO00mVRB?usp=sharing
I would appreciate any guidance at all on getting this running.
Looks like the some of the issues I was having were to do with incompatibilities between some of the libraries.
I set up a new Poetry environment. While installing
tensorflowandtensorflowjsit flagged up some version issues with dependencies.After I downgraded
tensorflowto2.11I was able to install tensorflowjs and the wizard. I had to wrap the wizard lib name in quotes so that it was recognisedpoetry add -D "tensorflowjs[wizard]".I could then run
tensorflowjs_wizardin the terminal and follow the steps to complete the conversion.Here's the poetry set up that worked for me.
pyproject.toml
The final piece of the puzzle was about using Tensorflow v1 api, I had to migrate the script to v2, which was painful to say the least.