RecBole: ValueError: `training_neg_sample_num` should be 0 if inter_feat have label_field [label].
I am getting the following error for LightGCN
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-0b2a29229228> in <module>
47
48 # dataset splitting
---> 49 train_data, valid_data, test_data = data_preparation(config, dataset)
50
51 # model loading and initialization
c:\users\laxmi\downloads\recbole\recbole\data\utils.py in data_preparation(config, dataset, save)
101 if config['training_neg_sample_num']:
102 if dataset.label_field in dataset.inter_feat:
--> 103 raise ValueError(f'`training_neg_sample_num` should be 0 '
104 f'if inter_feat have label_field [{dataset.label_field}].')
105 train_distribution = config['training_neg_sample_distribution'] or 'uniform'
ValueError: `training_neg_sample_num` should be 0 if inter_feat have label_field [label].
If I set training_neg_sample_num=0 then I get another error saying
c:\users\laxmi\downloads\recbole\recbole\model\general_recommender\lightgcn.py in calculate_loss(self, interaction)
136 user = interaction[self.USER_ID]
137 pos_item = interaction[self.ITEM_ID]
--> 138 neg_item = interaction[self.NEG_ITEM_ID]
139
140 user_all_embeddings, item_all_embeddings = self.forward()
c:\users\laxmi\downloads\recbole\recbole\data\interaction.py in __getitem__(self, index)
103 def __getitem__(self, index):
104 if isinstance(index, str):
--> 105 return self.interaction[index]
106 else:
107 ret = {}
KeyError: 'neg_pid'
Any idea, how to remove this error?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (1 by maintainers)
@laxmimerit Yes! You are right, the process of converting token to id is called remap, which is done in
dataset.py, and I must admit that it may bring some confusion to new comers.Can you offer the full output of error? I’m confused, too. And you said that it will raise error when you pass some big number of
uid, can you offertrain_data.dataset.user_numandtrain_data.dataset.item_num?Yes, the whold code.
eval_settingshould beRO_RS,uni100,training_neg_sample_numshould be1. And we suggest thatmetricsandvalid_metrichad better be top-k metrics which will improve the model performance. You can refer this page to learn more abouteval_settingandmetrics.