Closed saravananpsg closed 4 years ago
It's likely that you're using a more recent version of pytorch
than we specified.
Replacing this line with
total_loss += loss.item()
Should probably solve the problem.
@qipeng It works! Thank you for your swift response :-)
While training the model, I am getting the following error. I am using torch 1.3.0, CUDA 10 version on a linux machine. Is there an issue with the pytorch version ?
python main.py --mode train --para_limit 2250 --batch_size 24 --init_lr 0.1 --keep_prob 1.0 --sp_lambda 1.0
Error Log: _Traceback (most recent call last): File "main.py", line 84, in
train(config)
File "hotpotqa/hotpot/run.py", line 121, in train
totalloss += loss.data[0]
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
Any help would be appreciated.