I don’t know exactly what’s causing the error, but try to replace the lambda operations with custom transformations implemented as classes. You could use any torchvision.transforms 7 as the boilerplate.
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier