Open EinAeffchen opened 6 years ago
This is because of pytorch version
I'm also experiencing this. Any help or work around?
Thanks
@joistick11 What is the proper version of PyTorch that should be run to avoid this problem?
Nvm, corrected it in line based on answers found elsewhere on Github and Stack:
For example in the file: practical-pytorch/char-rnn-generation/train.py, line 49:
loss += criterion(output, target[c])
should be changed to:
loss += criterion(output, target[c].unsqueeze(0))
Although when I run this, I still am getting the following warning: "UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number"
Change line 54 from this:
return loss.data[0] / args.chunk_len
to:
return loss.data.item() / args.chunk_len
Version 0.2.0 works fine without any changes.
Just tried to run train.py with the shakespeare.txt without changing anything