Skip to content
/ DMSR Public

Learning Disentangled Meaning and Style Representations for Positive Text Reframing

License

Notifications You must be signed in to change notification settings

codesedoc/DMSR

Repository files navigation

Learning Disentangled Meaning and Style Representations for Positive Text Reframing 🔗

The code of is developed on nlpe, a python package for processing NLP experiments.

Data

  1. MSCOCO: used to create the pseudo paraphrase generation dateset for PTR.
  2. Yelp: used to create the pseudo sentiment transfer dateset for PTR.
  3. PPF: used to evaluate methods for PTR.

Source of data: MSCOCO (version from here), Yelp (version from here), PPF

Enviroment Setup

Requirements

  • Git
  • Python >= 3.11
  • CUDA 12.6 (if NVIDIA GPU is available)

Step 1: Get Code and datasets

Clone the repository.

git clone https://github.com/codesedoc/DMSR.git
cd DMSR

Step 2: Install Requirements

🔷 Conda

conda env create -f conda/environment_linux-64.yml # for linxu-64 platform
# conda env create -f conda/environment_oxs-arm64.yml # for oxs-arm64 (Mac Silicon) platform
# conda env create -f conda/environment_win-64.yml # for win-64 platform
conda activate dmsr

🔷 Python Virtual Environment

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Conduct Experiments

Command to lauch the experiment for train, evaluation, and test.

python main.py -t ptr -d ppf --dataset_raw_dir storage/dataset/ppf/raw  -a dmsr --output_dir tmp --do_train --do_eval --do_predict 

Explanation of Command Arguments:

Meta Argument of nlpe

  • -d [name of dataset]
  • -t [name of task]
  • --dataset_raw_dir [path of dataset dir]
  • -a [name of approach]
  • --debug : Swith on debug mode

DMSR Argument

  • --variant [name of variant of backbone model]: One of ("base", "st", "pg", "st2pg", "pg2st") is available, default is base.
  • --checkpoint [path of trained model]: It is used for only do evaluation on validation/test set.
  • --backbone [name of PLM used as backbone model]: One of ("t5", "bart") is available, default is t5.

TrainerArgument of transformer

  • --output_dir [path of output dir]
  • --do_train: Conduct train
  • --do_eval: Conduct evaluation on validation set
  • --do_predict: Conduct evaluation on test set

The other usages of transformers TrainiArgument can be referred to here.

BibTeX

@inproceedings{
    sheng-etal-2023-learning,
    title = "Learning Disentangled Meaning and Style Representations for Positive Text Reframing",
    author = "Sheng, Xu  and
      Fukumoto, Fumiyo  and
      Li, Jiyi  and
      Kentaro, Go  and
      Suzuki, Yoshimi",
    booktitle = "Proceedings of the 16th International Natural Language Generation Conference",
    month = sep,
    year = "2023",
    address = "Prague, Czechia",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2023.inlg-main.31",
    pages = "424--430",
}

About

Learning Disentangled Meaning and Style Representations for Positive Text Reframing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages