thu-coai / tatk

Task-oriented dialog system toolkits
Apache License 2.0
85 stars 26 forks source link

[BUG] When I tried to run an agent according Getting_Started, I encountered an error #194

Open nomadlx opened 4 years ago

nomadlx commented 4 years ago

Describe the bug

Traceback (most recent call last):
  File "example_agent.py", line 22, in <module>
    sys_agent.response("I want to find a moderate hotel")
  File "/exp/tatk/tatk/dialog_agent/agent.py", line 109, in response
    self.output_action = self.policy.predict(state)
  File "/exp/tatk/tatk/policy/rule/multiwoz/rule.py", line 31, in predict
    return self.policy.predict(state)
  File "/exp/tatk/tatk/policy/rule/multiwoz/rule_based_multiwoz_bot.py", line 97, in predict
    domain, intent_type = user_act.split('-')
AttributeError: 'list' object has no attribute 'split'

To Reproduce I try to run a agent according tutorials/Getting_Started/Getting_Started.ipynb as follows:

import sys
import os
from tatk.dialog_agent import PipelineAgent, BiSession
from tatk.nlu.svm.multiwoz import SVMNLU
from tatk.nlu.jointBERT.multiwoz import BERTNLU
from tatk.dst.rule.multiwoz import RuleDST
from tatk.policy.rule.multiwoz import Rule
from tatk.nlg.template.multiwoz import TemplateNLG
from tatk.evaluator.multiwoz_eval import MultiWozEvaluator
import random
import numpy as np
from pprint import pprint

sys_nlu = SVMNLU(mode='usr')
sys_dst = RuleDST()
sys_policy = Rule(character='sys')
sys_nlg = TemplateNLG(is_user=False)
sys_agent = PipelineAgent(sys_nlu, sys_dst, sys_policy, sys_nlg, "chatbot")
sys_agent.response("I want to find a moderate hotel")

before run this, I change some code to fix self.history not define bug: change https://github.com/thu-coai/tatk/blob/fafabc45d02ad889f59354acac4e3b1367e7d4bf/tatk/dialog_agent/agent.py#L96 to

self.input_action = self.nlu.predict(observation)

Expected behavior print 'I have 18 options for you. Will acorn guest house be alright ? The parking is free . How about acorn guest house ?'