RUCAIBox / RecBole

A unified, comprehensive and efficient recommendation library
https://recbole.io/
MIT License
3.48k stars 615 forks source link

[🐛BUG] RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat2' in call to _th_bmm_out #656

Closed dxjjhm closed 3 years ago

dxjjhm commented 3 years ago

` from recbole.quick_start import run_recbole

if name == 'main': param_dict = { "gpu_id": 1, "use_gpu": False }

run_recbole(model='BERT4Rec',
            dataset='ynyd',
            config_file_list=['/data/home/c/w/recbole/properties/BERT4Rec.ynyd.yaml'],
            config_dict=param_dict)

` run then throw Error Follow as

File "/data/home/c/anaconda3/envs/pytorch/lib/python3.7/site-packages/recbole/quick_start/quick_start.py", line 52, in run_recbole best_valid_score, best_valid_result = trainer.fit(train_data, valid_data, saved=saved) File "/data/home/c/anaconda3/envs/pytorch/lib/python3.7/site-packages/recbole/trainer/trainer.py", line 245, in fit train_loss = self._train_epoch(train_data, epoch_idx) File "/data/home/c/anaconda3/envs/pytorch/lib/python3.7/site-packages/recbole/trainer/trainer.py", line 144, in _train_epoch losses = loss_func(interaction) File "/data/home/c/anaconda3/envs/pytorch/lib/python3.7/site-packages/recbole/model/sequential_recommender/bert4rec.py", line 210, in calculate_loss seq_output = torch.bmm(pred_index_map, seq_output) # [B mask_len H] RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat2' in call to _th_bmm_out

dxjjhm commented 3 years ago

set use_gpu false, but when run, it is using cuda. recbole/model/sequential_recommender/bert4rec.py", line 210, in calculate_loss

2017pxy commented 3 years ago

@dxjjhm We have already fixed this bug in #556 and we will fix this bug in next version.