Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Freezing is currently only implemented for modules for modules in eval mode #42

Open
Nekomiya-fubuki opened this issue Sep 9, 2022 · 0 comments

Comments

@Nekomiya-fubuki
Copy link

Thank you for sharing this great paper and excellent code.
I followed the README file in CVA-MMVSNET.When I tried to run the code to export to C++, there was a runtimeerroe.Could you please help me?
Thank you for your time.

python export_model.py --data_dir tandem_replica --out_dir cpp_exported_models --model pretrained/ablation/abl04_fewer_depth_planes.ckpt --height 480 --width 640 --view_num 7 --jit_freeze --jit_run_frozen_optimizations

/mnt/b7074bde-e07b-4bc7-8b24-a7b759401d85/Ji/tandem-master/cva_mvsnet/models/module.py:1498: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert (depth > 0).all(), f"Depth min = {torch.min(depth)}"
/mnt/b7074bde-e07b-4bc7-8b24-a7b759401d85/Ji/tandem-master/cva_mvsnet/models/module.py:24: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if nans.any() or infs.any():
/mnt/b7074bde-e07b-4bc7-8b24-a7b759401d85/Ji/tandem-master/cva_mvsnet/models/module.py:27: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert not (nans.any() or infs.any()), msg
/mnt/b7074bde-e07b-4bc7-8b24-a7b759401d85/Ji/tandem-master/cva_mvsnet/models/module.py:1561: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert (depth_range > 0).all(
--- jit_freeze
Traceback (most recent call last):
File "export_model.py", line 230, in
main(parser.parse_args())
File "export_model.py", line 196, in main
traced_script_module = torch.jit.freeze(traced_script_module)
File "/home/u/anaconda3/envs/tandem/lib/python3.7/site-packages/torch/jit/_freeze.py", line 92, in freeze
"Freezing is currently only implemented for modules in eval mode. "
RuntimeError: Freezing is currently only implemented for modules in eval mode. Please call .eval() on your module before freezing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant