Reputation: 630
I'd like to convert keras model to tensorflow.js model. I run the offical command :
tensorflowjs_converter --input_format keras \
path/to/my_model.h5 \
path/to/tfjs_target_dir
-bash: tensorflowjs_converter: command not found
How can I solve the problem?
Upvotes: 12
Views: 15974
Reputation: 4507
In my case creating a clean conda environment helped(pyenv doesn't suuport Windows). Make sure to use python version 3.6.8. Than activate new env and install tensorflowjs:
conda create -n tfjs python=3.6.8
conda activate tfjs
pip install tensorflowjs
It did the trick for me.
Upvotes: 4
Reputation: 13309
In my case folder with Python binaries was not added to PATH. You can either add it to PATH or run the binary using absolute path. The following command gives the path to current Python installation you are using:
$ python -m site --user-base
/Users/me/Library/Python/2.7
Binaries will be stored in bin
sub-dir (you can add it to PATH):
/Users/me/Library/Python/2.7/bin
To run binary using absolute path simply add a binary name tensorflowjs_converter
:
$ /Users/me/Library/Python/2.7/bin/tensorflowjs_converter ...
Upvotes: 3
Reputation: 630
I try to install the tensorflowjs library by using:
$ sudo pip install tensorflowjs
instead of
$ pip install tensorflowjs
and run
$ tensorflowjs_converter --input_format keras \
path/to/my_model.h5 \
path/to/tfjs_target_dir
it's running!
Upvotes: 10
Reputation: 592
You should install tensorflowjs library using pip install tensorflowjs and you better read the below documentation. https://js.tensorflow.org/tutorials/import-keras.html
Upvotes: 0