plot_config(args) heads, tails = loader.heads_tails() head_idx, tail_idx, head_cache, tail_cache, head_pos, tail_pos = loader.get_cache_list( ) caches = [head_idx, tail_idx, head_cache, tail_cache, head_pos, tail_pos] train_data = [torch.LongTensor(vec) for vec in train_data] valid_data = [torch.LongTensor(vec) for vec in valid_data] test_data = [torch.LongTensor(vec) for vec in test_data] tester_val = lambda: model.test_link(valid_data, n_ent, heads, tails, args. filter) tester_tst = lambda: model.test_link(test_data, n_ent, heads, tails, args. filter) corrupter = BernCorrupter(train_data, n_ent, n_rel) model = BaseModel(n_ent, n_rel, args) if args.load: model.load(os.path.join(args.task_dir, args.model + '.mdl')) tester_val() tester_tst() best_str = model.train(train_data, caches, corrupter, tester_val, tester_tst) with open(args.perf_file, 'a') as f: print('Training finished and best performance:', best_str) f.write('best_performance: ' + best_str)