Provided weight data has no target variable: batch_normalization
See original GitHub issueTo get help from the community, check out our Google group.
TensorFlow.js version
0.13
Browser version
Chrome Version 69.0.3497.100
Describe the problem or feature request
I converted a Keras model to tfjs using python utility with no errors. But when I try to load the model in tfjs, I get the following error:
tfjs@0.13.0:2 Uncaught (in promise) Error: Provided weight data has no target variable: batch_normalization_1_2/gamma
at new t (tfjs@0.13.0:2)
at loadWeightsFromNamedTensorMap (tfjs@0.13.0:2)
at t.loadWeights (tfjs@0.13.0:2)
at tfjs@0.13.0:2
at tfjs@0.13.0:2
at Object.next (tfjs@0.13.0:2)
at i (tfjs@0.13.0:2)
Code to reproduce the bug / link to feature request
Running it on local machine. model = await tf.loadModel(<path_to_model.json>)
Issue Analytics
- State:
- Created 5 years ago
- Comments:28 (1 by maintainers)
Top Results From Across the Web
Uncaught (in promise) Error: Provided weight data has no ...
Unfortunately, when I try to load the JSON model I get this error: Uncaught (in promise) Error: Provided weight data has no target...
Read more >How to Transform Target Variables for Regression in Python
It will prepare the transform of the target variable using the same training data used to fit the model, then apply that inverse...
Read more >Batch Normalization in practice: an example with Keras and ...
In this article, we will focus on adding and customizing batch normalization in our machine learning model and look at an example of...
Read more >HyperParameter Tuning, Batch Normalization - Kaggle
The data is provided as file named 'data.csv'. ... 'df' and assign it to variable 'X'; Extract target variable 'traget' and assign it...
Read more >The Effect of Batch Normalization on Deep Convolutional ...
the use of variance-preserving weight initialization, as well ... The test set is a set of data that is not used during training,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Folks
I think I found why we are getting this error. The error can happen for any layer. Steps to reproduce the error:
It seems every layer name changes in model.json file (it will be different than model.summary name). For example, one of the layer in my model was ‘conv2d_6’ but it got named as ‘conv2d_6_2’ when I loaded the model twice. But it seems actual weights (assuming in shard file) still expect 'conv2d_6 in my case.
So till we get a fix, pls make sure you load your model only once before doing tfjs conversion. Hope this helps.
Not sure if this helps, but when I converted my h5 model using the python code `import tensorflowjs as tfjs from keras.models import load_model
modelk = load_model(‘./input/model.h5’)
tfjs.converters.save_keras_model(modelk, ‘./output/’)`
I would receive the following error:
errors.ts:48 Uncaught (in promise) Error: Provided weight data has no target variable: dense_1_7/kernel at new t (errors.ts:48) at loadWeightsFromNamedTensorMap (container.ts:190) at t.loadWeights (container.ts:759) at models.ts:285 at index.ts:79 at Object.next (index.ts:79) at i (index.ts:79)
But if I convert the h5 model using the tensorflowjs_converter command line tool my tfjs json model file will load without any problems.