Views
No views yet


ckpt
data/convai2
data/corpora
src
ckpt/xl/ckpt/checkpoint/pth/model.pth.tarenv.yml for one-step environment creationconda env create -f env.ymlname: experimental namecheckpoint_dir: the path to save modelsave_index_path: the path to save retriever indexrefresh_index: the index refresh steps for retriever, -1 for never refresh (every refresh_index steps)per_gpu_batch_size: batch size per gpu for training/inferencingtotal_steps: the total step for the whole training processeval_freq: the steps for model evaluation (every eval_freq steps)save_freq: the steps for model save (every save_freq steps)per_gpu_embedder_batch_size: the batch size for retriever index embeddinggold_score_mode: the metric to guide update the retrievertrain_retriever: whether to train the retrieverprecision: the precision of the model, fp16/bf16/fp32shard_optim: shards optimizer state over available GPUsshard_grads: shards gradient over available GPUstarget_maxlength: Maximum length of target outputsgeneration_max_length: similar to target max lengthreader_model_type: the model for the generatordropout: the dropout value for the architectureweight_decay: the weight decay for the optimizerlr: learning rate for generatorlr_retriever: learning rate for retrieverscheduler: which scheduler to be used to schedule learning ratetext_maxlength: maximum number of tokens in input text segments (concatenated story+context)retriever_from: the query for the retrieveruse_gradient_checkpoint_reader: using gradient checkpoint for generatoruse_gradient_checkpoint_retriever: using gradient checkpoint for retrievertrain_data: the jsonl file to training dataeval_data: the jsonl file to evaluation datan_conetxt: how many retrieved storied are fused to the generatorretriever_n_context: the number of retrieved stories from story corpuslog_freq: the log frequency in stepswramup_steps: the steps to do warm upwriting_results: whether to write results after evaluationtask: we are fixed to qa current, as the pre-processor in qa is to process CONVAI2 datasetindex_mode: whether to use flat or faiss to retrieve top-k neighbourspassages: the path to jsonl story corpussave_index_n_shards: how many shards to save an index to file withtemperature_score: temperature parameter used in the loss computationtemperature_gold: temperature parameter used in the loss computationmodel_path: path to initialize a modelload_reader_weights_only: only read generator weight, no retriever weight are passed (after stage1, the checkpoint only contains the weight of generator)1export LR=5e-4
2export CUDA_VISIBLE_DEVICES=0,1
3export NGPU=2
4python -m torch.distributed.launch --master_port=29566 --nproc_per_node=2 train.py \
5 --closed_book \
6 --shuffle \
7 --per_gpu_batch_size=64 \
8 --total_steps=12000 \
9 --eval_freq=1000 \
10 --save_freq=1000 \
11 --name= \
12 --checkpoint_dir=ckpt/xp_exp \
13 --use_gradient_checkpoint_reader \
14 --precision=fp32 \
15 --shard_optim \
16 --shard_grads \
17 --target_maxlength=32 \
18 --generation_max_length=32 \
19 --reader_model_type=google/t5-xl-lm-adapt \
20 --dropout=0.1 \
21 --weight_decay=0.01 \
22 --lr=${LR} \
23 --scheduler=linear \
24 --text_maxlength=560 \
25 --retriever_from=persona \
26 --train_data="data/convai2/train.jsonl" \
27 --eval_data="data/convai2/valid.jsonl" \
28 --log_freq=1 \
29 --warmup_steps=5 \
30 --write_results1export STAGE1_GENERATOR=PATH_TO_THE_MODEL_TRAINED_IN_STAGE1
2export LR=5e-4
3export RET_LR=5e-4
4export TEMP=0.8
5export TEMPG=0.85
6export NGPU=2
7export CUDA_VISIBLE_DEVICES=0,1
8python -m torch.distributed.launch --master_port=29899 --nproc_per_node=2 train.py \
9--shuffle \
10--refresh_index=1200 \
11--per_gpu_batch_size=8 \
12--total_steps=12000 \
13--eval_freq=1200 \
14--save_freq=1200 \
15--per_gpu_embedder_batch_size=128 \
16--name=LAPDOG_XL \
17--checkpoint_dir=ckpt/xl_exp/ \
18--save_index_path=ckpt/xl_exp/saved_index \
19--gold_score_mode=f1rougebleudist \
20--train_retriever \
21--precision=fp32 \
22--shard_optim \
23--shard_grads \
24--target_maxlength=32 \
25--generation_max_length=32 \
26--reader_model_type=google/t5-xl-lm-adapt \
27--dropout=0.1 \
28--weight_decay=0.01 \
29--lr=${LR} \
30--lr_retriever=${RET_LR} \
31--scheduler=linear \
32--text_maxlength=512 \
33--retriever_from=persona \
34--use_gradient_checkpoint_reader \
35--use_gradient_checkpoint_retriever \
36--train_data="data/convai2/train.jsonl" \
37--eval_data="data/convai2/valid.jsonl" \
38--n_context=6 \
39--retriever_n_context=6 \
40--log_freq=1 \
41--warmup_steps=50 \
42--write_results \
43--task=qa \
44--index_mode=flat \
45--passages="data/corpora/story/story.jsonl" \
46--save_index_n_shards=128 \
47--temperature_score=${TEMP} \
48--temperature_gold=${TEMPG} \
49--model_path=${STAGE1_GENERATOR} \
50--load_reader_weights_onlyevaluation_test.sh) to run evaluation on trained checkpoint. The content of the script is:
Also, you can check the jsonl located in the ckpt folder (ckpt/xl/ckpt/valid-result.jsonl) for referring.1NGPU=1 CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.launch --master_port=28888 --nproc_per_node=1 evaluate.py \
2 --reader_model_type=google/t5-xl-lm-adapt \
3 --text_maxlength=512 \
4 --checkpoint_dir=ckpt/xl/eval \
5 --model_path=ckpt/xl/ckpt/checkpoint/pth/ \
6 --per_gpu_batch_size=1 \
7 --eval_data="data/convai2/valid.jsonl" \
8 --n_context=6 \
9 --retriever_n_context=6 \
10 --index_mode="flat" \
11 --precision=fp32 \
12 --save_index_path=ckpt/xl/eval \
13 --write_results \
14 --passages="data/corpora/story/story.jsonl" \
15 --retriever_from=persona \
16 --passages="data/corpora/story/story.jsonl" \
17 --generation_num_beams=1 \
18 --generation_length_penalty=1python compute_metrics.py1...
2file_name = 'ckpt/xl/ckpt/valid-result.jsonl'
3...@inproceedings{huang-etal-2023-learning,
title = "Learning Retrieval Augmentation for Personalized Dialogue Generation",
author = "Huang, Qiushi and
Fu, Shuai and
Liu, Xubo and
Wang, Wenwu and
Ko, Tom and
Zhang, Yu and
Tang, Lilian",
editor = "Bouamor, Houda and
Pino, Juan and
Bali, Kalika",
booktitle = "Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing",
month = dec,
year = "2023",
address = "Singapore",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2023.emnlp-main.154",
doi = "10.18653/v1/2023.emnlp-main.154",
pages = "2523--2540",
abstract = "Personalized dialogue generation, focusing on generating highly tailored responses by leveraging persona profiles and dialogue context, has gained significant attention in conversational AI applications. However, persona profiles, a prevalent setting in current personalized dialogue datasets, typically composed of merely four to five sentences, may not offer comprehensive descriptions of the persona about the agent, posing a challenge to generate truly personalized dialogues. To handle this problem, we propose $\textbf{L}$earning Retrieval $\textbf{A}$ugmentation for $\textbf{P}$ersonalized $\textbf{D}$ial$\textbf{O}$gue $\textbf{G}$eneration ($\textbf{LAPDOG}$), which studies the potential of leveraging external knowledge for persona dialogue generation. Specifically, the proposed LAPDOG model consists of a story retriever and a dialogue generator. The story retriever uses a given persona profile as queries to retrieve relevant information from the story document, which serves as a supplementary context to augment the persona profile. The dialogue generator utilizes both the dialogue history and the augmented persona profile to generate personalized responses. For optimization, we adopt a joint training framework that collaboratively learns the story retriever and dialogue generator, where the story retriever is optimized towards desired ultimate metrics (e.g., BLEU) to retrieve content for the dialogue generator to generate personalized responses. Experiments conducted on the CONVAI2 dataset with ROCStory as a supplementary data source show that the proposed LAPDOG method substantially outperforms the baselines, indicating the effectiveness of the proposed method. The LAPDOG model code is publicly available for further exploration.",
}