react-native-tensorflow icon indicating copy to clipboard operation
react-native-tensorflow copied to clipboard

Update tensorflow version, please

Open nikki-dzhurov opened this issue 7 years ago • 6 comments

I installed/linked the package but cannot run models that were built with tensorflow version > 1.3

Possible Unhandled Promise Rejection (id: 0): 05-26 21:42:48.749 6305 7014 W ReactNativeJS: Error: NodeDef mentions attr 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: conv1/Conv2D = Conv2D[T=DT_FLOAT, _output_shapes=[[64,48,48,96]], data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](random_shuffle_queue_DequeueMany:1, conv1/kernel/read). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

nikki-dzhurov avatar May 26 '18 21:05 nikki-dzhurov

This is b/c TensorFlow-experimental is currently at version 1.1. Currently, the only way to get a newer version of TF is to build it yourself

For now, your best be would be to use python virtual env and switch to TF 1.1 pip install --upgrade "tensorflow==1.1.0" then re-train your model

sparkison avatar Jun 04 '18 17:06 sparkison

Thanks for your response. I see your point, but I use some of the latest Tensorflow APIs. Unfortunately I cannot go back to version 1.1 so easily. I tried that with version 1.3 and it was a mess. (btw I use Android for testing and I saw that there are new java libraries. I thought it would be easy for update)

nikki-dzhurov avatar Jun 09 '18 09:06 nikki-dzhurov

Hello, I have the same problem: a trained model with TF 1.8.0 doesn't work with the package. Could you tell me which commit of 'tensorflow/models' work with TF 1.1.0 or how can I train a model with TF 1.1.0? Unfortunately repo tags starts from 1.4.0. Thank you.

coire1 avatar Jun 26 '18 09:06 coire1

See PR https://github.com/reneweb/react-native-tensorflow/pull/28

....I just realised, almost midnight here that I have only included Android. ooops. I'll check IOS tomorrow. Probably very similar small change.

shokimble avatar Jul 06 '18 22:07 shokimble

Ok IOS is a bigger problem.

As @sparkison pointed out the official cocoapod from Google is waaaaaaay out of date. Over a year old.

You have to build from scratch as also pointed out but doing this as part of a manual installation seems a bit out of the scope of this library. Another option is to release a new Cocoapod with the latest version on it. I'm going to do that as soon as I get around to creating the IOS version of the app I'm running on but Android is good enough for me for now.

Using a third party's Cocoapod does come with trust issues. I could release a version full of malware and as it comes as a tar bundle with compiled libs most people would be unaware. Not that I'm planning to do so but it's important to note. No worse than npm I suppose apart from it being extremely difficult to tell what's in a binary library.

What I propose to update my pull request with is a link to a cocoapod hosted on my git account and updated README to say exactly what I said above as a warning but offering it as an option with instructions.

shokimble avatar Jul 08 '18 10:07 shokimble

Yep, the problem here is iOS, as Google doesn't seem to update the Tensorflow iOS lib at all anymore and only updating Android would greatly diverge iOS vs Android and I would prefer to keep them as close together as possible. Also worth noting that eventually I would like to move to Tensorflow Lite as per #10 - unfortunately Tensorflow Lite is still pretty young and there are a few issues with integrating it with React Native

reneweb avatar Jul 22 '18 19:07 reneweb