对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细

原文链接: http://docs.deeppavlov.ai/en/master/features/skills/go_bot.html#intro

Docs 文件 » Dialogue Bot for goal-oriented task
翻译自 Dialogue Bot for goal-oriented task
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第1张图片
我在pycharm中尝试运行代码,运行结果为对每句输入的回复。

from deeppavlov import build_model, configs

bot1 = build_model(configs.go_bot.gobot_dstc2, download=True)

print(bot1(['hi, i want restaurant in the cheap pricerange']))
print(bot1(['bye']))

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第2张图片

Introduction

The dialogue bot is based on 一篇论文 which introduces Hybrid Code Networks (HCNs) that combine an RNN with domain-specific knowledge and system action templates.

该对话机器人基于Jason d. Williams,Kavosh Asadi,Geoffrey Zweig 提出的混合代码网络(Hybrid Code Networks,HCNs)架构,混合代码网络: 实用且高效的端到端对话控制,带有监督和强化学习-2017 这篇论文,引入了混合编码网络(hcn) ,该混合编码网络将 RNN 与特定领域的知识和系统动作模板相结合。
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第3张图片
虚线对应不需要的(可选的)模块,黑色方块对应训练模型,梯形是依赖于数据集的模块,必须由软件开发人员提供。
下面是一个与受过训练的对话机器人进行交互的简单示例:
(这些是框架中举的例子)

>> Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?
x::hi, i want cheap food
2018-05-16 12:28:48.459 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap'}, got 22 results.
>> The lucky star serves chinese food in the cheap price range.
x::is there anything with french food?
2018-05-16 12:29:02.795 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap', 'food': 'french'}, got 0 results.
>> Sorry there is no french restaurant in the cheap price range.
x::ok, maybe there is something in expensive pricerange?
2018-05-16 12:29:23.337 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'french'}, got 2 results.
>> Cote serves french food in the expensive price range.
x::in what part of town is it?
2018-05-16 12:29:31.193 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'french'}, got 2 results.
>> Restaurant two two is a nice place in the north of town serving tasty french food.
x::ok, give me their phone number
>> The phone number of restaurant two two is 01223 351880.
x::address and post code too
>> Restaurant two two is on 22 chesterton road chesterton, c.b 4, 3 a.x.
x::ok, thank you!
>> Restaurant two two serves french food in the expensive price range.
x::and if i wanted an italian restuarant?
2018-05-16 12:30:15.98 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'italian'}, got 4 results.
>> Frankie and bennys serves italian food in the expensive price range.
x::more cheaply priced?
2018-05-16 12:30:36.560 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap', 'food': 'italian'}, got 5 results.
>> Da vinci pizzeria serves italian food in the cheap price range.
x::ok, give me their phone number and address, please
>> The phone number of da vinci pizzeria is 01223 351707 and it is on 20 milton road chesterton.
x::thanks
>> Da vinci pizzeria serves italian food in the cheap price range.
x::bye
>> You are welcome!

下面是我的实际运行
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第4张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第5张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第6张图片

Usages 用法

Requirements 要求

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第7张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第8张图片

Configs 配置

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第9张图片

A minimal model without slot_filler, intent_classifier and embedder is configured in configs/go_bot/gobot_dstc2_minimal.json.
没有槽填充、意图分类器和嵌入器的最小模型是在 configs / go_bot / gobot_dstc2 minimal.json中配置的。

除了chainer,用于训练管道的配置应该有三个额外的元素: dataset_reader数据集读取器、dataset_iterator 数据集迭代器和train训练器:

{
  "dataset_reader": {
    "class_name": ...,
    ...
  },
  "dataset_iterator": {
    "class_name": ...,
    ...
  },
  "chainer": {
    ...
  },
  "train": {
    ...
  }
}

如下图分析:
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第10张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第11张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第12张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第13张图片

Usage example 使用示例

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第14张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第15张图片
下面是我的使用样例 ,调整为当前的预训练模型gobot_dstc2.json(我已经复制到了当前文件夹下)

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第16张图片
这个是通过python交互的形式,(,download=True)然后系统会自行下载需要的配置文件。

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第17张图片

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第18张图片
或者配置文件已经下载好之后,可以直接读取CONFIG_PATH
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第19张图片

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第20张图片
首先寻找cheap +south+chinese food ,并获取其phone number+ address + post code
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第21张图片
然后寻找French food ,系统自动认为在原来的条件上,结合 cheap + french + north/south/east/west ,都got 0 results。
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第22张图片
然后我意识到可能是因为价格的限制,于是调整为 expensive+french + centre/north ,都有相应的results。
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第23张图片

Config parameters 配置参数

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第24张图片

Datasets 数据集

DSTC2

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第25张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第26张图片

Your data 你的数据

Dialogs

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第27张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第28张图片
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第29张图片

Templates 模板

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第30张图片

Database(optional)数据库(可选)

对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第31张图片

Comparison 对比

对我们的机器人模型进行不同的修改,并与现有基准进行比较,结果如下
对话系统Deep Learning lab-4 Dialogue Bot for goal-oriented task 面向目标任务的对话机器人 -详细_第32张图片
There were a few modifications to the original dataset. It differs from ours in train/valid/test split and intent/action labeling.

对原始数据集做了一些修改。 在训练 / 有效 / 测试分裂 和 意图 / 行动 标签上和我们的有所不同。

你可能感兴趣的:(deeppavlov框架学习)