首页 > 解决方案 > rasa_nlu.model.UnsupportedModelError:模型版本太旧,无法由此 Rasa NLU 实例加载

问题描述

我正在使用 rasa 构建一个聊天机器人。文件中train_online.py有错误。

我移至最新版本的 rasa_nlu==0.15.1 但仍然收到错误消息。

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 NaturalLanguageInterpreter
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 = "/home/zain/models/dialogue"
    interpreter = NaturalLanguageInterpreter.create(nlu_model_path)
    agent = train_agent(interpreter)
    online.serve_agent(agent)

这是错误

"".format(model_version, rasa_nlu.version )) rasa_nlu.model.UnsupportedModelError:模型版本太旧,无法由这个​​ Rasa NLU 实例加载。重新训练模型,或使用旧版本运行。模型版本:0.0.0 实例版本:0.15.0

标签: pythonmachine-learningrasa-nlu

解决方案


您的 RASA 版本似乎早于 0.15。您可以通过使用命令重新训练模型来解决此问题

python -m rasa_core.train -d domain.yml -s data/stories.md \
  -o models/current/dialogue -c config.yml 

但我建议您迁移到 RASA 1.2.4 版。有很多变化,让我们更容易使用 RASA。我最近从版本 0.14.1 迁移到 1.2.4,它让我受益匪浅。

如果您希望使用 0.15 版,请使用此链接获取 RASA 文档。否则,您可以在此处查看最近的 RASA 文档。


推荐阅读