使用RASA NLU训练模型时的Tensorflow错误

时间:2019-03-23 12:41:43

标签: python tensorflow keras rasa-nlu

我正在使用RASA NLU。在训练机器人的过程中,我遇到了以下异常L

a. ImportError: No module named '_pywrap_tensorflow_internal'
b. Failed to load the native TensorFlow runtime.

和堆栈跟踪中的很多错误,正如文章末尾所见。

以下是我用于python 3.6.8的不同模块的版本摘要:

tensorboard                        1.8.0
rasa-core                          0.10.1
rasa-nlu                           0.13.0a2
Keras                              2.1.6

我确保将训练域yaml放在正确的位置,并且没有错误。

堆栈跟踪:

\ML-Python\RASA\Rasa_basic_folder>python ./train_init.py
F:\Anaconda-32bit\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
  File "F:\Anaconda-32bit\lib\imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./train_init.py", line 19, in <module>
    agent = Agent('./restaurant_domain.yml', policies = [MemoizationPolicy(max_history = 4), KerasPolicy(featurizer)])
  File "c:\python27\scripts\rasa_core-master\rasa_core\policies\keras_policy.py", line 47, in __init__
    if KerasPolicy.is_using_tensorflow() and not graph:
  File "c:\python27\scripts\rasa_core-master\rasa_core\policies\keras_policy.py", line 64, in is_using_tensorflow
    from keras.backend import _BACKEND
  File "F:\Anaconda-32bit\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "F:\Anaconda-32bit\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils
  File "F:\Anaconda-32bit\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "F:\Anaconda-32bit\lib\site-packages\keras\backend\__init__.py", line 84, in <module>
    from .tensorflow_backend import *
  File "F:\Anaconda-32bit\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
  File "F:\Anaconda-32bit\lib\imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
  from tensorflow.python.pywrap_tensorflow_internal import *
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

2 个答案:

答案 0 :(得分:0)

似乎没有正确安装tensorflow。请尝试使用pip install -U rasa-core重新安装rasa-core,甚至更新到新的rasa软件包,该软件包结合了rasa-nlu和rasa-core(旧的rasa-corerasa-nlu软件包已弃用)。您可以执行pip install rasa

答案 1 :(得分:0)

为您解决这些张量流依赖性-请参阅下文。

pip install rasa[convert]