Hello,
I am new at PyTorch Lightning. So, I am trying to learn the basics. When I am trying to run code from here (UNet implementation using PyTorch Lightning), I am getting an error AttributeError: module 'pytorch_lightning' has no attribute 'data_loader'.
The code is fully the same. I am getting the error in this block,
Only the decorator (just that one line). Let me know if you run into any other issues (this code appears to be using a much older version, but I think everything else should still work in 1.0)
Thank you @teddy
Now, no compile-time error but showing run-time error only batches of spatial targets supported (3D tensors) but got targets of dimension: 4!
File "/PyTorch/UNet-PyTorch/scripts/unet.py",
line 102, in training_step loss = F.cross_entropy(y_hat, y) if self.n_classes > 1 else F.binary_cross_entropy_with_logits(y_hat, y)
File "/PyTorch/UNet-PyTorch/scripts/train.py",
line 46, in main trainer.fit(model)
File "/PyTorch/UNet-PyTorch/run_train.py",
line 14, in <module> main(hparams)
I made a simple change of the main code is, I am running the train.py from another file run_train.py.
I’m assuming your segmentation mask has an extra dimension for classes, you have to either .squeeze() this dimension if it is one class, change n_classes to be the actually number of classes.