无法使用Rasa NLU / Sklearn训练新模型

问题描述 投票:0回答:1

我正在我的应用程序和Rasa NLU服务器之间构建一个中间件,可以简化不同的任务,如创建模型或更新...

我主要的目的是构建一个模型并每次使用一个函数来更新它,该函数将一个示例添加到旧模型中,因此只需添加一个示例并将其再次提交给Rasa服务器即可将旧数据更新。

这是场景: 首先,我首先创建一个空模型,然后向localhost:5000/train?project=defaults&fixed_model_name=model1发送一个帖子请求 有这些数据

{
  "rasa_nlu_data": {
    "common_examples": [], 
    "entity_synonyms": [], 
    "regex_features": []
  }
}

所以我收到了这个回复:

“info”:“新模特训练:模特1”

然后我用相同的请求开始训练,但是包含新类greet的新数据

{
  "rasa_nlu_data": {
    "common_examples": [
      {
        "text": "hey", 
        "intent": "greet"
      }
    ], 
    "entity_synonyms": [], 
    "regex_features": []
  }
}

它的工作方式与我预期的一样,如果我从同一个类中添加一个例子,那么训练总能正常工作

{
  "rasa_nlu_data": {
    "common_examples": [
      {
        "text": "hey", 
        "intent": "greet"
      },{
        "text": "heyy", 
        "intent": "greet"
      }
    ], 
    "entity_synonyms": [], 
    "regex_features": []
  }
}

但是当我试图用这样的新的不同意图bye发布其他数据时

{
  "rasa_nlu_data": {
    "common_examples": [
      {
        "text": "hey", 
        "intent": "greet"
      },
       {
        "text": "heyy", 
        "intent": "greet"
      },
      {
        "text": "goodbye", 
        "intent": "bye"
      }
    ], 
    "entity_synonyms": [], 
    "regex_features": []
  }
}

我收到此错误:

“错误”:“班级数必须大于一;得到1”

如果我通过跳过第二步重做相同的场景,那么我的数据将是这样的:

{
  "rasa_nlu_data": {
    "common_examples": [
      {
        "text": "hey", 
        "intent": "greet"
      },
      {
        "text": "goodbye", 
        "intent": "bye"
      }
    ], 
    "entity_synonyms": [], 
    "regex_features": []
  }
}

提交后我收到此错误:

“error”:“n_splits = 2不能大于每个类中的成员数。”

我的Rasa NLU服务器配置:

我已经检查过那些可能与我的问题类似的问题,但那些不是我想要的 ValueError: The number of classes has to be greater than one (python) ValueError: Cannot have number of splits n_splits=3 greater than the number of samples: 1

我知道Rasa模型需要一些实体才能运行解析但我离这个很远我只是想先建立一个干净的模型

python scikit-learn rasa-nlu
1个回答
1
投票

Rasa NLU强制说你至少有两个每个意图的例子。虽然对于任何一种良好的性能,你应该有更多,不管怎样:)

© www.soinside.com 2019 - 2024. All rights reserved.