"sys_agent.response(\"I want to find a moderate hotel\")"
"sys_agent.init_session()\n",
"sys_agent.response(\"I want to find a hotel in the expensive pricerange\")"
]
},
{
...
...
@@ -224,378 +214,6 @@
"source": [
"sys_agent.response(\"Book a table for 5 , this Sunday .\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "n6uuuRonIHvW"
},
"source": [
"## Build a simulator to chat with the agent and evaluate\n",
"\n",
"In many one-to-one task-oriented dialog system, a simulator is essential to train an RL agent. In our framework, we doesn't distinguish user or system. All speakers are **agents**. The simulator is also an agent, with specific policy inside for accomplishing the user goal.\n",
"\n",
"We use `Agenda` policy for the simulator, this policy requires dialog act input, which means we should set DST argument of `PipelineAgent` to None. Then the `PipelineAgent` will pass dialog act to policy directly. Refer to `PipelineAgent` doc for more details."
"Now we have a simulator and an agent. we will use an existed simple one-to-one conversation controller BiSession, you can also define your own Session class for your special need.\n",
"\n",
"We add `MultiWozEvaluator` to evaluate the performance. It uses the parsed dialog act input and policy output dialog act to calculate **inform f1**, **book rate**, and whether the task is **success**."
"The combination modes of pipeline agent modules are flexible. We support joint models such as TRADE, SUMBT for word-DST and MDRG, HDSA, LaRL for word-Policy, once the input and output are matched with previous and next module. We also support End2End models such as Sequicity.\n",
"\n",
"Available models:\n",
"\n",
"- NLU: BERTNLU, MILU, SVMNLU\n",
"- DST: RuleDST\n",
"- Word-DST: SUMBT, TRADE (set `sys_nlu` to `None`)\n",
"We provide an analysis tool presents rich statistics and summarizes common mistakes from simulated dialogues, which facilitates error analysis and\n",
"system improvement. The analyzer will generate an HTML report which contains\n",
"rich statistics of simulated dialogues. For more information, please refer to `convlab/util/analysis_tool`."
# installing en_core_web_sm for spacy to resolve error in BERTNLU
!python-mspacydownloaden_core_web_sm
```
%% Cell type:markdown id: tags:
## build an agent
We use the models adapted on [Multiwoz](https://www.aclweb.org/anthology/D18-1547) dataset to build our agent. This pipeline agent consists of NLU, DST, Policy and NLG modules.
That's all! Let's chat with the agent using its response function:
%% Cell type:code id: tags:
``` python
sys_agent.response("I want to find a moderate hotel")
sys_agent.init_session()
sys_agent.response("I want to find a hotel in the expensive pricerange")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("Which type of hotel is it ?")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("OK , where is its address ?")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("Thank you !")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("Try to find me a Chinese restaurant in south area .")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("Which kind of food it provides ?")
```
%% Cell type:code id: tags:
``` python
sys_agent.response("Book a table for 5 , this Sunday .")
```
%% Cell type:markdown id: tags:
## Build a simulator to chat with the agent and evaluate
In many one-to-one task-oriented dialog system, a simulator is essential to train an RL agent. In our framework, we doesn't distinguish user or system. All speakers are **agents**. The simulator is also an agent, with specific policy inside for accomplishing the user goal.
We use `Agenda` policy for the simulator, this policy requires dialog act input, which means we should set DST argument of `PipelineAgent` to None. Then the `PipelineAgent` will pass dialog act to policy directly. Refer to `PipelineAgent` doc for more details.
Now we have a simulator and an agent. we will use an existed simple one-to-one conversation controller BiSession, you can also define your own Session class for your special need.
We add `MultiWozEvaluator` to evaluate the performance. It uses the parsed dialog act input and policy output dialog act to calculate **inform f1**, **book rate**, and whether the task is **success**.
The combination modes of pipeline agent modules are flexible. We support joint models such as TRADE, SUMBT for word-DST and MDRG, HDSA, LaRL for word-Policy, once the input and output are matched with previous and next module. We also support End2End models such as Sequicity.
Available models:
- NLU: BERTNLU, MILU, SVMNLU
- DST: RuleDST
- Word-DST: SUMBT, TRADE (set `sys_nlu` to `None`)