As written in the title, InstanceNorm2d requires a size of tensor (N, C, H, W) or (C, H, W) where H and W must be greater than 1.
I cannot figure out where the error occurred but one clear thing is somewhere InstanceNorm2d takes (128, 512, 1, 1) as an input.
You should find where it is.