HKUDS / KGRec

[KDD'2023] "KGRec: Knowledge Graph Self-Supervised Rationalization for Recommendation"
https://arxiv.org/abs/2307.02759
Apache License 2.0
55 stars 3 forks source link

model problem #3

Closed Pursuerwener closed 1 year ago

Pursuerwener commented 1 year ago

Thank you very much for sharing i run the code python run_kgrec.py --dataset last-fm to process the dataset When I ran it(python run_kgrec.py --dataset last-fm) the second time to train i get this error

NameError: name 'test_user_set' is not defined

Pursuerwener commented 1 year ago

20230905091956(1) after i run the code python run_kgrec.py --dataset ailibaba-fashion i run the code again i get this running report And then I got this error.Unable to obtain results NameError: name 'test_user_set' is not defined Requesting Your Help

yuh-yang commented 1 year ago

Hi,

Can you post the error stack track so that I can better help?

UPCRS commented 1 year ago

20230905091956(1) 在我的运行代码 python run_kgrec.py --dataset ailibaba-fashion 之后, 我再次运行代码, 我得到了这个运行报告 ,然后我得到了这个错误。 无法获取结果 NameError: name 'test_user_set' is not Defined 请求您的帮助

我也出现了这个问题,请问您解决了吗

UPCRS commented 1 year ago

Hi,

Can you post the error stack track so that I can better help? 为什么会出现上述情况呀,为什么train_cf_triples:那个进度条不动,和楼上情况一样

yuh-yang commented 1 year ago

@wangte123 看起来只是因为打印了std值,截断了一次tqdm progress bar的打印而已,运行时有error吗?

Pursuerwener commented 1 year ago

After running long time ,the error is NameError: name 'test_user_set' is not Defined.Not only the KGRec had the error but also the KGIN had the same problem.I 'm trying to change the code. `Traceback (most recent call last): File "D:\Software\Anaconda\envs\pytorch\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "D:\Software\Anaconda\envs\pytorch\lib\multiprocessing\pool.py", line 48, in mapstar return list(map(args)) File "E:\FengHanWen\experiment-1\KGRec-main\utils\evaluate_kgsr.py", line 93, in test_one_user user_pos_test = test_user_set[u] NameError: name 'test_user_set' is not defined """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "run_kgrec.py", line 141, in ret = test(model, user_dict, n_params) File "E:\FengHanWen\experiment-1\KGRec-main\utils\evaluate_kgsr.py", line 171, in test File "D:\Software\Anaconda\envs\pytorch\lib\multiprocessing\pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "D:\Software\Anaconda\envs\pytorch\lib\multiprocessing\pool.py", line 771, in get raise self._value NameError: name 'test_user_set' is not defined` Thanks for your attention,i need your help @yuh-yang

yuh-yang commented 1 year ago

@Pursuerwener

it's strange since test_user_set should be globalized at line 117 global train_user_set, test_user_set .

Would you provide full script for evaluate_kgsr.py?

Pursuerwener commented 1 year ago

Thanks for your reply yes,I noticed your code global train_user_set, test_user_set as soon as I started reproducing it. This error also exists in the evaluate.py when i run the run_kgin.py Fortunately,the running of KGCL is no problem code.zip

yuh-yang commented 1 year ago

That's because KGCL uses a class-based evaluator. I guess the problem lies in multiprocessing on Windows. Plz try any of the potential solutions:

  1. use Linux
  2. use KGCL's class-based evaluator for KGIN and KGRec
  3. stop using multiprocessing for test_one_user
Pursuerwener commented 1 year ago

i use your second method i get this error Traceback (most recent call last): File "run_kgin.py", line 126, in <module> ret = Evaluator.test(model, user_dict, n_params) TypeError: test() missing 1 required positional argument: 'n_params' running the run_kgrec.pyis the same as above but i checked the evaluator.py,it' no problem i think that the problem is processing on Windows

yuh-yang commented 1 year ago

You have to modify your codes to pass n_params to Evaluator.test()