我在运行python文件以使用rasa nlu训练文件时在命令提示符下收到此错误

我目前正在使用Windows 10
rasa_core == 0.8.2
rasa_nlu == 0.11.4
python 3.6.7
PS:我降低了rasa和python的级别,因为rasa的最新版本中的模块名称已更改,而python 3.8分别不支持rasa。

我是编码的新手。我很想在这里获得一些帮助。

**Traceback (most recent call last):

  File "nlu_model.py", line 12, in <module>

    train_nlu('./data/data.json', 'config_spacy.json', './models/nlu')

  File "nlu_model.py", line 6, in train_nlu

    training_data = load_data(data)

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\converters.py", line 365, in load_data

    return load_rasa_data(files)

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\converters.py", line 267, in load_rasa_data

    validate_rasa_nlu_data(data)

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\converters.py", line 253, in validate_rasa_nlu_data

    raise error

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\converters.py", line 248, in validate_rasa_nlu_data

    validate(data, rasa_nlu_data_schema())

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\jsonschema\validators.py", line 541, in validate

    cls(schema, *args, **kwargs).validate(instance)

  File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\jsonschema\validators.py", line 130, in validate

    raise error

jsonschema.exceptions.ValidationError: 'start' is a required property. Failed to validate training data, make sure your data is valid. For more information about the format visit https://rasahq.github.io/rasa_nlu/dataformat.html

Failed validating 'required' in schema['properties']['rasa_nlu_data']['properties']['common_examples']['items']['properties']['entities']['items']:
    {'properties': {'end': {'type': 'number'},
                    'entity': {'type': 'string'},
                    'start': {'type': 'number'},
                    'value': {'type': 'semphasized texttring'}},
     'required': ['start', 'end', 'entity'],**strong text**
     'type': 'object'}

On instance['rasa_nlu_data']['common_examples'][3]['entities'][1]:
    {'entities': [], 'intent': 'goodbye', 'text': 'Thank you for your help'}**

最佳答案

看起来您正在使用版本过早的Rasa,版本早于1.0
最新版本是1.7.0

您可以找到有关升级here的说明

您可以尝试升级Rasa再试一次吗?

关于python - 无法验证架构中的 'required'。,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59738939/

10-08 21:42