Fixed Trackable import. (#21429)

This commit is contained in:
Anastasiia Pnevskaia 2023-12-04 09:25:41 +01:00 committed by GitHub
parent c759f8df86
commit 525c031959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -352,7 +352,11 @@ def extract_model_graph(argv):
from tensorflow.python.training.tracking.base import Trackable # pylint: disable=no-name-in-module,import-error
trackable_is_imported = True
except:
log.warning("Could not import tensorflow.python.training.tracking.base.Trackable type.")
try:
from tensorflow.python.trackable.base import Trackable
trackable_is_imported = True
except:
log.warning("Could not import tensorflow.python.training.tracking.base.Trackable type.")
env_setup = get_environment_setup("tf")
if isinstance(model, tf.Graph):
return True