Efficientnet_pytorch breaks on 'ddp'
🐛 Bug

I'm trying to train an Efficientnet-B0 model using the implementation from  https://github.com/lukemelas/EfficientNet-PyTorch repository.  Now even though it works fine in 'dp' mode it breaks on 'ddp' or 'ddp2' and i keep getting the following error :

RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by (1) passing the keyword argument find_unused_parameters=True to torch.nn.parallel.DistributedDataParallel; (2) making sure all forward function outputs participate in calculating loss. If you already have done the above two steps, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's forward function. Please include the loss function and the structure of the return value of forward of your module when reporting this issue (e.g. list, dict, iterable).

I am just using your vanilla mnist script in pl_examples/basic_examples/simple_image_classifier and modified the__init__ and forward methods to use Efficientnet-B0 :
from efficientnet_pytorch import EfficientNet
def __init__(self, hidden_dim=128, learning_rate=1e-3):
    super().__init__()
    self.save_hyperparameters()

    self.cnn1 = torch.nn.Conv2d(1, 3, kernel_size=3)
    self.efficientnet = EfficientNet.from_name(
        "efficientnet-b0", include_top=False, drop_connect_rate=0.1
    )

    self.l1 = torch.nn.Linear(1280, 10)

def forward(self, x):

    x = self.cnn1(x)
    x = self.efficientnet(x)

    x = x.squeeze(3).squeeze(2)
    x = torch.relu(self.l1(x))

    return x

I also tried setting find_unused_parameters=True  in the following way using DDPPlugin:
    from pytorch_lightning.plugins import DDPPlugin
    trainer = pl.Trainer.from_argparse_args(args,
                                            plugins=[DDPPlugin(find_unused_parameters=True)]
                                            )

This time i didnt get the above error but it behaves super bizarre as in that runs two epochs, make a gigantic (~10 minute pause), runs another two epochs and then even a larger pause, and on and on ..
Expected behavior
I would expect it to work just as the original mnist script in the distributed ddp mode.