This repository is the official implementation of StreamingDialogue: Prolonged Dialogue Learning via Long Context Compression with Minimal Losses. The code is developed based on LLaMA-Factory.
To install requirements:
pip install -r requirements.txt
To train the model(s) in the paper, run this command:
cd src
./train.sh
./merge.sh
-
Modify the file
/src/llmtuner/train/sft/workflow.py:- Comment out lines 157-240.
- Uncomment lines 83-94.
-
Modify the file
/model/llama/modeling_llama.py:- Comment out lines 1049-1052.
- Uncomment lines 1029-1032.
cd src
./train.sh
./merge.sh
cd src
python generate.py
cd src
python infer.py
evaluate PPL
cd src
python eval_ppl.py --base_model /model/strdialogue-merge --eval_path /data/test_msc.json
evaluate various metrics
cd src
python compute_score.py
You can download pretrained models here: