我正在关注一本书中的代码,并在尝试运行在线培训时遇到了这个错误。
完整的错误是:
回溯(最近一次通话最后):文件“train_online.py”,第 9 行,从 rasa_core.training 导入在线 ImportError:无法从 'rasa_core.training' 导入名称 'online' (C:\Users\Max\AppData\Local \Programs\Python\Python37\lib\site-packages\rasa_core\training__init__.py)
我的代码是:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from rasa_core import utils, train
from rasa_core.training import online
from rasa_core.interpreter import NatraulLanguageInterpreter
logger = logging.getLogger(__name__)
def train_agent(interpreter):
return train.train_dialog_model(domain_file="horoscope_domain.yml",
stories_file="data/stories.md", output_path="models/dialog",
nlu_model_path=interpreter, endpoints="endpoints.yml", max_history=2, kwargs=
{"batch_size": 50, "epochs": 200, "max_training_samples": 300})
if __name__ == '__main__':
utils.configure_colored_logging(loglevel='DEBUG')
nlu_model_path = "'/models/nlu/default/horoscopebot"
interpreter = NatraulLanguageInterpreter.create(nlu_model_path)
agent = train_agent(interpreter)
online.serve_agent(agent)