FourierImageTransformer icon indicating copy to clipboard operation
FourierImageTransformer copied to clipboard

Error when training in the MNIST example

Open rkushol opened this issue 3 years ago • 3 comments

When I uncomment the line trainer.fit(model, datamodule=dm) in the Super-Resolution - MNIST Example.ipynb file, I get this error TypeError: 'NoneType' object is not callable on line 53 of SResTransformer.py file. Could you please take a look why this is happening? I should mention that I had to change some stuff to get the code running. One change was the definition of the trainer object

trainer = Trainer(max_epochs=100, 
                  gpus=1, # set to 0 if you want to run on CPU
                  callbacks = [
                    ModelCheckpoint(
                        dirpath=None,
                        save_top_k=1,
                        verbose=False,
                        save_last=True,
                        monitor='Train/avg_val_loss',
                        mode='min',
                        # prefix='best_val_loss_'
                    )
                  ],
                  deterministic=True)

Another change was to change lines 76 and 77 in SResDataModule.py from

mnist_test = MNIST(self.root_dir, train=False, download=True).data.type(torch.float32)
mnist_train_val = MNIST(self.root_dir, train=True, download=True).data.type(torch.float32)

to

mnist_test = MNIST(self.root_dir, train=False, download=True).test_data.type(torch.float32)
mnist_train_val = MNIST(self.root_dir, train=True, download=True).train_data.type(torch.float32)

rkushol avatar Aug 24 '21 22:08 rkushol

Hi @rkushol,

Thank you for reporting this issue. It looks like some underlying API has changed over the last months. Could you try to use pytorch-lightning==1.2.6?

tibuch avatar Aug 25 '21 07:08 tibuch

Hello, Thanks for your quick response. Tried with pytorch-lightning==1.2.6 but same error.

rkushol avatar Aug 25 '21 17:08 rkushol

Hi @rkushol

I finally got around to look at it. I fixed a couple things that were broken and now it is running on my system again. If you find the time it would be appreciated if you could try it out again :)

Thank you!

tibuch avatar Nov 04 '21 16:11 tibuch