Code release for "Learning from Missing Relations: Contrastive Learning with Commonsense Knowledge Graphs for Commonsense Inference"
Download Similarity Matrix :
gdown https://drive.google.com/uc?id=1EHMIZXP_T1UfSzCWv9Is16n8DRW3dGJx
Commonsense Knowledge Graph Sources :
- Download the above files, and preprocess each element in tab-separated tsv format.
# examples
subject1 \t relation1 \t object1
subject2 \t relation2 \t object2
...
- Modify the preprocessed data path in config/{dataset}/dataset.yml
name: 'atomic'
truncate:
subj_len: 25
obj_len: 25
dir:
train: {your path}
dev: {your path}
test: {your path}
sim: ## <- This is similarity matrix. you can download it from the above url.
train: {your path}
dev: {your path}
python scripts/finetune.py --dataset_type {dataset} --model_name {model_name} --model_size {model_size}
python scripts/feature_learn.py --dataset_type {dataset} --model_name {model_name} --model_size {model_size}