1

我正在尝试从 Python 测试 rasa 并且出现错误,不知道我做错了什么。

这是我的 metadata.json 文件

{
    "intent_classifier": "./model_20170206-173042/intent_classifier.pkl", 
    "entity_extractor": "./model_20170206-173042/ner", 
    "trained_at": "20170206-173042", 
    "training_data": "./model_20170206-173042/training_data.json", 
    "language_name": "en", 
    "feature_extractor": null, 
    "backend": "spacy_sklearn"
}

这是我的 test.py 文件

from rasa_nlu.interpreters.spacy_sklearn_interpreter import SpacySklearnInterpreter
import json
metadata = json.loads(open('./model_20170206-173042/metadata.json').read())
interpreter = SpacySklearnInterpreter(**metadata)
interpreter.parse("How do I pay")
interpreter.parse("how can I pay")

这是错误的回溯

Traceback (most recent call last):
  File "/Users/me/proj/raasa/test.py", line 4, in <module>
    interpreter = SpacySklearnInterpreter(**metadata)
  File "build/bdist.macosx-10.12-intel/egg/rasa_nlu/interpreters/spacy_sklearn_interpreter.py", line 15, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1217, in load_build
    setstate(state)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/ma/core.py", line 5518, in __setstate__
    ndarray.__setstate__(self, (shp, typ, isf, raw))

TypeError: object pickle not returning list

元数据文件有什么问题还是解释器有问题?

4

0 回答 0