hotpotqa / hotpot

Apache License 2.0
445 stars 75 forks source link

Training error #30

Closed saravananpsg closed 4 years ago

saravananpsg commented 4 years ago

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.

qipeng commented 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.

saravananpsg commented 4 years ago

@qipeng It works! Thank you for your swift response :-)