Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Error: AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'monitoring' #1914

Open
qm-intel opened this issue Jul 18, 2022 · 0 comments

Comments

@qm-intel
Copy link

How to resolve this error?

I am running this code on Jupyter notebook.
I have imported tensor2tensor and tensorflow packages, however, this error arises. Can anyone assist what is the reason?

from tensor2tensor.data_generators.problem import Problem
...
ttributeError                            Traceback (most recent call last)
Input In [13], in <cell line: 11>()
      9 from sklearn.metrics import mean_squared_error
     10 from tensor2tensor.utils import contrib
---> 11 from tensor2tensor.data_generators.problem import Problem
     12 from tensor2tensor.data_generators.text_encoder import TokenTextEncoder
     13 from tqdm import tqdm

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensor2tensor/data_generators/problem.py:27, in <module>
     24 import random
     25 import six
---> 27 from tensor2tensor.data_generators import generator_utils
     28 from tensor2tensor.data_generators import text_encoder
     29 from tensor2tensor.utils import contrib

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensor2tensor/data_generators/generator_utils.py:1171, in <module>
   1166       break
   1167     return tmp_dir
   1170 def tfrecord_iterator_for_problem(problem, data_dir,
-> 1171                                   dataset_split=tf.estimator.ModeKeys.TRAIN):
   1172   """Iterate over the records on disk for the Problem."""
   1173   filenames = tf.gfile.Glob(problem.filepattern(data_dir, mode=dataset_split))

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow/python/util/lazy_loader.py:62, in LazyLoader.__getattr__(self, item)
     61 def __getattr__(self, item):
---> 62   module = self._load()
     63   return getattr(module, item)

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow/python/util/lazy_loader.py:45, in LazyLoader._load(self)
     43 """Load the module and insert it into the parent's globals."""
     44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
     46 self._parent_module_globals[self._local_name] = module
     48 # Emit a warning if one was specified

File ~/anaconda3/envs/tf-env/lib/python3.9/importlib/__init__.py:127, in import_module(name, package)
    125             break
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow_estimator/python/estimator/api/_v1/estimator/__init__.py:10, in <module>
      6 from __future__ import print_function as _print_function
      8 import sys as _sys
---> 10 from tensorflow_estimator.python.estimator.api._v1.estimator import experimental
     11 from tensorflow_estimator.python.estimator.api._v1.estimator import export
     12 from tensorflow_estimator.python.estimator.api._v1.estimator import inputs

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow_estimator/__init__.py:10, in <module>
      6 from __future__ import print_function as _print_function
      8 import sys as _sys
---> 10 from tensorflow_estimator._api.v1 import estimator
     12 del _print_function
     14 from tensorflow.python.util import module_wrapper as _module_wrapper

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow_estimator/_api/v1/estimator/__init__.py:13, in <module>
     11 from tensorflow_estimator._api.v1.estimator import export
     12 from tensorflow_estimator._api.v1.estimator import inputs
---> 13 from tensorflow_estimator._api.v1.estimator import tpu
     14 from tensorflow_estimator.python.estimator.canned.baseline import BaselineClassifier
     15 from tensorflow_estimator.python.estimator.canned.baseline import BaselineEstimator

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow_estimator/_api/v1/estimator/tpu/__init__.py:14, in <module>
     12 from tensorflow_estimator.python.estimator.tpu.tpu_config import RunConfig
     13 from tensorflow_estimator.python.estimator.tpu.tpu_config import TPUConfig
---> 14 from tensorflow_estimator.python.estimator.tpu.tpu_estimator import TPUEstimator
     15 from tensorflow_estimator.python.estimator.tpu.tpu_estimator import TPUEstimatorSpec
     17 del _print_function

File ~/anaconda3/envs/tf-env/lib/python3.9/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py:108, in <module>
    105 _WRAP_INPUT_FN_INTO_WHILE_LOOP = False
    107 # Track the adoption of TPUEstimator
--> 108 _tpu_estimator_gauge = tf.compat.v2.__internal__.monitoring.BoolGauge(
    109     '/tensorflow/api/tpu_estimator',
    110     'Whether the program uses tpu estimator or not.')
    112 if ops.get_to_proto_function('{}_{}'.format(_TPU_ESTIMATOR,
    113                                             _ITERATIONS_PER_LOOP_VAR)) is None:
    114   ops.register_proto_function(
    115       '{}_{}'.format(_TPU_ESTIMATOR, _ITERATIONS_PER_LOOP_VAR),
    116       proto_type=variable_pb2.VariableDef,
    117       to_proto=resource_variable_ops._to_proto_fn,  # pylint: disable=protected-access
    118       from_proto=resource_variable_ops._from_proto_fn)  # pylint: disable=protected-access

AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'monitoring'

...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant