-
-
Save calebrob6/4d7fc311045c4f9015e401100e34ed38 to your computer and use it in GitHub Desktop.
Then on running trainer.fit
you will get
TypeError: `model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `CustomSemanticSegmentationTask`
It is necessary to use the new lightning format for imports:
from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint
from lightning.pytorch import Trainer, seed_everything
from lightning.pytorch.loggers import TensorBoardLogger, WandbLogger
from lightning.pytorch import LightningDataModule
You will next get:
AttributeError: 'CustomSemanticSegmentationTask' object has no attribute 'loss'
It is necessary in the custom trainer to use:
loss: Tensor = self.criterion(y_hat, y)
| Name | Type | Params
0 | criterion | CrossEntropyLoss | 0
1 | train_metrics | MetricCollection | 0
2 | val_metrics | MetricCollection | 0
3 | test_metrics | MetricCollection | 0
4 | model | Unet | 14.3 M
14.3 M Trainable params
0 Non-trainable params
14.3 M Total params
57.351 Total estimated model params size (MB)
Sanity Checking: | | 0/? [00:00<?, ?it/s]
It remains at this stage, what could be the problem?
Hey @mustafaemre2 -- are you running on the GPU?
Updated with @robmarkcole's fixes (and ensured that the notebook runs end-to-end) for torchgeo 0.5.1 (thanks Robin!)
Yes, I used your codes exactly
My GPU's RTX 3060 laptop @calebrob6
You are using a CUDA device ('NVIDIA GeForce RTX 3060 Laptop GPU') that has Tensor Cores. To properly utilize them, you should set torch.set_float32_matmul_precision('medium' | 'high')
which will trade-off precision for performance. For more details, read https://pytorch.org/docs/stable/generated/torch.set_float32_matmul_precision.html#torch.set_float32_matmul_precision
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]
i get this message @calebrob6
Download the dataset and see how many images are in the train and test splits
train_dataset = LEVIRCDPlus(root="data/LEVIRCDPlus", split="train", download=True, checksum=True)
test_dataset = LEVIRCDPlus(root="data/LEVIRCDPlus", split="test", download=True, checksum=True)
len(train_dataset), len(test_dataset)
Its give error :-
RuntimeError: The MD5 checksum of the download file data/LEVIRCDPlus/LEVIR-CD+.zip does not match the one on record.Please delete the file and try again. If the issue persists, please report this to torchvision at https://github.com/pytorch/vision/issues.
i get this msg @calebrob6
@nadeem-git-coder Have you found any solution for that?
@ProtikBose I have downloaded the dataset mannually and use it .
Have you encountered the error?
What the error
Running with torchgeo 0.5.0 will give:
The necessary update: