aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Andrew Selle <aselle@andyselle.com>2018-03-29 07:59:46 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2018-03-29 07:59:46 -0700
commit86868a156860877fc6e8c3393baf4942b6b7dbd4 (patch)
tree8afaf125e7663a8c7a77aaa4dc614befeda1aab7
parent481dca1987e030f9986ce16ae05142617d631641 (diff)
Disable the toco binary in pip feature until it can used shared libs (#18061)
* Disable the toco binary in pip feature until it can used shared libraries. The binary size was doubled by the saved model change. Since to process saved models most of the TensorFlow runtime is needed. A workaround to this is in the works and should be submitted in the next couple weeks. * Fix linter errors with unused tensorflow libs * Mollify the linter by removing os.
-rw-r--r--tensorflow/contrib/lite/toco/python/BUILD3
-rw-r--r--tensorflow/contrib/lite/toco/python/toco_wrapper.py13
-rwxr-xr-xtensorflow/tools/pip_package/build_pip_package.sh4
3 files changed, 12 insertions, 8 deletions
diff --git a/tensorflow/contrib/lite/toco/python/BUILD b/tensorflow/contrib/lite/toco/python/BUILD
index 17115047d2..86d91bd3be 100644
--- a/tensorflow/contrib/lite/toco/python/BUILD
+++ b/tensorflow/contrib/lite/toco/python/BUILD
@@ -45,9 +45,6 @@ py_binary(
name = "toco_wrapper",
srcs = ["toco_wrapper.py"],
srcs_version = "PY2AND3",
- deps = [
- "//tensorflow:tensorflow_py",
- ],
)
tf_py_test(
diff --git a/tensorflow/contrib/lite/toco/python/toco_wrapper.py b/tensorflow/contrib/lite/toco/python/toco_wrapper.py
index e39b5f22c7..6d6b500d7e 100644
--- a/tensorflow/contrib/lite/toco/python/toco_wrapper.py
+++ b/tensorflow/contrib/lite/toco/python/toco_wrapper.py
@@ -22,14 +22,19 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
import sys
-import tensorflow as tf
def main():
# Pip installs the binary in aux-bin off of main site-package install.
# Just find it and exec, passing all arguments in the process.
# TODO(aselle): it is unfortunate to use all of tensorflow to lookup binary.
- binary = os.path.join(tf.__path__[0], 'aux-bin/toco')
- os.execvp(binary, sys.argv)
+ print("""TOCO from pip install is currently not working on command line.
+Please use the python TOCO API or use
+bazel run tensorflow/contrib/lite:toco -- <args> from a TensorFlow source dir.
+""")
+ sys.exit(1)
+ # TODO(aselle): Replace this when we find a way to run toco without
+ # blowing up executable size.
+ # binary = os.path.join(tf.__path__[0], 'aux-bin/toco')
+ # os.execvp(binary, sys.argv)
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
index dc31e4c5f7..feb3114bde 100755
--- a/tensorflow/tools/pip_package/build_pip_package.sh
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -139,7 +139,9 @@ function main() {
fi
mkdir "${TMPDIR}/tensorflow/aux-bin"
# Install toco as a binary in aux-bin.
- cp bazel-bin/tensorflow/contrib/lite/toco/toco ${TMPDIR}/tensorflow/aux-bin/
+ # TODO(aselle): Re-enable this when we find a way to do it without doubling
+ # the whl size (over the limit).
+ # cp bazel-bin/tensorflow/contrib/lite/toco/toco ${TMPDIR}/tensorflow/aux-bin/
fi
# protobuf pip package doesn't ship with header files. Copy the headers