如何在训练 rasa 时解决 domain.yml 中的错误

How to solve error in domain.yml while training rasa

在 运行 rasa train 时,我收到一个错误,它自动采用一个空的 domain.yml 而不是我想要选择的 .yml 文件。该错误表明存在重复键。

C:\Users\nitik\rasabot>rasa train c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\utils\common.py:351: UserWarning: Loading domain from 'domain.yml' failed. Using empty domain. Error: 'The provided yaml file contains a duplicated key: 'while constructing a mapping in "", line 25, column 3 found duplicate key "-text" with value "Hi.My name is medicare locator. How can I help you today ?" (original value: "Hello. I am a medicare locator. I can help you find nearest hospital. How can I help ?") in "", line 43, column 3

To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

Duplicate keys will become an error in future releases, and are errors by default when using the new API. '. You can use http://www.yamllint.com/ to validate the yaml syntax of your file.' Training NLU model... 2020-04-01 01:32:49 INFO
rasa.nlu.training_data.training_data - Training data stats: - intent examples: 56 (9 distinct intents) - Found intents: 'affirm', 'search_provider', 'greet', 'goodbye', 'mood_great', 'inform', 'bot_challenge', 'deny', 'mood_unhappy' - Number of response examples: 0 (0 distinct response) - entity examples: 13 (2 distinct entities) - found entities: 'facility_type', 'location'

2020-04-01 01:32:49 INFO rasa.nlu.model - Starting to train component WhitespaceTokenizer 2020-04-01 01:32:49 INFO
rasa.nlu.model - Finished training component. 2020-04-01 01:32:49 INFO rasa.nlu.model - Starting to train component RegexFeaturizer 2020-04-01 01:32:49 INFO rasa.nlu.model - Finished training component. 2020-04-01 01:32:49 INFO rasa.nlu.model - Starting to train component LexicalSyntacticFeaturizer 2020-04-01 01:32:49 INFO
rasa.nlu.model - Finished training component. 2020-04-01 01:32:49 INFO rasa.nlu.model - Starting to train component CountVectorsFeaturizer 2020-04-01 01:32:49 INFO rasa.nlu.model - Finished training component. 2020-04-01 01:32:49 INFO
rasa.nlu.model - Starting to train component CountVectorsFeaturizer 2020-04-01 01:32:49 INFO rasa.nlu.model - Finished training component. 2020-04-01 01:32:49 INFO rasa.nlu.model - Starting to train component DIETClassifier 2020-04-01 01:32:49.711102: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303) Epochs: 100%|█████████████████████████████████████████████████████| 100/100 [00:52<00:00, 2.52it/s, t_loss=1.835, i_loss=0.199, e_loss=0.026, i_acc=1.000, e_f1=0.938] 2020-04-02 22:40:45 INFO
rasa.utils.tensorflow.models - Finished training. 2020-04-02 22:40:46 INFO rasa.nlu.model - Finished training component. 2020-04-02 22:40:46 INFO rasa.nlu.model - Starting to train component EntitySynonymMapper 2020-04-02 22:40:46 INFO rasa.nlu.model - Finished training component. 2020-04-02 22:40:46 INFO
rasa.nlu.model - Starting to train component ResponseSelector 2020-04-02 22:40:46 INFO rasa.nlu.selectors.response_selector - Retrieval intent parameter was left to its default value. This response selector will be trained on training examples combining all retrieval intents. 2020-04-02 22:40:46 INFO rasa.nlu.model - Finished training component. 2020-04-02 22:40:55 INFO
rasa.nlu.model - Successfully saved model into 'C:\Users\nitik\AppData\Local\Temp\tmpy9i6wqpt\nlu' NLU model training completed. c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\utils\common.py:351: UserWarning: Loading domain from 'domain.yml' failed. Using empty domain. Error: 'The provided yaml file contains a duplicated key: 'while constructing a mapping in "", line 25, column 3 found duplicate key "-text" with value "Hi.My name is medicare locator. How can I help you today ?" (original value: "Hello. I am a medicare locator. I can help you find nearest hospital. How can I help ?") in "", line 43, column 3

To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

Duplicate keys will become an error in future releases, and are errors by default when using the new API. '. You can use http://www.yamllint.com/ to validate the yaml syntax of your file.' c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'greet' on line 2. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'search_provider' on line 4. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'thanks' on line 7. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'greet' on line 11. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'search_provider' on line 13. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'inform' on line 15. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'thanks' on line 18. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'greet' on line 22. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'mood_great' on line 24. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'greet' on line 28. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'mood_unhappy' on line 30. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'affirm' on line 33. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'greet' on line 37. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'mood_unhappy' on line 39. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'deny' on line 42. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'goodbye' on line 46. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, c:\users\nitik\appdata\local\programs\python\python37\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent 'bot_challenge' on line 50. Please, make sure that all intents are listed in your domain yaml.
docs=DOCS_URL_DOMAINS, Your Rasa model is trained and saved at 'C:\Users\nitik\rasabot\models\nlu-20200402-224056.tar.gz'. Core training was skipped because no valid domain file was found. Only an nlu-model was created.Please specify a valid domain using '--domain' argument or check if the provided domain file exists.

您的 domain.yml 不是有效的 YAML 文件,因此 Rasa 无法使用它,而是从一个空文件开始。

转到http://www.yamllint.com/并粘贴你的domain.yml的内容,你可以很容易地验证它并找到error/inconsistency(有时它只是缩进,但看起来你有一些重复读取错误跟踪)。