def can_train(): tf_found = importlib.util.find_spec('tensorflow') available_backends = [] if tf_found: # thanks to https://github.com/pydata/pandas/issues/2841 import warnings warnings.simplefilter(action='ignore', category=FutureWarning) from tensorflow import __version__ as tfv required = "1.6.0" # only require major and minor release number as the patch number may contain 'rc' etc if versiontuple(tfv, 2) >= versiontuple(required, 2): available_backends.append("tensorflow") # return available_backends # removing plain tensorflow from deeprace for now, TFv1 API is just too hard to master under time constraints return []
def can_train(): import warnings warnings.simplefilter(action='ignore', category=FutureWarning) keras_found = importlib.util.find_spec('keras') available_backends = [] if keras_found: from keras import __version__ as kv max_version = "2.2.4" min_version = "2.1.0" if versiontuple(kv, 3) >= versiontuple(min_version, 3) and versiontuple(kv, 3) <= versiontuple(max_version, 3): available_backends.append("keras") else: logging.debug("your keras version %s is not supported (%s - %s)", str(kv), min_version, max_version) return available_backends
def can_train(): import warnings warnings.simplefilter(action='ignore', category=FutureWarning) tf_found = importlib.util.find_spec('tensorflow') available_backends = [] if tf_found: import tensorflow as tf tf_version = tf.__version__ tfkeras_version = tf.keras.__version__ tfkeras_clean_version = tf.keras.__version__.replace("-tf", "") min_version = "2.1.0" if versiontuple(tfkeras_clean_version, 3) >= versiontuple( min_version, 3): available_backends.append("tensorflow.keras") else: logging.debug("your keras version %s is not supported (%s - %s)", str(kv), min_version, max_version) return available_backends