paschmann / rasa-ui

Rasa UI is a frontend for the Rasa Framework
MIT License
957 stars 329 forks source link

Error training bot with docker-compose #214

Closed tomasbarcellos closed 4 years ago

tomasbarcellos commented 4 years ago

Describe the bug I'm not able to reproduce the bot from the rasa tutorial using the UI.

When I try to train the bot I got the following error message:

{"data":{
    "error":{
        "version":"1.4.0a1",
        "status":"failure",
        "message":"An unexpected error occurred during training. Error: stat: path should be string, bytes, os.PathLike or integer, not NoneType",
        "reason":"TrainingError",
        "details":{},
        "help":null,
        "code":500
        }
},
"status":500,
"config":{
   "method":"POST",
   "transformRequest":[null],
   "transformResponse":[null],
   "jsonpCallbackParam":"callback",
   "url":"/api/v2/rasa/model/train?bot_name=test&bot_id=2&comment=",
   "data":"{\"nlu\":\"## intent:mood_unhappy\\n- so sad\\n- extremely sad\\n- not very good\\n- terrible\\n- awful\\n- very bad\\n- bad\\n- unhappy\\n- very sad\\n- sad\\n## intent:mood_great\\n- I'm good\\n- I am great\\n- I am feeling very good\\n- wonderful\\n- amazing\\n- great\\n- very good\\n- perfect\\n## intent:deny\\n- not really\\n- no way\\n- don't like that\\n- I don't think so\\n- never\\n- no\\n## intent:affirm\\n- correct\\n- that sounds good\\n- of course\\n- indeed\\n- yes\\n## intent:goodbye\\n- see you later\\n- see you around\\n- goodbye\\n- bye\\n## intent:greet\\n- hey there\\n- good evening\\n- good morning\\n- hi\\n- hello\\n- hey\\n\\n\",\"domain\":\"intents:\\n- mood_unhappy\\n- mood_great\\n- deny\\n- affirm\\n- goodbye\\n- greet\\n\\ntemplates:\\n utter_goodbye:\\n - text: \\\"Bye\\\"\\n utter_happy:\\n - text: \\\"Great carry on!\\\"\\n utter_did_that_help:\\n - text: \\\"Did that help you?\\\"\\n utter_cheer_up:\\n - text: \\\"Here is something to cheer you up:\\\"\\n utter_greet:\\n - text: \\\"Hey! How are you?\\\"\\n\\nactions:\\n- utter_goodbye\\n- utter_happy\\n- utter_did_that_help\\n- utter_cheer_up\\n- utter_greet\",\"stories\":\"## say goodbye\\n* goodbye\\n - utter_goodbye## sad path 2\\n* greet\\n - utter_greet\\n* mood_unhappy\\n - utter_cheer_up\\n - utter_did_that_help\\n* deny\\n - utter_goodbye## sad path 1\\n* greet\\n - utter_greet\\n* mood_unhappy\\n - utter_cheer_up\\n - utter_did_that_help\\n* affirm\\n - utter_happy## happy path\\n* greet\\n - utter_greet\\n* mood_great\\n - utter_happy\",\"config\":\"# Configuration for Rasa NLU.\\n# https://rasa.com/docs/rasa/nlu/components/\\nlanguage: en\\npipeline: supervised_embeddings\\n\\n# Configuration for Rasa Core.\\n# https://rasa.com/docs/rasa/core/policies/\\npolicies:\\n - name: MemoizationPolicy\\n - name: KerasPolicy\\n - name: MappingPolicy\",\"out\":null,\"force\":\"false\"}",
   "headers":{
        "Accept":"application/json, text/plain, */*",
        "Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwibmFtZSI6IlBvcnRhbCBBZG1pbmlzdHJhdG9yIiwiaWF0IjoxNTY4NTEyMjA5fQ.nguQCl1Mh09tXNGOAu2XUFKZF_67ovSxYd1-dLMd73M",
        "Content-Type":"application/json;charset=utf-8"
    }
},
"statusText":"Internal Server Error",
"xhrStatus":"complete"}

In the server the logs were:

