Describe the bug
When training dann using multiple GPUs with PyTorch lightning lib the following error arises:
AttributeError: Can't pickle local object 'DomainAdversarialLoss._ init _.locals>.lambda>'
To Reproduce
Wrap the dann model inside a lightningModule
Expected behavior
Training runs smoothly without problems
Desktop (please complete the following information):
OS: osx
Fix
Remove the unused 66 and 67 lines from tllib/alignment/dann.py file. The lines contain a lambda function that cannot be pickled, thus it cannot be shared across multiple processes.
The code is:
self.bce = lambda input, target, weight: F.binary_cross_entropy(input, target, weight=weight, reduction=reduction)
Describe the bug When training dann using multiple GPUs with PyTorch lightning lib the following error arises: AttributeError: Can't pickle local object 'DomainAdversarialLoss._ init _.locals>.lambda>' To Reproduce Wrap the dann model inside a lightningModule
Expected behavior Training runs smoothly without problems
Desktop (please complete the following information):
Fix Remove the unused 66 and 67 lines from tllib/alignment/dann.py file. The lines contain a lambda function that cannot be pickled, thus it cannot be shared across multiple processes.
The code is: self.bce = lambda input, target, weight: F.binary_cross_entropy(input, target, weight=weight, reduction=reduction)