You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "new_main.py", line 120, in
for user, batch_graph, label, last_item, neg_tar in test_data:
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/_utils.py", line 434, in reraise
raise exception
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
return self.collate_fn(data)
File "new_main.py", line 92, in
test_data = DataLoader(dataset=test_set, batch_size=opt.batchSize, collate_fn=lambda x: collate_test(x, data_neg), pin_memory=True, num_workers=8)
File "/export/hdd/scratch/yjiang400/DGSR/DGSR.py", line 341, in collate_test
return torch.tensor(user).long(), dgl.batch(graph), torch.tensor(label).long(), torch.tensor(last_item).long(), torch.Tensor(neg_generate(user, user_neg)).long()
File "/export/hdd/scratch/yjiang400/DGSR/DGSR.py", line 326, in neg_generate
neg[i] = np.random.choice(data_neg[u], neg_num, replace=False)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/pandas/core/series.py", line 871, in getitem
result = self.index.get_value(self, key)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4405, in get_value
return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
File "pandas/_libs/index.pyx", line 80, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 90, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 135, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index_class_helper.pxi", line 109, in pandas._libs.index.Int64Engine._check_type
KeyError: tensor([0])
The text was updated successfully, but these errors were encountered:
yihanjjj
changed the title
How to disable the training and only enable the inference?
Got the following error during the testing
Jun 10, 2022
You may try to change np.random.choice(data_neg[u], neg_num, replace=False) to np.random.choice(data_neg[u.item()], neg_num, replace=False) in line 326 of DGSR.py.
Traceback (most recent call last):
File "new_main.py", line 120, in
for user, batch_graph, label, last_item, neg_tar in test_data:
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/_utils.py", line 434, in reraise
raise exception
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
return self.collate_fn(data)
File "new_main.py", line 92, in
test_data = DataLoader(dataset=test_set, batch_size=opt.batchSize, collate_fn=lambda x: collate_test(x, data_neg), pin_memory=True, num_workers=8)
File "/export/hdd/scratch/yjiang400/DGSR/DGSR.py", line 341, in collate_test
return torch.tensor(user).long(), dgl.batch(graph), torch.tensor(label).long(), torch.tensor(last_item).long(), torch.Tensor(neg_generate(user, user_neg)).long()
File "/export/hdd/scratch/yjiang400/DGSR/DGSR.py", line 326, in neg_generate
neg[i] = np.random.choice(data_neg[u], neg_num, replace=False)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/pandas/core/series.py", line 871, in getitem
result = self.index.get_value(self, key)
File "/usr/scratch/yjiang400/miniconda3/envs/dgsr/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 4405, in get_value
return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
File "pandas/_libs/index.pyx", line 80, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 90, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 135, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index_class_helper.pxi", line 109, in pandas._libs.index.Int64Engine._check_type
KeyError: tensor([0])
The text was updated successfully, but these errors were encountered: