jleuschn / dival

Deep Inversion Validation Library
MIT License
74 stars 13 forks source link

error when running ct_diptv.py #32

Closed gmzang closed 3 years ago

gmzang commented 3 years ago

Hi First of all, thanks a lot for this excellent library! When I tried the DIPTV demo in the example folder, it returns an error shown below, which seems related to the new version of autograd with ODL. Do you have any hint on how to solve this issue? For example, installing an older version of pytorch (or ODL ) can help?? Thanks in advance.

(base) zan@pc-kw-60:~/projects/dival/dival/examples$ python3 ct_diptv.py DIP: 0%| | 0/17000 [00:00<?, ?it/s] Traceback (most recent call last): File "ct_diptv.py", line 36, in reco = reconstructor.reconstruct(obs) File "/home/zan/anaconda3/lib/python3.7/site-packages/dival/reconstructors/reconstructor.py", line 529, in reconstruct reconstruction = super().reconstruct(observation, out=out) File "/home/zan/anaconda3/lib/python3.7/site-packages/dival/reconstructors/reconstructor.py", line 198, in reconstruct reco = self._reconstruct(observation) File "/home/zan/anaconda3/lib/python3.7/site-packages/dival/reconstructors/dip_ct_reconstructor.py", line 154, in _reconstruct loss = criterion(self.ray_trafo_module(output), File "/home/zan/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/home/zan/anaconda3/lib/python3.7/site-packages/odl/contrib/torch/operator.py", line 397, in forward results.append(self.op_func(x_flat_xtra[i])) File "/home/zan/anaconda3/lib/python3.7/site-packages/torch/autograd/function.py", line 149, in call "Legacy autograd function with non-static forward method is deprecated. " RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)

jleuschn commented 3 years ago

Hi, thanks a lot for the compliment!

You can try upgrading ODL to the latest master version. pip install https://github.com/odlgroup/odl/archive/master.zip --upgrade

Just let me know if it does not help. In that case, with which version of odl and pytorch does this error occur?

Best, Johannes

gmzang commented 3 years ago

Johannes, After upgrading the ODL as you suggested, it work perfectly now. Thanks a lot for your promptly reply and kind help. I am closing this issue now. Cheer