ValueError: `training_neg_sample_num` should be 0 if inter_feat have label_field [label].
See original GitHub issueI 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?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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_num
andtrain_data.dataset.item_num
?