tensorflowjs_converter: "Init node layer1/kernel/Assign doesn't exist in graph"

446 views
Skip to first unread message

Larry Lindsey

unread,
Apr 1, 2019, 3:49:06 PM4/1/19
to tf...@tensorflow.org
Apologies if this isn't the ideal forum for this question - if so, please direct me to the correct one. TL;DR, I've built tensorflowjs_converter from source and am attempting to convert a SavedModel for use with tf.js.

Running this command:
tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model \
  --saved_model_tags=serve tfjs_model_test1 tfjs_model_test1.js

Results in the following error:
2019-04-01 12:38:18.798130: E tensorflow/core/grappler/grappler_item_builder.cc:636] Init node layer1/kernel/Assign doesn't exist in graph

I suspect that I'm holding it wrong, in which case, would someone correct me? In particular, the version I'd used previously (version 0.8, installed via pip) was able to convert this kind of model without issue.

Here's the detailed background: In Python, I'm using Tensorflow version 1.13.1, and I've compiled the converter at github HEAD (currently commit 57ba1a5f6e). I'm using recent sources because I have models that make use of ops that don't work with the previous release - at least one is implemented in a pull request that has yet to be merged (conv3d conversion). That said, for simplicity's sake, I'm using just a handful of conv2d layers for my current experiment. 

Thanks for any help!

Larry


Nikhil Thorat

unread,
Apr 1, 2019, 4:45:40 PM4/1/19
to Larry Lindsey, TensorFlow.js Discussion, Ping Yu

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/CAHDLJmXsZj2XX9dLH%2BZMet3VJoVvTtmZ6gvoj3merBr1zM06Lg%40mail.gmail.com.

Ping Yu

unread,
Apr 1, 2019, 5:30:49 PM4/1/19
to Nikhil Thorat, Larry Lindsey, TensorFlow.js Discussion
Hi Larry

If you have tensorflow 1.13 already installed, you might have issue using the tfjs 1.0.x pip converter.
Since the new tfjs pip uses TF 2.0 nightly, you might end up having two versions of TF.
If you can, please create a new virtualenv, then install the 1.0.x tfjs converter in that, and try to
run the command again.

Please let me know if this issue persists.

Thanks
Ping

Larry Lindsey

unread,
Apr 1, 2019, 5:48:40 PM4/1/19
to Ping Yu, Nikhil Thorat, TensorFlow.js Discussion
I'm fairly certain that isn't the issue - I'm using TF in a remotely-hosted colab instance.

Ping Yu

unread,
Apr 1, 2019, 8:49:42 PM4/1/19
to Larry Lindsey, Nikhil Thorat, TensorFlow.js Discussion
got it, it could be a TF 2.0 grappler bug, if you can share your model with me, I can
look into bit more.

Erwin Carpio

unread,
Apr 9, 2019, 9:08:09 AM4/9/19
to TensorFlow.js Discussion, nsth...@google.com, lfli...@google.com
Hello everyone, it's been a while since i posted here,

I'm currently using tensorflow 2.0 alpha release.
i've trained a model.
i'm now going to convert the tf.keras model.
I tried 

pip install tensorflowjs

however it throws an error;

Could not find a version that satisfies the requirement tf-nightly-2.0-preview>=2.0.0.dev20190304 (from tensorflowjs) (from versions: )
No matching distribution found for tf-nightly-2.0-preview>=2.0.0.dev20190304 (from tensorflowjs)

I'm already on tensorflow 2.0 alpha. what could be wrong?
I'm also in a virtual environment venv.



I used to be able to install the converter easily.

Any suggestions will be much appreciated.



On Tuesday, April 2, 2019 at 5:30:49 AM UTC+8, Ping Yu wrote:
Hi Larry

If you have tensorflow 1.13 already installed, you might have issue using the tfjs 1.0.x pip converter.
Since the new tfjs pip uses TF 2.0 nightly, you might end up having two versions of TF.
If you can, please create a new virtualenv, then install the 1.0.x tfjs converter in that, and try to
run the command again.

