Skip to content

Code release for Improving Dialog Systems for Negotiation with Personality Modeling.

License

Notifications You must be signed in to change notification settings

princeton-nlp/NegotiationToM

Repository files navigation

NegotiationToM

Improving Dialog Systems for Negotiation with Personality Modeling. Implements our ToM algorithms.

Our code for internal using is available in another repo.

A more clear code with proper instruction will be available soon here.


Installation

Dependencies

  1. Clone code from github:
git clone git@github.com:princeton-nlp/NegotiationToM.git
cd NegotiationToM 
  1. Create a conda environment:
conda create --name <env> --file tom_conda10.txt
  1. install pytorch
# For Linux
# CUDA 9.0
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch

# CUDA 10.0
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch

# CPU Only
conda install pytorch-cpu==1.1.0 torchvision-cpu==0.3.0 cpuonly -c pytorch
  1. pip install additional dependencies
# install other dependecies
pip install -r requirements_cuda10.txt
# install our code
pip install -e .

Dependence Reference

  • Python 3.5, pytorch=1.1.0

    • For cuda9: pytorch=1.1.0=py3.5_cuda9.0.176_cudnn7.5.1_0
    • For cuda10: pytorch=1.1.0=py3.5_cuda10.0.130_cudnn7.5.1_0
  • Additional dependencies:

    • tom_new.txt, requirements.txt
    • For cuda10: tom_cuda10.txt, requirements_cuda10.txt

Traning instruction

Preprocess

PYTHONPATH=. python core/price_tracker.py --train-examples-path data/train-luis-clean2.json --output data/price_tracker.pkl

Train a Supervised Learning Agent

bash craigslistbargain/exp_scripts/identifier/old/train_sl.sh

Train a Reinforcement Learning Agent

  • Generate scenarios
PYTHONPATH=. python ../scripts/chat_to_scenarios.py --chats data/train-luis-post.json --scenarios data/train-scenarios.json
PYTHONPATH=. python ../scripts/chat_to_scenarios.py --chats data/dev-luis-post.json --scenarios data/dev-scenarios.json
  • Train the RL model

    parameter <use_gpu>: "--gpuid 0" for gpu, "" for cpu.

bash exp_scripts/rl/train_a2c.sh <exp_name> <use_gpu> <seed> <learning_rate> 

Train a ToM model

  • Sample data
bash exp_scripts/identifier/sample_data.sh <use_gpu> <seed> 
  • Implicit Model
bash exp_scripts/identifier/train_uttr_history_tom.sh <exp_name> <use_gpu>
  • Explicit Model
bash exp_scripts/identifier/train_uttr_id_history_tom.sh <exp_name> <use_gpu>

Evaluate result of different model.

For evaluation process, gpu acceleration is unnecessary.

Parameter <1/beta> equal to $\frac{1}{beta}$ of tom inference process in our paper.

  • Rule Model
bash exp_scripts/rl/eval_rule.sh <exp_name> "" <seed> <1/beta> "${CHECK_POINT}"
  • SL Model
bash exp_scripts/rl/eval_sl.sh <exp_name> "" <seed> <1/beta> "${CHECK_POINT}" 
  • RL Model
bash exp_scripts/rl/eval_rl.sh <exp_name> "" <seed> <1/beta> "${CHECK_POINT}" 
  • Implicit ToM Model
bash exp_scripts/rl/eval_tom_noid.sh <exp_name> "" <seed> <1/beta>" "${CHECK_POINT}" "${TOM_CHECK_POINT}"
  • Explicit ToM Model
bash exp_scripts/rl/eval_tom.sh <exp_name> "" <seed> <1/beta> "${CHECK_POINT}" "${TOM_CHECK_POINT}"

About

Code release for Improving Dialog Systems for Negotiation with Personality Modeling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published