【问题标题】:Unknown intent found, while trying to train model using rest api尝试使用 rest api 训练模型时发现未知意图
【发布时间】:2020-09-28 12:01:26
【问题描述】:

我试图制作一个面板,用户可以通过该面板使用 REST API 训练模型。但是在使用为训练模型提供的 API 时,我遇到了“发现未知意图”的问题。以下是我尝试过的代码

const json2md = require("json2md");

fs.writeFileSync('./domain.yml', params.domain2)
fs.writeFileSync('./responses.yml', params.responses2)
fs.writeFileSync('./nlu.md', json2md(params.nlu.data));
fs.writeFileSync('./stories.md', json2md(params.stories.data));

let req_domain = await processLineByLine('domain.yml');
let req_response = await processLineByLine('responses.yml');
let req_nlu = await processLineByLine('nlu.md');
let req_stories = await processLineByLine('stories.md');
let req_config = await processLineByLine(path.join(__dirname,'../../../../', 'public/apiDocsV1', 'config.yml'));

async function processLineByLine(fileName) {
  const fileStream = fs.createReadStream(fileName);

  const rl = readline.createInterface({
      input: fileStream,
      crlfDelay: Infinity
  });

  let arr = [];
  for await (const line of rl) {
      arr.push(line + '\n');
  }
  return arr.join('')

}

await axios.post('http://localhost:5002/model/train', {
    domain: req_domain,
    config: req_config,
    nlu: req_nlu,
    responses: req_response,
    stories: req_stories,
    force: false,
    save_to_default_model_directory: true
});

这是来自 rasa 端点的屏幕截图 screenshot

文件看起来不错,甚至域文件也不错,但无法创建和训练模型。请帮忙

【问题讨论】:

  • 如果您查看错误的结尾,看起来好像没有找到有效的域文件,这意味着您的域可能没有正确加载。您是否打印了req_domain 包含的内容?也许它没有正确呈现。您能否使用该域文件在本地训练您的模型?

标签: node.js python-3.x rasa-nlu rasa rasa-core


【解决方案1】:

domain.yml 文件的格式似乎不正确。使用站点https://www.yamllint.com检查YML格式是否正确。我可以从截图中看到错误Invalid domain file

【讨论】:

    猜你喜欢
    • 2021-03-26
    • 1970-01-01
    • 2022-01-26
    • 2018-11-23
    • 2022-06-17
    • 2022-01-12
    • 2016-01-11
    • 2017-08-19
    • 2017-07-31
    相关资源
    最近更新 更多