Output function cannot calculate gradient
Closed this issue · 1 comments
Hello,
I tried to run the Navier-Stokes example in Jupyter Notebook as shown in the tutorial. However, I found an issue that if the output function needs to calculate the gradient, the code gets an error said that the output of the neural networks doesn't require gradient. It is weird since the model can train but when I validate or test the model I will get this error message. The Hydra approach works fine. Do you have any idea why that happened?
Thanks!
For someone who might have the same issue, in Hydra configuration file, the inference_mode was set to false, but the default settings in lightning.Trainer is True. So you need to set inference_mode=false when you use Jupyter Notebook and define the trainer like trainer = pl.Trainer(inference_mode=false)