From f5dd1ba3d43e0d9337410d77810108d40ba3d166 Mon Sep 17 00:00:00 2001 From: Jinchao Li <38700695+jincli@users.noreply.github.com> Date: Wed, 30 Sep 2020 00:20:16 -0700 Subject: [PATCH] Human2 (#137) * change task config * add final goal logging * encapsule PipelineAgent internal state interface for return and replacement * fix bug associted with the issue of strange user input --- convlab2/human_eval/run_agent.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/convlab2/human_eval/run_agent.py b/convlab2/human_eval/run_agent.py index f848674..a12bede 100755 --- a/convlab2/human_eval/run_agent.py +++ b/convlab2/human_eval/run_agent.py @@ -35,16 +35,18 @@ agent = PipelineAgent(sys_nlu,sys_dst,sys_policy, sys_nlg,'sys') print(agent.response('I am looking for a hotel')) - +global_counter = 0 @app.route('/', methods=['GET', 'POST']) def process(): + global global_counter try: in_request = request.json print(in_request) except: return "invalid input: {}".format(in_request) - rgi_queue.put(in_request) - rgi_queue.join() + global_counter += 1 + rgi_queue.put((global_counter, in_request)) + # rgi_queue.join() output = rgo_queue.get() print(output['response']) rgo_queue.task_done() @@ -56,7 +58,7 @@ def generate_response(in_queue, out_queue): while True: # pop input # last_action = 'null' - in_request = in_queue.get() + _, in_request = in_queue.get() obs = in_request['input'] if in_request['agent_state'] == {}: agent.init_session() -- GitLab