rasa_ui    | 2019-09-15 02:18:42.273|rasa-ui|info|Rasa NLU Train Request -> http://rasa:5005/model/train;
rasa       | 2019-09-15 02:18:42 DEBUG    rasa.nlu.training_data.loading  - Training data format of '/tmp/tmpc6sn7r1h/nlu.md' is 'md'.
rasa       | 2019-09-15 02:18:42 DEBUG    rasa.nlu.training_data.loading  - Training data format of '/tmp/tmpc6sn7r1h/nlu.md' is 'md'.
rasa       | 2019-09-15 02:18:42 DEBUG    rasa.server  - Traceback (most recent call last):
rasa       |   File "/usr/local/lib/python3.6/site-packages/rasa/server.py", line 674, in train
rasa       |     force_training=rjs.get("force", False),
rasa       |   File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
rasa       |     return self.gen.send(None)
rasa       |   File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 89, in train_async
rasa       |     kwargs,
rasa       |   File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
rasa       |     return self.gen.send(None)
rasa       |   File "/usr/local/lib/python3.6/site-packages/rasa/train.py", line 161, in _train_async_internal
rasa       |     old_model = model.get_latest_model(output_path)
rasa       |   File "/usr/local/lib/python3.6/site-packages/rasa/model.py", line 83, in get_latest_model
rasa       |     if not os.path.exists(model_path) or os.path.isfile(model_path):
rasa       |   File "/usr/local/lib/python3.6/genericpath.py", line 19, in exists
rasa       |     os.stat(path)
rasa       | TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
rasa       | 
rasa_ui    | 2019-09-15 02:18:42.407|rasa-ui|error|Error occured while training. Rasa Server Response Code : 500;

To Reproduce

It all started with

git clone https://github.com/paschmann/rasa-ui.git bug
sudo docker-compose -f bug/docker-compose.yml up

Then, with the aplication up and running, I have filled all the fields in the UI so that I would end up with the same bot as in the tutorial.

The Raw Traning Data is like this

{"nlu":"## intent:mood_unhappy\n- so sad\n- extremely sad\n- not very good\n- terrible\n- awful\n- very bad\n- bad\n- unhappy\n- very sad\n- sad\n## intent:mood_great\n- I'm good\n- I am great\n- I am feeling very good\n- wonderful\n- amazing\n- great\n- very good\n- perfect\n## intent:deny\n- not really\n- no way\n- don't like that\n- I don't think so\n- never\n- no\n## intent:affirm\n- correct\n- that sounds good\n- of course\n- indeed\n- yes\n## intent:goodbye\n- see you later\n- see you around\n- goodbye\n- bye\n## intent:greet\n- hey there\n- good evening\n- good morning\n- hi\n- hello\n- hey\n\n","domain":"intents:\n- mood_unhappy\n- mood_great\n- deny\n- affirm\n- goodbye\n- greet\n\ntemplates:\n  utter_goodbye:\n    - text: \"Bye\"\n  utter_happy:\n    - text: \"Great carry on!\"\n  utter_did_that_help:\n    - text: \"Did that help you?\"\n  utter_cheer_up:\n    - text: \"Here is something to cheer you up:\"\n  utter_greet:\n    - text: \"Hey! How are you?\"\n\nactions:\n- utter_goodbye\n- utter_happy\n- utter_did_that_help\n- utter_cheer_up\n- utter_greet","stories":"## say goodbye\n* goodbye\n  - utter_goodbye## sad path 2\n* greet\n  - utter_greet\n* mood_unhappy\n  - utter_cheer_up\n  - utter_did_that_help\n* deny\n  - utter_goodbye## sad path 1\n* greet\n  - utter_greet\n* mood_unhappy\n  - utter_cheer_up\n  - utter_did_that_help\n* affirm\n  - utter_happy## happy path\n* greet\n  - utter_greet\n* mood_great\n  - utter_happy","config":"# Configuration for Rasa NLU.\n# https://rasa.com/docs/rasa/nlu/components/\nlanguage: en\npipeline: supervised_embeddings\n\n# Configuration for Rasa Core.\n# https://rasa.com/docs/rasa/core/policies/\npolicies:\n  - name: MemoizationPolicy\n  - name: KerasPolicy\n  - name: MappingPolicy","out":null,"force":"false"}

Then I clicked "Start Training" in the "Training" tab and the error happened.

Expected behavior The expected behavior is to be able to train the bot.

Installation Type:

paschmann commented 4 years ago

@tomasbarcellos - It could be the null value in the server output folder of the training data - "out":null

When you setup your bot in Rasa UI, you need specify the server output folder the model should be saved to. After the fact, you can do this under the options when you edit the bot.

Please let me know if this solves the problem, if so, I will update the code base and make this a required field (or not include the "out" parameter if it is null).

tomasbarcellos commented 4 years ago

🎉 It worked! 🎉 Thanks so much.

paschmann commented 4 years ago

@tomasbarcellos - on a side note - if there are any improvements you can suggest around documentation/installation or usage of Rasa UI - please feel free to suggest them! Thanks! Paul

tomasbarcellos commented 4 years ago

I guess everything is fine with the exists docs, you're doing a fine job. We may need more, though.

I'll suggest new improvements in other issues / pull requests.