As the error message claims, your output activation is too small for the last conv layer.
Inline are the output activation shapes:
(encoder): Sequential(
(0): Conv2d(1, 32, kernel_size=(4, 4), stride=(2, 2)) # [batch_size, 32, 15, 15]
(1): LeakyReLU(negative_slope=0.2)
(2): Conv2d(32, 64, kernel_size=(4, 4), stride=(2, 2)) # [batch_size, 64, 6, 6]
(3): LeakyReLU(negative_slope=0.2)
(4): Conv2d(64, 128, kernel_size=(4, 4), stride=(2, 2)) # [batch_size, 128, 2, 2]
(5): LeakyReLU(negative_slope=0.2)
(6): Conv2d(128, 256, kernel_size=(4, 4), stride=(2, 2)) # ERROR: 2x2 is too small for a 4x4 kernel
(7): LeakyReLU(negative_slope=0.2)
(8): Flatten()
)

You could either increase the input shape or decrease the kernel shapes.
Alternatively you could also add padding to the preceding layers, so that the spatial size won’t be decreased so much.