ESRGAN
ESRGAN copied to clipboard
UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead
I have the problem: Model path models/RRDB_ESRGAN_x4.pth. Testing... 1 baboon /usr/local/lib/python3.6/dist-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name)) 2 comic
This is not a problem, it is just a warning. Because pytorch has changed the interface and nn.Upsample is deprecated.
I get the same issue but my process gets killed.
/home/carlos/.local/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name)) Killed
@Hedronmx I think this warning will not kill the program...
You can replace the nn.Upsample to nn.functional.interpolate. You need to re-write the structure, because the whole model is in a nn.Sequential
now and nn.functional.interpolate should be used in the forward function.
You could implement yourself:
class Interpolate(nn.Module):
def __init__(self, scale_factor, mode):
super(Interpolate, self).__init__()
self.interp = nn.functional.interpolate
self.scale_factor = scale_factor
self.mode = mode
def forward(self, x):
x = self.interp(x, scale_factor=self.scale_factor, mode=self.mode)
return x
Then assign it:
upsample = Interpolate(scale_factor=upscale_factor, mode=mode)
@young666 Thanks. We are now updating a new version for ESRGAN testing codes and BasicSR repo and we will fix it.