cjh0507 / VISTA

VISTA: VIsual-Textual Knowledge Graph Representation Learning (Findings of EMNLP 2023)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VISTA: Visual-Textual Knowledge Graph Representation Learning

This code is the official implementation of the following paper:

Jaejun Lee, Chanyoung Chung, Hochang Lee, Sungho Jo, and Joyce Jiyoung Whang, VISTA: Visual-Textual Knowledge Graph Representation Learning, Findings of the Association for Computational Linguistics: EMNLP 2023 (Findings of EMNLP 2023).

All codes are written by Jaejun Lee (jjlee98@kaist.ac.kr). When you use this code or data, please cite our paper.

@inproceedings{vista,
	author={Jaejun Lee and Chanyoung Chung and Hochang Lee and Sungho Jo and Joyce Jiyoung Whang},
	title={VISTA: Visual-Textual Knowledge Graph Representation Learning},
	booktitle={Findings of the Association for Computational Linguistics: EMNLP 2023},
	year={2023},
	pages={7314--7328}
}

Requirements

We used python 3.8 and PyTorch 1.12.1 with cudatoolkit 11.3.

You can install all requirements with:

pip install -r requirements.txt

Datasets

You can download the datasets from https://drive.google.com/file/d/1u4QthmEboMzRarF_HLYfLDOLcOZeH8Gp/view?usp=drive_link

To use the datasets, place the unzipped data folder in the same directory with the codes. Note that we cannot provide the raw images due to some potential license problems.

Reproducing the Reported Results

We provide the checkpoints to produce the results on VTKG-I, VTKG-C, WN18RR++, and FB15K237. If you want to use the checkpoints, place the unzipped checkpoint folder in the same directory with the codes.

You can download the checkpoints from https://drive.google.com/file/d/1EYKrE2yLMgRRfpzR17UgRiRBQMiFOQHc/view?usp=drive_link

The commands to reproduce the results in our paper:

VTKG-I

bash test_VTKG-I.sh

VTKG-C

bash test_VTKG-C.sh

WN18RR++

bash test_WN18RR++.sh

FB15K237

bash test_FB15K237.sh

Training from Scratch

To train VISTA from scratch, run train.py with arguments. Please refer to train.py or test.py for the examples of the arguments.

The list of arguments of 'train.py':

  • --data: name of the dataset
  • --lr: learning rate
  • --dim: $d$
  • --num_epoch: total number of training epochs (only used for train.py)
  • --test_epoch: the epoch to test (only used for test.py)
  • --valid_epoch: the duration of validation
  • --exp: experiment name
  • --num_layer_enc_ent: $L$
  • --num_layer_enc_rel: $\widehat{L}$
  • --num_layer_dec: $\widetilde{L}$
  • --num_head: number of attention heads
  • --hidden_dim: the hidden dimension of the transformers
  • --dropout: the dropout rate of the transformers
  • --emb_dropout: the dropout rate of the embedding matrices
  • --vis_dropout: the dropout rate of the visual representation vectors
  • --txt_dropout: the dropout rate of the textual representation vectors
  • --smoothing: label smoothing ratio
  • --batch_size: the batch size
  • --decay: the weight decay
  • --max_img_num: $k=\hat{k}$
  • --step_size: the step size of the cosine annealing learning rate scheduler

About

VISTA: VIsual-Textual Knowledge Graph Representation Learning (Findings of EMNLP 2023)


Languages

Language:Python 93.9%Language:Shell 6.1%