cdvae: InstantiationException: a leaf Variable that requires grad is being used in an in-place operation
Followed the faster conda installation instructions from the README on WSL2 (files and environment localized to the WSL2 storage) and got the same error as in https://github.com/txie-93/cdvae/issues/2#issuecomment-1153064071.
Exception has occurred: InstantiationException (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Error in call to target 'cdvae.pl_modules.model.CDVAE':
InstantiationException("Error in call to target 'cdvae.pl_modules.gnn.DimeNetPlusPlusWrap':\nRuntimeError('a leaf Variable that requires grad is being used in an in-place operation.')\nfull_key: encoder")
full_key: model
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 92, in _call_target
return _target_(*args, **kwargs)
File "/home/sgbaird/cdvae/cdvae/pl_modules/gnn.py", line 327, in __init__
super(DimeNetPlusPlusWrap, self).__init__(
File "/home/sgbaird/cdvae/cdvae/pl_modules/gnn.py", line 223, in __init__
self.rbf = BesselBasisLayer(num_radial, cutoff, envelope_exponent)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/torch_geometric/nn/models/dimenet.py", line 59, in __init__
self.reset_parameters()
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/torch_geometric/nn/models/dimenet.py", line 62, in reset_parameters
torch.arange(1, self.freq.numel() + 1, out=self.freq).mul_(PI)
The above exception was the direct cause of the following exception:
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 92, in _call_target
return _target_(*args, **kwargs)
File "/home/sgbaird/cdvae/cdvae/pl_modules/model.py", line 140, in __init__
self.encoder = hydra.utils.instantiate(
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 222, in instantiate
return instantiate_node(
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 339, in instantiate_node
return _call_target(_target_, partial, args, kwargs, full_key)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
raise InstantiationException(msg) from e
The above exception was the direct cause of the following exception:
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
raise InstantiationException(msg) from e
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 339, in instantiate_node
return _call_target(_target_, partial, args, kwargs, full_key)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 222, in instantiate
return instantiate_node(
File "/home/sgbaird/cdvae/cdvae/run.py", line 94, in run
model: pl.LightningModule = hydra.utils.instantiate(
File "/home/sgbaird/cdvae/cdvae/run.py", line 166, in main
run(cfg)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
ret.return_value = task_function(task_cfg)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
raise self._return_value
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
_ = ret.return_value
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/utils.py", line 453, in <lambda>
lambda: hydra.run(
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/utils.py", line 216, in run_and_report
raise ex
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/utils.py", line 216, in run_and_report
raise ex
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/utils.py", line 452, in _run_app
run_and_report(
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/_internal/utils.py", line 389, in _run_hydra
_run_app(
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/site-packages/hydra/main.py", line 90, in decorated_main
_run_hydra(
File "/home/sgbaird/cdvae/cdvae/run.py", line 170, in <module>
main()
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/sgbaird/miniconda3/envs/cdvae/lib/python3.9/runpy.py", line 197, in _run_module_as_main (Current frame)
return _run_code(code, main_globals, None,
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19
One thing that might also help is installing using the env.ci-cu11.yml from https://github.com/knc6/cdvae/tree/pip. I was able to get this code running after installing using packages one by one following the env.ci-cu11.yml. Additionally, I reccommend installing torch-cluster torch-scatter torch-sparse torch-spline-conv all from source. Here is my pip list.
I am running on an NVIDIA A4500 with Ubuntu 22.04 and Cuda 11.7
@holywater2 wow! Nice work. I might loop back to this and try to prepare a Colab notebook.
@sgbaird Hi, I solved the problem. The error message
is due to the pyg version.
You can find this problem at #https://github.com/pyg-team/pytorch_geometric/pull/4424 and solved by #https://github.com/pyg-team/pytorch_geometric/pull/4424/files/67a1babccfd8509df7acc5dae326b9728b697c69#diff-902b09f3ae69a1b7cd16a3c3e592cce64922bb3b3fe25a4b95d741b5e6830b3b
So I think you can fix the error by downloading fixed-version of pyg, but I simply modified the dimenet code of pytorch geometric of version 2.0.4.
I modified the
BesselBasisLayerintorch_geometric.nn.models.dimenet.pyas follows:@sgbaird @SillyUglyPig The error stopped occurring for me if I upgraded to pyg-nightly. However, I haven’t been able to run to code for other reasons. But I think they are unrelated to pyg.