Skip to content

Commit

Permalink
Remove broken version checking completely. We will assume that TF 1.7…
Browse files Browse the repository at this point in the history
… is already in wide adoption.

PiperOrigin-RevId: 205805576
  • Loading branch information
TensorFlow Hub Authors authored and vbardiovskyg committed Jul 24, 2018
1 parent 61896cd commit 174adaf
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tensorflow_hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,9 @@
from __future__ import division
from __future__ import print_function

import re
import sys

import tensorflow as tf


# TensorFlow Hub depends on features not yet present in a stable TensorFlow
# release. Until then, we will explicitly check tf.VERSION to make this clear.
def _check_tensorflow_version(version):
# If this is a nightly version, check that it has the last needed bug fixes
# from TensorFlow.
_NIGHTLY_VERSION = "20180308" # pylint: disable=invalid_name
match = re.search("dev(20[0-9]{6})", version)
if match:
if match.group(1) >= _NIGHTLY_VERSION:
return

# If this is not a nightly version assume it is a pre-release or stable
# version and check only major.minor.
_MAIN_VERSION = "1.7" # pylint: disable=invalid_name
match = re.search("^([0-9]+.[0-9]+)", version)
if match:
if match.group(1) >= _MAIN_VERSION:
return

raise RuntimeError(
"TensorFlow Hub depends on 'tf-nightly' build after %s or "
"'tensorflow~=%s'. Found tf.VERSION = %s" % (
_NIGHTLY_VERSION, _MAIN_VERSION, version))

# Comment/uncomment to skip checking the TensorFlow version.
_check_tensorflow_version(tf.VERSION)


# pylint: disable=g-import-not-at-top
# Only do imports after check TensorFlow version so the useful
# error message is thrown instead of an obscure error of missing
Expand Down

0 comments on commit 174adaf

Please sign in to comment.