0

I have a fully trained and saved Tensorflow model that I would like to load and use as a plug-in to a third party application (UCSF Chimera). This third party application runs on Python 2.7 which does not support Tensorflow. If even possible, is there a way for me to use this model at all in python 2.7?

I was originally looking at this previous post but it was for Java/C++.

Milo Lu
  • 3,176
  • 3
  • 35
  • 46

1 Answers1

1

First, save your Tensorflow model using pickle

with open("xxx.pkl", "wb") as outfile:
    pickle.dump(checkpointfile, outfile)

Second, install anaconda and create a python2.7 environment

Third, install tensorflow again in the python2.7 environment

conda install tensorflow

Fourth, read the model using pickle

pkl_file = open("xxx.pkl", "rb")
data = pickle.load(pkl_file, encoding="latin1")
Milo Lu
  • 3,176
  • 3
  • 35
  • 46
  • Once I have the model restored as you described can I run my test data through it with the usual command: `with tf.Session() as sess:` `output = sess.run([op_to_restore], feed_dict={x: X, y: Y})` Will this be acceptable once I have installed tensorflow using anaconda in the 2.7 environment? – Spencer Alexander Moritz Aug 13 '18 at 03:55