首页 > 解决方案 > ImportError:无法为 RASA 交互式学习导入名称“style_from_dict”。提示工具包版本不兼容

问题描述

我正在尝试使用 Jupyter notebook 在 Rasa Core 中使用交互式学习来训练对话流程。

代码片段:

### interactive learning 
import logging
from rasa_core import utils, train
from rasa_core.training import interactive

logger = logging.getLogger(__name__)

def train_agent():
    return train.train_dialogue_model(domain_file="domain.yml",
                                      stories_file="data/stories.md",
                                      output_path="models/dialogue",
                                      policy_config='policy_config.yml'
                                      )

if __name__ == '__main__':
    utils.configure_colored_logging(loglevel="INFO")
    agent = train_agent()
    logger.info("This example does not include NLU data."
                "Please specify the desired intent with a preceding '/', e.g."
                "'/greet' .")
    interactive.run_interactive_learning(agent)

最初我得到:

“找不到令牌错误”指向“从 prompt_toolkit.token 导入令牌”

我降级prompt_toolkit==1.0.14并尝试运行代码。

得到:

ImportError:无法导入名称'style_from_dict'

我觉得prompt_toolkitinrasa-coreipython. 目前使用rasa-core==0.12.3ipython==7.2.0

我需要降级IPython吗?请建议。

标签: pythonjupyter-notebookimporterrorchatbotrasa-core

解决方案


降级到 ipython 6.0.0 后,错误得到解决。


推荐阅读