Categories
Misc

Does someone know why this is happening?

Does someone know why this is happening?

I’ve been trying to use tensorflow.js recently with a model that I had trained in Python and converted it to .JSON (normal procedure).

My model architecture was:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, None, 256) 7680
_________________________________________________________________
bidirectional (Bidirectional (None, 2048) 10493952
_________________________________________________________________
dense (Dense) (None, 128) 262272
_________________________________________________________________
dense_1 (Dense) (None, 10) 1290
=================================================================
Total params: 10,765,194
Trainable params: 10,765,194
Non-trainable params: 0
_________________________________________________________________
Inside that Birectional layer there is a LSTM layer with 1024 units

But on Javascript when I call:

const MODEL_URL = "../model/model.json" async function run() { // Load the model from the CDN. const model = await tf.loadLayersModel(MODEL_URL, strict=false); // Print out the architecture of the loaded model. // This is useful to see that it matches what we built in Python. console.log(model.summary()); } 

I get this error:

Uncaught (in promise) TypeError: e.forEach is not a function at bg (util_base.js:681) at Mw (tensor_ops_util.js:44) at Lw (tensor.js:56) at Ww (io_utils.js:225) at RM (models.js:334) at models.js:316 at c (runtime.js:63) at Generator._invoke (runtime.js:293) at Generator.next (runtime.js:118) at bv (runtime.js:747) 

But I saw that util_base.js file and there’s no e.forEach function being called at line 681, actually it doesn’t even have 681 lines:

The util_base.js file

I created an issue on tfjs repository on Github telling that it was a bug but I think the contributors didn’t believe me or didn’t want to help so they simply told me that this code ran normaly on their execution, now I don’t know what to do.
Does anybody have an idea on what is causing this error?
If you want to reproduce the code by yourselves here is the Glitch link: https://glitch.com/edit/#!/spotted-difficult-neptune

submitted by /u/fatorius_hs
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *