张量流集线器错误"cannot import name 'MomentumParameters' from 'tensorflow.python.tpu.tpu_embedding' "



在jupyter笔记本电脑上尝试使用tensforflow集线器时,我安装了最新的tensorflow。但是,当我尝试导入tensorflow_hubimport tensorflow_hub as hub时,我遇到了一个错误:ImportError:无法从"tensorflow.python.tpu.tpu_embedding"(C:\Users\vedan\anaconda3\lib\site packages\tensorflow\python\tpu\tpu_embedding.py(导入名称"MomentumParameters">

我已经尝试使用conda install -c anaconda tensorflow-hub在anaconda cmd上安装tensorflow集线器,并使用!pip install --upgrade tensorflow-hub在jupyter上安装tensorflow集线器

这是的全部错误

ImportError                               Traceback (most recent call last)
<ipython-input-14-5c017171c13e> in <module>
----> 1 import tensorflow_hub as hub
~anaconda3libsite-packagestensorflow_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
~anaconda3libsite-packagestensorflow_hubestimator.py in <module>
60 
61 
---> 62 class LatestModuleExporter(tf.compat.v1.estimator.Exporter):
63   """Regularly exports registered modules into timestamped directories.
64 
~anaconda3libsite-packagestensorflowpythonutillazy_loader.py in __getattr__(self, item)
60 
61   def __getattr__(self, item):
---> 62     module = self._load()
63     return getattr(module, item)
64 
~anaconda3libsite-packagestensorflowpythonutillazy_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 
~anaconda3libimportlib__init__.py in import_module(name, package)
125                 break
126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
128 
129 
~anaconda3libsite-packagestensorflow_estimatorpythonestimatorapi_v1estimator__init__.py in <module>
8 import sys as _sys
9 
---> 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
~anaconda3libsite-packagestensorflow_estimator__init__.py in <module>
8 import sys as _sys
9 
---> 10 from tensorflow_estimator._api.v1 import estimator
11 
12 del _print_function
~anaconda3libsite-packagestensorflow_estimator_apiv1estimator__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
~anaconda3libsite-packagestensorflow_estimator_apiv1estimatortpu__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
~anaconda3libsite-packagestensorflow_estimator_apiv1estimatortpuexperimental__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
~anaconda3libsite-packagestensorflow_estimatorpythonestimatortpu_tpu_estimator_embedding.py in <module>
33 from tensorflow.python.tpu.tpu_embedding import AdamParameters
34 from tensorflow.python.tpu.tpu_embedding import FtrlParameters
---> 35 from tensorflow.python.tpu.tpu_embedding import MomentumParameters
36 from tensorflow.python.tpu.tpu_embedding import RMSPropParameters
37 from tensorflow.python.tpu.tpu_embedding import StochasticGradientDescentParameters
ImportError: cannot import name 'MomentumParameters' from 'tensorflow.python.tpu.tpu_embedding' (C:Usersvedananaconda3libsite-packagestensorflowpythontputpu_embedding.py)

我将TensorFlow集线器降级到2.3版(与我的tf GPU相同(及其工作

最新更新