KERL leverages the power of knowledge graphs and pre-trained language models to generate semantically rich entity representations, enabling more accurate recommendations and engaging user interactions.
To run the provided code, follow these steps:
-
Download and install Miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh
-
Create a new conda environment with provided
environment.yml
file:conda env create -f environment.yml conda activate kerl
ℹ️ Note:
- Code tested only on WSL2 and Linux-based systems.
- The provided Miniconda installation commands are for Linux. For other systems, download the appropriate installer from the official website.
To train the KERL model, use the following commands. Select the appropriate configuration file based on the dataset:
# For training on the Inspired dataset
python main.py -c config/inspired_kerl.yaml
# For training on the ReDial dataset
python main.py -c config/redial_kerl.yaml
ℹ️ Note: If you wish to log the training metrics, you will need a wandb account. Alternatively, you can use a CSV logger. For more details on setting up a wandb account, please refer to the wandb quickstart guide.
You can download the saved models for two datasets from the following links:
Place the downloaded saved
folder in the root directory.
In the configuration file for the respective dataset, set <phase>_reload
to True
,
and <phase>_model_path
with the path of the downloaded model.
@article{10530439,
title = {Knowledge Graphs and Pretrained Language Models Enhanced Representation Learning for Conversational Recommender Systems},
author = {Qiu, Zhangchi and Tao, Ye and Pan, Shirui and Liew, Alan Wee-Chung},
year = 2024,
journal = {IEEE Transactions on Neural Networks and Learning Systems},
volume = {},
number = {},
pages = {1--15},
doi = {10.1109/TNNLS.2024.3395334}
}
Parts of our implementation were inspired by the excellent CRSLab toolkit. We are grateful to the CRSLab developers for open sourcing their valuable work.