Open imostafizur opened 2 years ago
I have the same error. @adityaramesh please help with this.
The error 'Upsample' object has no attribute 'recompute_scale_factor'
is related to a change in the torch Upscale class from 1.10 to 1.11.
It appears that 'old' Upscale objects are saved within the model after this line of code:
model = load_model("https://cdn.openai.com/dall-e/decoder.pkl", 'cuda')
i used the following code immediatly after the load_model call to patch this:
# Patch for torch 1.11 and higher: replace the old Upsample object by the new version
# that exposes recompute_scale_factor
_ = model.blocks.group_1.upsample
model.blocks.group_1.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)
_ = model.blocks.group_2.upsample
model.blocks.group_2.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)
_ = model.blocks.group_3.upsample
model.blocks.group_3.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)
and it's running fine with torch 1.12.1!
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'. Can you please tell me why this error occurs?