Skip to content

Commit 28d3edd

Browse files
committed
fix rsme
1 parent a261ea5 commit 28d3edd

13 files changed

+10
-8
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ training/
1010

1111
*.pkl
1212

13-
*.pth
13+
*.pth
14+
15+
.DS_Store/*
File renamed without changes.

M-KGE/IKRL_TransAE/IKRL.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from tqdm import tqdm
1212
import ctypes
1313
import pickle
14-
from DATA import TrainDataLoader, TestDataLoader
14+
from DATA_ import TrainDataLoader, TestDataLoader
1515
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
1616

1717

M-KGE/IKRL_TransAE/TransAE.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pickle
1515
import gensim
1616
import random
17-
from DATA import TrainDataLoader, TestDataLoader
17+
from DATA_ import TrainDataLoader, TestDataLoader
1818
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
1919

2020

-531 KB
Binary file not shown.

M-KGE/RSME/data/analogy/test.pickle

260 KB
Binary file not shown.

M-KGE/RSME/data/analogy/train.pickle

260 KB
Binary file not shown.

M-KGE/RSME/data/analogy/valid.pickle

260 KB
Binary file not shown.

M-KGE/RSME/image_encoder.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def extract_feature(self,base_path):
3131
self.model.eval()
3232
dict = {}
3333

34-
file = open('analogy_best_img.pickle', 'rb')
34+
file = open('data/analogy/analogy_best_img.pickle', 'rb')
3535
fb15k_best_img = pickle.load(file)
3636
file.close()
37-
img_paths = list(fb15k_best_img.values())
37+
img_paths = [os.path.join(base_path, value) for value in list(fb15k_best_img.values())]
3838
print(len(img_paths))
3939
pbart = tqdm(total=len(img_paths))
4040
while len(img_paths) > 0:
@@ -171,7 +171,7 @@ def save_embedding(self,output_file):
171171
if __name__ == "__main__":
172172

173173
model1 = VisionTransformer()
174-
base_path = '../MarT/dataset/MARS/images/'
174+
base_path = 'data/images/'
175175
model1.get_embedding(base_path)
176176
model1.save_embedding('analogy_vit_best_img_vec.pickle')
177177

M-KGE/RSME/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_img_vec_array_forget(proportion,remember_proportion,rank_file='fb15k_vit
4444
continue
4545
rel_rank[rel[10:]]=float(mrp[12:])
4646

47-
with open('../MarT/dataset/MarKG/relation2text.txt', 'r') as f:
47+
with open('../../MarT/dataset/MarKG/relation2text.txt', 'r') as f:
4848
Lines=f.readlines()
4949

5050
rel_id_pd=[]
@@ -79,7 +79,7 @@ def get_img_vec_sig_alpha(proportion,rank_file='fb15k_vit_rank.txt',eutput_file=
7979
continue
8080
rel_rank[rel[10:]]=float(mrp[12:])
8181

82-
with open('../MarT/dataset/MarKG/relation2text.txt', 'r') as f:
82+
with open('../../MarT/dataset/MarKG/relation2text.txt', 'r') as f:
8383
Lines=f.readlines()
8484

8585
rel_sig_alpha=[]

0 commit comments

Comments
 (0)