deeppavlov / DeepPavlov

An open source library for deep learning end-to-end dialog systems and chatbots.
https://deeppavlov.ai
Apache License 2.0
6.72k stars 1.15k forks source link

Error while running in Alexa mode #910

Closed sld closed 5 years ago

sld commented 5 years ago

I'm running in Alexa mode and getting the error:

ubuntu@ip-172-31-26-238:~/alexa_test$ python -m deeppavlov alexa server_config.json -d
Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/__main__.py", line 3, in <module>
    main()
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/deep.py", line 116, in main
    default_skill_wrap=not args.no_default_skill)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/utils/alexa/server.py", line 81, in run_alexa_default_agent
    ssl_cert=ssl_cert)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/utils/alexa/server.py", line 137, in run_alexa_server
    bot = Bot(agent_generator, alexa_server_params, input_q, output_q)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/utils/alexa/bot.py", line 68, in __init__
    self.agent = self._init_agent()
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/utils/alexa/bot.py", line 95, in _init_agent
    agent = self.agent_generator()
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/utils/alexa/server.py", line 70, in get_default_agent
    model = build_model(model_config)
  File "/home/ubuntu/.pyenv/versions/3.6.8/lib/python3.6/site-packages/deeppavlov/core/commands/infer.py", line 44, in build_model
    model_config = config['chainer']
KeyError: 'chainer'
ubuntu@ip-172-31-26-

My server_config.json:

{
  "common_defaults": {
    "host": "0.0.0.0",
    "port": 5000,
    "model_endpoint": "/model",
    "model_args_names": ["context"],
    "https": false,
    "https_cert_path": "",
    "https_key_path": "",
    "stateful": false,
    "multi_instance": false
  },
  "telegram_defaults": {
    "token": ""
  },
  "ms_bot_framework_defaults": {
    "auth_polling_interval": 3500,
    "conversation_lifetime": 3600,
    "auth_app_id": "",
    "auth_app_secret": ""
  },
  "alexa_defaults": {
    "intent_name": "AskDeepPavlov",
    "slot_name": "raw_input",
    "start_message": "Welcome to DeepPavlov Alexa wrapper!",
    "unsupported_message": "Sorry, DeepPavlov can't understand it.",
    "conversation_lifetime": 3600
  },
  "model_defaults": {
    "ODQA": {
      "host": "",
      "port": "",
      "model_endpoint": "/odqa",
      "model_args_names": ""
    }
  }
}

Why is the error happening? Seems that everything should be right. I followed the documentation guide. Just deleted other skills from model_defaults section.

sld commented 5 years ago

On default server config from https://raw.githubusercontent.com/deepmipt/DeepPavlov/master/deeppavlov/utils/settings/server_config.json I've got the same error.

yoptar commented 5 years ago

Here config_path should be a path to your model pipeline config, for example deeppavlov/configs/odqa/en_odqa_infer_wiki.json If it's a config from our repository you can use just it's name without an extension , so it could look like

python -m deeppavlov alexa en_odqa_infer_wiki -d

If you want to override the default server config, you can define the DP_SETTINGS_PATH environment variable. more info on this can be found in the settings documentation

sld commented 5 years ago

Thank you! Finally, I've made Alexa work by using AWS Lambda Endpoint. I did https API calls from AWS Lambda to DeepPavlov models that ran through riseapi mode in my server.

Unfortunately, Alexa didn't work when I used https endpoint and run DeepPavlov in alexa mode. I've always got an error in Alexa side (The requested skill did not provide a valid response) and no logs in DeepPavlov side (maybe some kind of SSL problem, but my certs are valid).
But it's not a big problem, because AWS Lambda worked.