ParlAI icon indicating copy to clipboard operation
ParlAI copied to clipboard

Error with flask server

Open edwardyoon opened this issue 3 years ago • 3 comments
trafficstars

I often facing below error. Can someone tell me what should I do?

$ parlai flask -mf zoo:blender/blender_90M/model -t blended_skill_talk
....
....

[2022-07-31 11:10:50,927] ERROR in app: Exception on /response [POST]
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/ubuntu/ParlAI/parlai/scripts/flask.py", line 43, in chatbot_response
    response = self.agent.act()
  File "/home/ubuntu/ParlAI/parlai/core/torch_agent.py", line 2148, in act
    response = self.batch_act([self.observation])[0]
  File "/home/ubuntu/ParlAI/parlai/core/torch_agent.py", line 2244, in batch_act
    output = self.eval_step(batch)
  File "/home/ubuntu/ParlAI/parlai/core/torch_generator_agent.py", line 905, in eval_step
    self._add_generation_metrics(batch, preds)
  File "/home/ubuntu/ParlAI/parlai/core/torch_generator_agent.py", line 834, in _add_generation_metrics
    self.record_local_metric(
  File "/home/ubuntu/ParlAI/parlai/core/torch_agent.py", line 1180, in record_local_metric
    raise KeyError(f"Already recorded metrics for {keyname}")
KeyError: 'Already recorded metrics for gen_n_toks'

edwardyoon avatar Jul 31 '22 11:07 edwardyoon

Can you describe when it happens?

stephenroller avatar Jul 31 '22 13:07 stephenroller

Just found that multiple volley requests are sent to parlai. what happens same utterances are entered twice?

edwardyoon avatar Aug 02 '22 07:08 edwardyoon

d62d6fa362c6867e-user	can I talk with you
d62d6fa362c6867e-ai	sure , i ' d love to have a chat with you . what else are you interested in ?
127.0.0.1 - - [02/Aug/2022 07:07:35] "POST /response HTTP/1.1" 200 -
[2022-08-02 07:09:41,008] ERROR in app: Exception on /response [GET]
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/ubuntu/ParlAI/parlai/scripts/flask.py", line 39, in chatbot_response
    self.agent.observe({'text': data["text"], 'episode_done': False})
TypeError: 'NoneType' object is not subscriptable

edwardyoon avatar Aug 04 '22 03:08 edwardyoon

This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.

github-actions[bot] avatar Sep 04 '22 00:09 github-actions[bot]