Please let me know if this issue persists.

Thanks
Ping

On Mon, Apr 1, 2019 at 1:45 PM Nikhil Thorat <nsth...@google.com> wrote:
On Mon, Apr 1, 2019 at 3:49 PM 'Larry Lindsey' via TensorFlow.js Discussion <tf...@tensorflow.org> wrote:
Apologies if this isn't the ideal forum for this question - if so, please direct me to the correct one. TL;DR, I've built tensorflowjs_converter from source and am attempting to convert a SavedModel for use with tf.js.

Running this command:
tensorflowjs_converter --input_format=tf_saved_model --output_format=tfjs_graph_model \
  --saved_model_tags=serve tfjs_model_test1 tfjs_model_test1.js

Results in the following error:
2019-04-01 12:38:18.798130: E tensorflow/core/grappler/grappler_item_builder.cc:636] Init node layer1/kernel/Assign doesn't exist in graph

I suspect that I'm holding it wrong, in which case, would someone correct me? In particular, the version I'd used previously (version 0.8, installed via pip) was able to convert this kind of model without issue.

Here's the detailed background: In Python, I'm using Tensorflow version 1.13.1, and I've compiled the converter at github HEAD (currently commit 57ba1a5f6e). I'm using recent sources because I have models that make use of ops that don't work with the previous release - at least one is implemented in a pull request that has yet to be merged (conv3d conversion). That said, for simplicity's sake, I'm using just a handful of conv2d layers for my current experiment. 

Thanks for any help!

Larry


--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tf...@tensorflow.org.

Daniel Smilkov

unread,
Apr 10, 2019, 12:53:15 PM4/10/19
to Erwin Carpio, Ping Yu, Shanqing Cai, TensorFlow.js Discussion, Nikhil Thorat, Larry Lindsey
+Ping Yu +Shanqing Cai

The tf-nightly-2.0-preview has lots of versions: https://pypi.org/project/tf-nightly-2.0-preview/#history

The converter right now asks for anything >= 2.0.0.dev20190304 . What version do you currently have in your virtual env. Can you try to install/upgrade to a newer nightly-2.0-preview in your virtual env? Hope this helps.

Daniel


To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.

Ping Yu

unread,
May 1, 2019, 5:49:32 PM5/1/19
to Daniel Smilkov, Erwin Carpio, Larry Lindsey, Nikhil Thorat, Shanqing Cai, TensorFlow.js Discussion
Hi Larry

To follow up on your issues, we have identified the bug in grappler that fails the TF v1 reference variables, but there is a work around, adding following line to your python script could make grappler happy.

tf.enable_resource_variables()

This would use resources variable instead of reference variable, let me know if it works for you.

Thanks

Ping

Larry Lindsey

unread,
May 1, 2019, 5:53:42 PM5/1/19
to Ping Yu, Daniel Smilkov, Erwin Carpio, Nikhil Thorat, Shanqing Cai, TensorFlow.js Discussion
Oh, great, thanks for the follow up! I'll give that a shot and let you know what happens.

Daniel Smilkov

unread,
May 3, 2019, 12:06:16 PM5/3/19
to Larry Lindsey, Ping Yu, Erwin Carpio, Nikhil Thorat, Shanqing Cai, TensorFlow.js Discussion
Larry, curious if this fixed your problem. 

Ping, I filed https://github.com/tensorflow/tfjs/issues/1569 to track when TF nightly (Grappler) fixes this so we don't forget to update the requirements.txt in python to depend on the nightly version that has the fix.
 
Daniel

Larry Lindsey

unread,
May 3, 2019, 1:03:45 PM5/3/19
to Daniel Smilkov, Ping Yu, Erwin Carpio, Nikhil Thorat, Shanqing Cai, TensorFlow.js Discussion
I'll let you all know - right now I'm in a crunch to iterate on a manuscript, but I expect to be free from that early next week. Thanks for the help!
Reply all
Reply to author
Forward
0 new messages