推断失败没有名为“ saved_model”的模块

时间:2018-12-09 13:31:51

标签: python-3.x tensorflow opennmt

我正在使用opennmt-tf训练神经机器翻译模型。培训过程中写了一个模型光盘,我想使用该模型进行一些翻译,以查看输出是什么。

我尝试通过此命令使用模型

onmt-main infer --features_file dummyIn.txt 
                --model run/export/latest/1544360647/saved_model.pb 
                --config default.yml

导致此错误:

WARNING:tensorflow:You provided a model configuration but a checkpoint already exists. The model configuration must define the same model as the one used for the initial training. However, you can change non structural values like dropout.
Traceback (most recent call last):
  File "/usr/local/bin/onmt-main", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/opennmt/bin/main.py", line 143, in main
    serialize_model=is_chief)
  File "/usr/local/lib/python3.5/dist-packages/opennmt/config.py", line 101, in load_model
    model = load_model_from_file(model_file)
  File "/usr/local/lib/python3.5/dist-packages/opennmt/config.py", line 44, in load_model_from_file
    module = load_model_module(path)
  File "/usr/local/lib/python3.5/dist-packages/opennmt/config.py", line 27, in load_model_module
    module = import_module(module_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'saved_model'

我不确定如何解释此错误-模型显然在指定的位置。

0 个答案:

没有答案