Skip to content
/ MHIM Public

Official PyTorch implementation for "Multi-grained Hypergraph Interest Modeling for Conversational Recommendation".

License

Notifications You must be signed in to change notification settings

Zilize/MHIM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MHIM

This is the official PyTorch implementation for the paper: [arXiv]

Chenzhan Shang, Yupeng Hou, Wayne Xin Zhao, Yaliang Li, Jing Zhang. Multi-grained Hypergraph Interest Modeling for Conversational Recommendation.

Overview

We propose MHIM, which stands for Multi-grained Hypergraph Interest Modeling for conversational recommendation. MHIM employ hypergraph to represent complicated semantic relations underlying intricate historical data from different perspectives. First, aiming to capture intra- and inter-session correlations among historical dialogues, we consturct a session-based hypergraph, which captures coarse-grained, session-level relations. Second, to alleviate the issue of data scarcity, we incorporate an external knowledge graph and construct a knowledge-based hypergraph considering fine-grained, entity-level semantics. We further conduct multi-grained hypergraph convolution on the two kinds of hypergraphs, and utilize the enhanced representations to develop interest-aware CRS.

Requirements

python==3.8.12
pytorch==1.10.1
dgl==0.4.3
cudatoolkit==10.2.89
torch-geometric==2.0.3
transformers==4.15.0

Datasets

Google Drive | 百度网盘

Please download the processed datasets from the above links, unzip data_contrast.zip and move it to Contrast/, unzip data_mhim.zip and move it to MHIM/.

Quick Start

Contrastive Pre-training

Pre-train the R-GCN encoder:

cd Contrast
python run.py -d redial -g 0
python run.py -d tgredial -g 0

Then, move the save/{dataset}/{#epoch}-epoch.pth file to MHIM/pretrain/{dataset}/.

The pre-trained encoder on our machine has been saved as MHIM/pretrain/{dataset}/10-epoch.pth.

Running

cd ../MHIM
python run_crslab.py --config config/crs/mhim/hredial.yaml -g 0 -s 1 -p -e 10
python run_crslab.py --config config/crs/mhim/htgredial.yaml -g 0 -s 1 -p -e 10

The experiment results on our machine has been saved in MHIM/log/

Acknowledgement

The implementation is based on the open-source CRS toolkit CRSLab.

Please cite the following papers as the references if you use our codes or the processed datasets.

@inproceedings{shang2023mhim,
  author = {Chenzhan Shang and Yupeng Hou and Wayne Xin Zhao and Yaliang Li and Jing Zhang},
  title = {Multi-grained Hypergraph Interest Modeling for Conversational Recommendation},
  booktitle = {{arXiv preprint arXiv:2305.04798}},
  year = {2023}
}