0

Rasa NLU 版本(例如0.7.3):rasa-nlu-0.11.3

使用的后端/管道:spacy_sklearn

操作系统:Windows 10

问题:我正在尝试按照 rasa 网站中所述的示例代码进行培训。

from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer

training_data = load_data('data/examples/rasa/demo-rasa.json')
trainer = Trainer(RasaNLUConfig("sample_configs/config_spacy.json"))
trainer.train(training_data)
model_directory = trainer.persist('./projects/default/')  

但我无法从 rasa_nlu.training_data 中找到 load_data 函数,因此,出现以下错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-07f2f1a6c2ac> in <module>()
----> 1 from rasa_nlu.training_data import load_data
      2 from rasa_nlu.config import RasaNLUConfig
      3 from rasa_nlu.model import Trainer

ImportError: cannot import name 'load_data'

有人可以帮帮我吗?

4

2 回答 2

7

使用from rasa_nlu.converters import load_data而不是from rasa_nlu.training_data import load_data

http://rasa-nlu.readthedocs.io/en/latest/python.html

https://nlu.rasa.ai/0.11.3/python.html

于 2018-03-09T09:53:41.567 回答
1

解决方案

from rasa.shared.nlu.training_data.loading import load_data

更多信息:https ://github.com/RasaHQ/rasa/issues/1536

于 2020-11-17T20:56:09.837 回答