Code for EMNLP 2021 paper "Transferable Persona-Grounded Dialogues via Grounded Minimal Edits"
pip install transformers==2.3.0 torch==1.2.0 nltk matplotlib tensorboardX
Download the nltk stopwords.
import nltk
nltk.download('stopwords')
Download persona evaluator from here as dnli-bert/dnli_model.bin
.
Training data (data/personachat-ucpt/train.json):
[
...
{
"context": tuple of strs,
"response": str,
"persona": str or an empty list,
},
...
]
Validation and test data (data/personachat-ucpt/{valid, test}.json):
[
...
{
"context": tuple of strs,
"original_response": str,
"intervening_persona": tuple of strs,
"references": tuple of strs,
},
...
]
Use GME
as the root directory.
- Train the editor model.
python3 train.py
- Download checkpoint (seed=0) from here as
outputs/saved_model/persona-chat-cprm-smooth_eps0.1-grad_thres3-tau3-0/best-model.ckpt
. This step is not necessary if you do the training above.
python3 test.py
Use GME-Zero-Shot
as the root directory.
- Download checkpoint (seed=0) from here as
outputs/saved_model/persona-chat-cprm-smooth_eps0.1-grad_thres3-tau3-0/best-model.ckpt
. If you do the training of the Grounded Minimal Editing experiment, copy the saved checkpoint asoutputs/saved_model/persona-chat-cprm-smooth_eps0.1-grad_thres3-tau3-0/best-model.ckpt
.
python3 test.py