hub icon indicating copy to clipboard operation
hub copied to clipboard

Bug:cannot import name 'MomentumParameters' from 'tensorflow.python.tpu.tpu_embedding'

Open tomaslindstrom opened this issue 3 years ago • 0 comments

What happened?

I'm tryining to install Tensorflow hub on my local conda enviroment on my Windows computer.

I get the following error: ImportError: cannot import name 'MomentumParameters' from 'tensorflow.python.tpu.tpu_embedding' (D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow\python\tpu\tpu_embedding.py)

Relevant code

import tensorflow as tf
import tensorflow_datasets as tfds
import tensorflow_hub as hub
import matplotlib.pyplot as plt

Relevant log output

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-4eb2b794ab0e> in <module>
      1 import tensorflow as tf
      2 import tensorflow_datasets as tfds
----> 3 import tensorflow_hub as hub
      4 import matplotlib.pyplot as plt

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_hub\__init__.py in <module>
     86 
     87 
---> 88 from tensorflow_hub.estimator import LatestModuleExporter
     89 from tensorflow_hub.estimator import register_module_for_export
     90 from tensorflow_hub.feature_column import image_embedding_column

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_hub\estimator.py in <module>
     60 
     61 
---> 62 class LatestModuleExporter(tf.compat.v1.estimator.Exporter):
     63   """Regularly exports registered modules into timestamped directories.
     64 

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
     60 
     61   def __getattr__(self, item):
---> 62     module = self._load()
     63     return getattr(module, item)
     64 

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow\python\util\lazy_loader.py in _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
     47 

D:\Deep_learning\envs\Tensor2x\lib\importlib\__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_estimator\__init__.py in <module>
      8 import sys as _sys
      9 
---> 10 from tensorflow_estimator._api.v1 import estimator
     11 
     12 del _print_function

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py 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

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_estimator\_api\v1\estimator\tpu\__init__.py in <module>
      8 import sys as _sys
      9 
---> 10 from tensorflow_estimator._api.v1.estimator.tpu import experimental
     11 from tensorflow_estimator.python.estimator.tpu.tpu_config import InputPipelineConfig
     12 from tensorflow_estimator.python.estimator.tpu.tpu_config import RunConfig

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_estimator\_api\v1\estimator\tpu\experimental\__init__.py in <module>
      8 import sys as _sys
      9 
---> 10 from tensorflow_estimator.python.estimator.tpu._tpu_estimator_embedding import EmbeddingConfigSpec
     11 
     12 del _print_function

D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow_estimator\python\estimator\tpu\_tpu_estimator_embedding.py in <module>
     32 from tensorflow.python.tpu.tpu_embedding import AdamParameters
     33 from tensorflow.python.tpu.tpu_embedding import FtrlParameters
---> 34 from tensorflow.python.tpu.tpu_embedding import MomentumParameters
     35 from tensorflow.python.tpu.tpu_embedding import ProximalAdagradParameters
     36 from tensorflow.python.tpu.tpu_embedding import RMSPropParameters

ImportError: cannot import name 'MomentumParameters' from 'tensorflow.python.tpu.tpu_embedding' (D:\Deep_learning\envs\Tensor2x\lib\site-packages\tensorflow\python\tpu\tpu_embedding.py)

tensorflow_hub Version

0.12.0 (latest stable release)

TensorFlow Version

other (please specify)

Other libraries

Versions: tensorflow 2.2.0 pypi_0 pypi tensorflow-addons 0.13.0 pypi_0 pypi tensorflow-base 2.3.0 eigen_py38h75a453f_0
tensorflow-datasets 4.3.0 pypi_0 pypi tensorflow-estimator 2.2.0 pypi_0 pypi tensorflow-hub 0.12.0 pypi_0 pypi tensorflow-metadata 1.1.0 pypi_0 pypi tensorflowjs 3.4.0 pypi_0 pypi python 3.8.8

Python Version

3.x

OS

Windows

tomaslindstrom avatar May 04 '22 14:05 tomaslindstrom