zqhZY / _rasa_chatbot

A Chinese task oriented chatbot in IVR(Interactive Voice Response) domain, implement by rasa. This is a demo with toy dataset, more data should be added for performance.
496 stars 228 forks source link

python bot.py train-dialogue error #18

Open verafeiliu opened 6 years ago

verafeiliu commented 6 years ago

运行python bot.py train-dialogue会get this exception, 然后我把它删掉了: if kwargs.get('featurizer') or kwargs.get('max_history'): raise Exception("Passing featurizer and max_history " "to agent.train(...) is not supported anymore. " "Pass appropriate featurizer " "directly to the policy instead. More info " "https://core.rasa.com/migrations.html#x-to-0-9-0") 但是会得到: Traceback (most recent call last): File "bot.py", line 163, in train_dialogue() File "bot.py", line 100, in train_dialogue validation_split=0.2 File "anaconda3/lib/python3.6/site-packages/rasa_core/agent.py", line 264, in train kwargs) File "anaconda3/lib/python3.6/site-packages/rasa_core/policies/ensemble.py", line 72, in train policy.train(training_trackers, domain, kwargs) File "anaconda3/lib/python3.6/site-packages/rasa_core/policies/keras_policy.py", line 146, in train shuffled_y.shape[1:]) TypeError: model_architecture() missing 1 required positional argument: 'max_history_len' 请问怎么解决啊,感谢🙏

BobCN2017 commented 6 years ago

def train_dialogue(domain_file="mobile_domain2.yml", model_path="models\dialogue", training_data_file="data/mobile_story.md"):

featurizer = MaxHistoryTrackerFeaturizer(BinarySingleStateFeaturizer(), max_history=5)
agent = Agent(domain_file, policies=[MemoizationPolicy(max_history=5), KerasPolicy(featurizer)])

agent.train(
    training_data_file,
    epochs=200,
    batch_size=16,
    augmentation_factor=50,
    validation_split=0.2
)

agent.persist(model_path)
return agent

我参考另一个项目,把这里改成上面那样,训练通过了。建议你试试

Emmonss commented 6 years ago

我将train-dialogue函数改成这样了,但是还是会出以下的错误: Exception: Passing a file name to agent.train(...) is not supported anymore. Rather load the data with data = agent.load_data(file_name) and pass it to agent.train(data). 然后我按照文档改了一下代码 def train_dialogue(domain_file="mobile_domain.yml", model_path="models/dialogue", training_data_file="data/mobile_story.md"): featurizer = MaxHistoryTrackerFeaturizer(BinarySingleStateFeaturizer(), max_history=5) agent = Agent(domain_file, policies=[MemoizationPolicy(max_history=5), KerasPolicy(featurizer)]) data = agent.load_data(training_data_file)

agent.train(data)

agent.train(
    data,
    epochs=200,
    batch_size=16,
    augmentation_factor=50,
    validation_split=0.2
)
agent.persist(model_path)
return agent

还是会报错: Exception: Can not access action 'action_search_consume', as that name is not a registered action for this domain. Available actions are: 请问怎么解决啊,谢谢!

zqhZY commented 6 years ago

代码已更新,从新clone试试