我该如何修复“没有名为tensorflow.python.saved_model.model_utils的模块”

时间:2019-04-15 06:50:37

标签: python tensorflow

我安装了tensorflow和luminoth用于表格检测。

在此命令中,我用于训练过程

lumi dataset transform --type csv --data-dir data/ --output-dir tfdata/ --split train.csv --split val.csv --only-classes=table"

系统显示1

Traceback (most recent call last):
  File "runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\WELCOME\AppData\Local\Programs\Python\Python35\Scripts\lumi.exe\__main__.py", line 5, in <module>
  File "site-packages\luminoth\__init__.py", line 30, in <module>
    from luminoth.cli import cli  # noqa
  File "site-packages\luminoth\cli.py", line 14, in <module>
    from luminoth.eval import eval
  File "site-packages\luminoth\eval.py", line 8, in <module>
    from luminoth.datasets import get_dataset
  File "site-packages\luminoth\datasets\__init__.py", line 1, in <module>
    from .datasets import get_dataset  # noqa
  File "site-packages\luminoth\datasets\datasets.py", line 3, in <module>
    from luminoth.datasets.object_detection_dataset import ObjectDetectionDataset
  File "site-packages\luminoth\datasets\object_detection_dataset.py", line 3, in <module>
    from luminoth.datasets.base_dataset import BaseDataset
  File "site-packages\luminoth\datasets\base_dataset.py", line 3, in <module>
    import sonnet as snt
  File "site-packages\sonnet\__init__.py", line 39, in <module>
    from sonnet.python import custom_getters
  File "site-packages\sonnet\python\custom_getters\__init__.py", line 21, in <module>
    from sonnet.python.custom_getters import bayes_by_backprop
  File "site-packages\sonnet\python\custom_getters\bayes_by_backprop.py", line 97, in <module>
    _OK_PZATION_TYPE = tf.contrib.distributions.FULLY_REPARAMETERIZED
  File "site-packages\tensorflow\python\util\lazy_loader.py", line 61, in __getattr__
    module = self._load()
  File "site-packages\tensorflow\python\util\lazy_loader.py", line 44, in _load
    module = importlib.import_module(self.__name__)
  File "importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "site-packages\tensorflow\contrib\__init__.py", line 40, in <module>
    from tensorflow.contrib import distribute
  File "site-packages\tensorflow\contrib\distribute\__init__.py", line 33, in <module>
    from tensorflow.contrib.distribute.python.tpu_strategy import TPUStrategy
  File "site-packages\tensorflow\contrib\distribute\python\tpu_strategy.py", line 27, in <module>
    from tensorflow.contrib.tpu.python.ops import tpu_ops
  File "site-packages\tensorflow\contrib\tpu\__init__.py", line 73, in <module>
    from tensorflow.contrib.tpu.python.tpu.keras_support import tpu_model as keras_to_tpu_model
  File "site-packages\tensorflow\contrib\tpu\python\tpu\keras_support.py", line 62, in <module>
    from tensorflow.contrib.tpu.python.tpu import tpu
  File "site-packages\tensorflow\contrib\tpu\python\tpu\tpu.py", line 24, in <module>
    from tensorflow.contrib.compiler import xla
  File "site-packages\tensorflow\contrib\compiler\xla.py", line 28, in <module>
    from tensorflow.python.estimator import model_fn as model_fn_lib
  File "site-packages\tensorflow\python\estimator\__init__.py", line 26, in <module>
    from tensorflow_estimator.python import estimator
  File "site-packages\tensorflow_estimator\python\estimator\__init__.py", line 25, in <module>
    import tensorflow_estimator.python.estimator.estimator_lib
  File "site-packages\tensorflow_estimator\python\estimator\estimator_lib.py", line 22, in <module>
    from tensorflow_estimator.python.estimator.canned.baseline import BaselineClassifier
  File "site-packages\tensorflow_estimator\python\estimator\canned\baseline.py", line 64, in <module>
    from tensorflow_estimator.python.estimator import estimator
  File "site-packages\tensorflow_estimator\python\estimator\estimator.py", line 66, in <module>
    from tensorflow_estimator.python.estimator import model_fn as model_fn_lib
  File "site-packages\tensorflow_estimator\python\estimator\model_fn.py", line 36, in <module>
    from tensorflow_estimator.python.estimator.export import export_lib
  File "site-packages\tensorflow_estimator\python\estimator\export\export_lib.py", line 25, in <module>
    from tensorflow.python.saved_model.model_utils import build_all_signature_defs
ImportError: No module named 'tensorflow.python.saved_model.model_utils'

如何解决此错误??

1 个答案:

答案 0 :(得分:1)

根据我发现的this GitHub comment错误信息,您可以通过卸载并重新安装tensorflow-estimator软件包来解决此问题:

pip uninstall tensorflow_estimator
pip install tensorflow_estimator

我认为这是软件包中的文件与其安装顺序有关的冲突。