EverybodyDanceNow_reproduce_pytorch icon indicating copy to clipboard operation
EverybodyDanceNow_reproduce_pytorch copied to clipboard

create web directory ./checkpoints/target/web... End of epoch 1 / 40 Time Taken: 898 sec Traceback (most recent call last): File "train_pose2vid.py", line 127, in <module> main() File "train_pose2vid.py", line 84, in main errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()} File "train_pose2vid.py", line 84, in <dictcomp> errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()} IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Open jackylee1 opened this issue 6 years ago • 2 comments

create web directory ./checkpoints/target/web... End of epoch 1 / 40 Time Taken: 898 sec Traceback (most recent call last): File "train_pose2vid.py", line 127, in main() File "train_pose2vid.py", line 84, in main errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()} File "train_pose2vid.py", line 84, in errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()} IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

jackylee1 avatar Mar 20 '19 10:03 jackylee1

Did anybody find the quick-fix for this? Having the same error

aiXander avatar Mar 26 '19 08:03 aiXander

Ait so aparantly, batch_size is set to 1 in src/config/train_opt.py, therefore v.data[0] does not work and you have to:

  • Either set the batch_size to a value different from 1
  • or use v.item()

aiXander avatar Mar 26 '19 13:03 aiXander