Closed sizhky closed 4 years ago
Hmm... Actually, I've never seen this kind of error before. It might be from the version compatibility. Your pytorch version seems to be 1.5.0. However, this repository is mainly tested with pytorch 1.1 or 1.2. I read the release note of pytorch 1.5.0 and found that there are some changes in backward and clone function. Please refer to https://github.com/pytorch/pytorch/releases and "Backwards Incompatible Changes" section.
I tested the code again with 1.2. It works well. (I also tested with img_size=64 and also works well). This problem might be solved by using a lower version of pytorch. I think that the code will work with pytorch 1.4 also, but, it is not obvious.
Update
I find another similar issue at https://github.com/pytorch/pytorch/issues/33812 https://github.com/pytorch/pytorch/issues/33812#issuecomment-593407581 The code mentioned work well with pytorch 1.2 but does not work with 1.5.
It might be the version issue! pytorch 1.2 will solve this issue. Please try this code with pytorch 1.2.
It's working, i'm not sure what changed, but the command did not error out after a machine restart...
Edit: just realized it errored out with --img_size 64 but it's working with --img_sz 128
It is weird... I also tested with img_size=64 and it works well.
For future reference, I fixed it on my end by changing these lines: https://github.com/clovaai/tunit/blob/master/tools/ops.py#L69
p_i_j[(p_i_j < EPS).data] = EPS
p_j[(p_j < EPS).data] = EPS
p_i[(p_i < EPS).data] = EPS
to the following:
p_i_j = torch.clamp(p_i_j, min=EPS)
p_j = torch.clamp(p_j, min=EPS)
p_i = torch.clamp(p_i, min=EPS)
@DanRuta Thanks. I will test with the modified code and update it.
Has anyone had any luck with solving this in pytorch 1.5? I'm having the same issue - calling backward() results in the error. The call to backward is on line 381: https://github.com/rsbball11/IIC/edit/master/code/scripts/cluster/cluster_greyscale_twohead.py
For future reference, I fixed it on my end by changing these lines: https://github.com/clovaai/tunit/blob/master/tools/ops.py#L69
p_i_j[(p_i_j < EPS).data] = EPS p_j[(p_j < EPS).data] = EPS p_i[(p_i < EPS).data] = EPS
to the following:
p_i_j = torch.clamp(p_i_j, min=EPS) p_j = torch.clamp(p_j, min=EPS) p_i = torch.clamp(p_i, min=EPS)
@rsbball11 Does not this comment work? There are some changes on optimizer in pytorch1.5.
I also use the same operation of IIC. So the comment might help you.
Oh, yes that does work. I'm new to this so I didn't fully understand where I was supposed to be looking, but I did some more digging in found it. Thanks!
Please find the stacktrace below. Can you let me know what I am doing wrong?