Giter Club home page Giter Club logo

multimodalsum's Introduction

Self-Supervised Multimodal Opinion Summarization

Official Pytorch implementation of the paper: "Self-Supervised Multimodal Opinion Summarization", ACL-IJCNLP, 2021.

Abstract

Recently, opinion summarization, which is the generation of a summary from multiple reviews, has been conducted in a self-supervised manner by considering a sampled review as a pseudo summary. However, non-text data such as image and metadata related to reviews have been considered less often. To use the abundant information contained in non-text data, we propose a self-supervised multimodal opinion summarization framework called MultimodalSum. Our framework obtains a representation of each modality using a separate encoder for each modality, and the text decoder generates a summary. To resolve the inherent heterogeneity of multimodal data, we propose a multimodal training pipeline. We first pretrain the text encoder–decoder based solely on text modality data. Subsequently, we pretrain the non-text modality encoders by considering the pretrained text decoder as a pivot for the homogeneous representation of multimodal data. Finally, to fuse multimodal representations, we train the entire framework in an end-to-end manner. We demonstrate the superiority of MultimodalSum by conducting experiments on Yelp and Amazon datasets.

Usage

Install dependencies

The easiest way to proceed is to create a separate conda environment.

conda create -n multimodalsum python=3.7.7
conda activate multimodalsum

Install required modules.

pip install -r requirements.txt

Download data

Our model is trained and evaluated on two review datasets: Yelp and Amazon.

Training data

Yelp
  1. Download JSON and Photos from link
  2. Unzip JSON
    1. Put yelp_academic_dataset_reviews to data/yelp/raw/ and name it reviews.json
    2. Put yelp_academic_dataset_business to data/yelp/raw_others/ and name it business.json
  3. Put Photos to data/yelp/raw_others/
Amazon
  1. Download per-category reviews and metadata from link
  2. Put reviews to data/amazon/raw/
  3. Unzip metadata and put them to data/amazon/raw_others/

Evaluation data

Evaluation data are located at data/yelp/test/ and data/amazon/test/

Yelp

Data are downloaded from link and some missing or mismatched business ids are fixed.

Amazon

Data are downloaded from link.

Preprocess data

Text data are tokenized, subsampled, and partitioned in order. Data preprocessing scripts are based on link and some scripts are edited.

From the root directory, execute the following command.

python -m luigi
--local-scheduler
--module preprocessing.steps Partition
--inp-dir-path=data/yelp/raw
--Subsample-min-revs=10
--Subsample-min-rev-len=35
--Subsample-max-rev-len=100
--Subsample-percentile=90
--train-part=0.9
--val-part=0.1
--GlobalConfig-out-dir-path=data/
--GlobalConfig-dataset=yelp
--log-level=INFO
--workers=4
python -m luigi
--local-scheduler
--module preprocessing.steps Partition
--inp-dir-path=data/amazon/raw
--Subsample-min-revs=10
--Subsample-min-rev-len=45
--Subsample-max-rev-len=70
--Subsample-percentile=90
--train-part=0.95
--val-part=0.05
--GlobalConfig-out-dir-path=data/
--GlobalConfig-dataset=amazon
--log-level=INFO
--workers=4

Multimodal preprocess data

Text, Image, and Table data for multimodal learning are prepared.

From the root directory, execute the following command.

python multimodal_preprocessing/multimodal_preprocessing.py --dataset yelp
python multimodal_preprocessing/multimodal_preprocessing.py --dataset amazon

Model train (multimodal training pipeline)

MultimodalSum consists of text encoder, image encoder, table encoder, and text decoder.

To resolve the inherent heterogeneity of multimodal data, MultimodalSum is trained along the multimodal training pipeline. Multimodal training pipeline consists of three steps.

  • Text modality pretraining (Pretrain text encoder and decoder)
  • Other modalities pretraining
    • Img modality pretraining (Pretrain image encoder)
    • Table modality pretraining (Pretrain table encoder)
  • Multiple modalities training (Train MultimodalSum)

From the root directory, execute the following command.

# 0) Further pretrain BART using the entire training review corpus
python src/bart-review.py

# 1) Text modality pretraining
OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=4 src/text_pretrain.py

# 2) Other modalities pretraining
OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=2 src/img_pretrain.py
OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=2 src/table_pretrain.py

# 3) Multiple modalities training
OMP_NUM_THREADS=1 python -m torch.distributed.launch --nproc_per_node=8 src/multimodal_train.py

Model weights are saved in ckpt/ and log files are saved in log/.

Model evaluation

From the root directory, execute the following command.

python src/test.py

Generated summaries

Generated summaries from MultimodalSum on Yelp and Amazon test data are included in output/.

Citation

@inproceedings{im-etal-2021-self,
    title = "Self-Supervised Multimodal Opinion Summarization",
    author = "Im, Jinbae  and
      Kim, Moonki  and
      Lee, Hoyeop  and
      Cho, Hyunsouk  and
      Chung, Sehee",
    booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
    month = aug,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.acl-long.33",
    doi = "10.18653/v1/2021.acl-long.33",
    pages = "388--403"
}

multimodalsum's People

Contributors

jinbae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

multimodalsum's Issues

Luigi 모듈을 사용한 데이터 전처리에 관하여

Luigi 모듈을 사용한 데이터 전처리에 관하여
Luigi 모듈을 사용하여 전처리하는 과정에서 Luigi모듈을 설치하고 사용하는데 No task specified 문제가 발생합니다.
혹시 테스트 데이터셋으로만으로도 학습이 가능한지 궁금합니다. 아니면 루이지모듈을 사용하지않고 데이터 전처리를하여도 실험이 가능한가요

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.