Repository: facebookresearch/ParlAI

Issue:
Messenger - qa_data_collection task 
Running the messenger qa_data_collection task, it gives me te following error:
Exception in user code:
Traceback (most recent call last):
  File "/home/micol/PycharmProjects/parlai_project/ParlAI/parlai/messenger/core/messenger_manager.py", line 552, in _task_function
    task_functions[world_type](self, opt, agents, conversation_id)
  File "run.py", line 45, in run_conversation
    task = task_class(task_opt)
  File "/home/micol/PycharmProjects/parlai_project/ParlAI/parlai/tasks/squad/agents.py", line 114, in __init__
    build(opt)
  File "/home/micol/PycharmProjects/parlai_project/ParlAI/parlai/tasks/squad/build.py", line 35, in build
    if 'fulldoc' in opt['task']:
KeyError: 'task'
"Facebook response from message send: {'recipient_id': '2172740222785536', 'message_id': 'm_rDniDdXXKp9KY2DDR7nYxf46FEm_jG446gMYoyCBkXQ1qs8d7VUug8eG31SNJbRdWO5T8BAyL5R4_1-p3tHWVQ'}"
Message data received: {'object': 'page', 'entry': [{'id': '336760520259323', 'time': 1546939725227, 'messaging': [{'sender': {'id': '336760520259323'}, 'recipient': {'id': '2172740222785536'}, 'timestamp': 1546939724784, 'message': {'is_echo': True, 'app_id': 322301978494112, 'mid': 'rDniDdXXKp9KY2DDR7nYxf46FEm_jG446gMYoyCBkXQ1qs8d7VUug8eG31SNJbRdWO5T8BAyL5R4_1-p3tHWVQ', 'seq': 32111, 'text': 'Sorry, this world closed. Returning to overworld.'}}]}]}
Message data received: {'object': 'page', 'entry': [{'id': '336760520259323', 'time': 1546939725478, 'messaging': [{'sender': {'id': '2172740222785536'}, 'recipient': {'id': '336760520259323'}, 'timestamp': 1546939725466, 'delivery': {'mids': ['rDniDdXXKp9KY2DDR7nYxf46FEm_jG446gMYoyCBkXQ1qs8d7VUug8eG31SNJbRdWO5T8BAyL5R4_1-p3tHWVQ'], 'watermark': 1546939724784, 'seq': 0}}]}]}
 
What is the possible solution?

Thank you


Discussion:
Will you please share the command you ran to create this error?

It looks like `'task'` isn't being set in the options anywhere. We really just need to figure out where's the right place to set it.
I just ran the python run.py command. Then I try to interact with my messenger bot, and this is the error shown. I add in ParlAI/parlay/messenger/tasks/qa_data_collection/ run.py at line 31: task_opt[‘task’] = opt[‘task’]. Then I have modify ParlAI/tests/integration/test_downloads.py adding opt[‘task’].

Now it works!


From: Stephen Roller
Sent: 08 January 2019 12:06
To: facebookresearch/ParlAI
Cc: micolspitale93; Author
Subject: Re: [facebookresearch/ParlAI] Messenger - qa_data_collection task(#1333)

Will you please share the command you ran to create this error?
It looks like 'task' isn't being set in the options anywhere. We really just need to figure out where's the right place to set it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.



Resolving patch:
diff --git a/parlai/messenger/tasks/qa_data_collection/run.py b/parlai/messenger/tasks/qa_data_collection/run.py
--- a/parlai/messenger/tasks/qa_data_collection/run.py
+++ b/parlai/messenger/tasks/qa_data_collection/run.py
@@ -27,7 +27,7 @@ def main():
     class_name = 'DefaultTeacher'
     my_module = importlib.import_module(module_name)
     task_class = getattr(my_module, class_name)
-    task_opt = {}
+    task_opt = opt.copy()
     task_opt['datatype'] = 'train'
     task_opt['datapath'] = opt['datapath']
 


Test patch: