Closed GiantTreeLP closed 5 years ago
Thanks, @GiantTreeLP, for reporting this. This is a bug and we will fix it soon.
I had the problem using this command: loaded_model = model_from_json(loaded_model_json)
but when I add (tf.keras.models.): loaded_model = tf.keras.models.model_from_json(loaded_model_json)
it works just fine
@Soufiane-Fartit I am still getting this error in tensorflow-js. Do you how to solve this?
@aditya1702 I'm sorry to disappoint, but I'm still a beginner and don't know much
@aditya1702 Can you share the following info 1) The version of keras or tensorflow that you used to generate the saved model from the Python side (I assume you've exported model from Python) 2) The version of TensorFlow.js you are using 3) The exact error message you are getting and the line of JavaScript code executing when that error happens 4) Ideally, share the model JSON (before and after conversion) with us if possible.
@Soufiane-Fartit I am still getting this error in tensorflow-js. Do you how to solve this?
Try adding the following in the model load function call.
custom_objects={"GlorotUniform": tf.keras.initializers.glorot_uniform}
import keras new_model = keras.models.load_model('weights/relu_tensor1')
ValueError: Unknown initializer: GlorotUniform
My packages are:
#
_libgcc_mutex 0.1 main
absl-py 0.9.0 pypi_0 pypi
astor 0.8.1 pypi_0 pypi
attrs 19.3.0 pypi_0 pypi
backcall 0.1.0 pypi_0 pypi
bleach 3.1.5 pypi_0 pypi
ca-certificates 2020.1.1 0
certifi 2018.8.24 py35_1
decorator 4.4.2 pypi_0 pypi
defusedxml 0.6.0 pypi_0 pypi
entrypoints 0.3 pypi_0 pypi
gast 0.3.3 pypi_0 pypi
google-pasta 0.2.0 pypi_0 pypi
grpcio 1.29.0 pypi_0 pypi
h5py 2.10.0 pypi_0 pypi
importlib-metadata 1.6.0 pypi_0 pypi
ipykernel 5.3.0 pypi_0 pypi
ipython 7.9.0 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
ipywidgets 7.5.1 pypi_0 pypi
jedi 0.17.0 pypi_0 pypi
jinja2 2.11.2 pypi_0 pypi
jsonschema 3.2.0 pypi_0 pypi
jupyter 1.0.0 pypi_0 pypi
jupyter-client 6.1.3 pypi_0 pypi
jupyter-console 6.1.0 pypi_0 pypi
jupyter-core 4.6.3 pypi_0 pypi
keras 2.2.4 pypi_0 pypi
keras-applications 1.0.8 pypi_0 pypi
keras-preprocessing 1.1.2 pypi_0 pypi
libedit 3.1.20181209 hc058e9b_0
libffi 3.2.1 hd88cf55_4
libgcc-ng 9.1.0 hdf63c60_0
libstdcxx-ng 9.1.0 hdf63c60_0
markdown 3.2.2 pypi_0 pypi
markupsafe 1.1.1 pypi_0 pypi
mistune 0.8.4 pypi_0 pypi
nbconvert 5.6.1 pypi_0 pypi
nbformat 5.0.6 pypi_0 pypi
ncurses 6.2 he6710b0_1
notebook 6.0.3 pypi_0 pypi
numpy 1.18.4 pypi_0 pypi
openssl 1.0.2u h7b6447c_0
packaging 20.4 pypi_0 pypi
pandocfilters 1.4.2 pypi_0 pypi
parso 0.7.0 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pip 10.0.1 py35_0
prometheus-client 0.8.0 pypi_0 pypi
prompt-toolkit 2.0.10 pypi_0 pypi
protobuf 3.12.2 pypi_0 pypi
ptyprocess 0.6.0 pypi_0 pypi
pygments 2.6.1 pypi_0 pypi
pyparsing 2.4.7 pypi_0 pypi
pyrsistent 0.16.0 pypi_0 pypi
python 3.5.6 hc3d631a_0
python-dateutil 2.8.1 pypi_0 pypi
pyyaml 5.3.1 pypi_0 pypi
pyzmq 19.0.1 pypi_0 pypi
qtconsole 4.7.4 pypi_0 pypi
qtpy 1.9.0 pypi_0 pypi
readline 7.0 h7b6447c_5
scipy 1.4.1 pypi_0 pypi
send2trash 1.5.0 pypi_0 pypi
setuptools 40.2.0 py35_0
six 1.15.0 pypi_0 pypi
sqlite 3.31.1 h62c20be_1
tensorboard 1.14.0 pypi_0 pypi
tensorflow 1.14.0 pypi_0 pypi
tensorflow-estimator 1.14.0 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
terminado 0.8.3 pypi_0 pypi
testpath 0.4.4 pypi_0 pypi
tk 8.6.8 hbc83047_0
tornado 6.0.4 pypi_0 pypi
traitlets 4.3.3 pypi_0 pypi
wcwidth 0.1.9 pypi_0 pypi
webencodings 0.5.1 pypi_0 pypi
werkzeug 1.0.1 pypi_0 pypi
wheel 0.31.1 py35_0
widgetsnbextension 3.5.1 pypi_0 pypi
wrapt 1.12.1 pypi_0 pypi
xz 5.2.5 h7b6447c_0
zipp 1.2.0 pypi_0 pypi
zlib 1.2.11 h7b6447c_3
@DeveloperAbhirupa Use the below codes. It works fine
from keras.models import load_model classifier = tf.keras.models.load_model("C:/Users/8_mnist_simple_cnn_10_Epochs.h5")
TensorFlow.js version
Version 0.13.2
Browser version
Google Chrome Version 69.0.3497.100 (64-bit)
Describe the problem or feature request
I am currently trying to load a convolutional neural network model from Keras (version 2.2.4) that has been converted using the tensorflow_converter utility (pip tensorflowjs version 0.6.4).
Upon loading the model, I am met with the following error:
However, the GlorotUniform initializer is part of tensorflowjs (https://js.tensorflow.org/api/0.13.0/#initializers.glorotUniform).
I have attached the
model.json
file that I'd like to load to this issue: model.zipCode to reproduce the bug / link to feature request