juglab / FourierImageTransformer

Fourier Image Transformer (FIT) can solve relevant image analysis tasks in Fourier space.
BSD 3-Clause "New" or "Revised" License
95 stars 13 forks source link

Error when training in the MNIST example #19

Open rkushol opened 3 years ago

rkushol commented 3 years ago

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)
tibuch commented 3 years ago

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?

rkushol commented 3 years ago

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

tibuch commented 3 years ago

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!