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

AttributeError: module 'torchsparse_backend' has no attribute 'hash_forward' #21

Closed
Nekomiya-fubuki opened this issue Jun 19, 2021 · 9 comments

Comments

@Nekomiya-fubuki
Copy link

Hello,I'm sorry to have taken so long to get back to you.Recently,I've installed the system and configurate environment again,but this error is still display(I don't know how to reopen the past issue,so I create a new one.I feel sorry about that):
2021-06-05 15:28:46.856 | INFO | main::35 - Found SyncedPoses.txt, skipping data pre-processing...
2021-06-05 15:28:46.856 | INFO | main::37 - Running NeuralRecon...
2021-06-05 15:28:46.874 | INFO | main::50 - Initializing the model on GPU...
2021-06-05 15:28:50.821 | INFO | main::58 - Resuming from ./checkpoints/model_000047.ckpt
2021-06-05 15:28:51.211 | INFO | main::64 - Start inference..
0%| | 0/110 [00:00<?, ?it/s]/home/u/Documents/NeuralRecon-master/ops/back_project.py:29: UserWarning: This overload of nonzero is deprecated:
nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1595629427478/work/torch/csrc/utils/python_arg_parser.cpp:766.)
batch_ind = torch.nonzero(coords[:, 0] == batch).squeeze(1)
0%| | 0/110 [00:00<?, ?it/s]
Traceback (most recent call last):
File "demo.py", line 76, in
outputs, loss_dict = model(sample, save_scene)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 153, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/neuralrecon.py", line 82, in forward
outputs, loss_dict = self.neucon_net(features, inputs, outputs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/neucon_network.py", line 157, in forward
feat = self.sp_convsi
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/modules.py", line 147, in forward
x0 = initial_voxelize(z, self.pres, self.vres)
File "/home/u/Documents/NeuralRecon-master/ops/torchsparse_utils.py", line 19, in initial_voxelize
pc_hash = spf.sphash(torch.floor(new_float_coord).int())
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse/nn/functional/hash.py", line 39, in sphash
return HashGPU.apply(idx)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse/nn/functional/hash.py", line 11, in forward
return torchsparse_backend.hash_forward(idx.contiguous())
AttributeError: module 'torchsparse_backend' has no attribute 'hash_forward'

I'm sure torchsparse is correctly installed and compilation by the end of the installation is succeeded.Is this casused by a mismatch between the torch version and the torchsparse version?
my pytorch = 1.6.0;torchvision == 0.7.0

@zhouzilong2020
Copy link

I encountered nearly the same problem here. And I highly doubted that it should come from a mismatch in version. Can the version for each required package be specified according to your environment?

@JiamingSuen
Copy link
Member

Please refer to the version information I posted here.
#19 (comment)

I'll get back to this problem once CVPR is over in the next week.

@Nekomiya-fubuki
Copy link
Author

Oh.Thanks a lot.I will try to udpate each packages version.Hope that is useful.

@JiamingSuen
Copy link
Member

I've added support for the new APIs in torchsparse==1.4.0. Everything should be working fine now. Feel free to reopen this issue if the problem persists. @Nekomiya-fubuki

@Nekomiya-fubuki
Copy link
Author

I've added support for the new APIs in torchsparse==1.4.0. Everything should be working fine now. Feel free to reopen this issue if the problem persists. @Nekomiya-fubuki

thanks for your advice.Finally,I solve this problem,but another erro happened.
/home/u/Documents/NeuralRecon-master/ops/back_project.py:29: UserWarning: This overload of nonzero is deprecated:
nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple) (Triggered internally at /opt/conda/conda-bld/pytorch_1595629403081/work/torch/csrc/utils/python_arg_parser.cpp:766.)
batch_ind = torch.nonzero(coords[:, 0] == batch).squeeze(1)
0%| | 0/110 [00:00<?, ?it/s]
Traceback (most recent call last):
File "demo.py", line 76, in
outputs, loss_dict = model(sample, save_scene)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 153, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/neuralrecon.py", line 82, in forward
outputs, loss_dict = self.neucon_net(features, inputs, outputs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/neucon_network.py", line 157, in forward
feat = self.sp_convsi
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/u/Documents/NeuralRecon-master/models/modules.py", line 148, in forward
x0 = initial_voxelize(z, self.pres, self.vres)
File "/home/u/Documents/NeuralRecon-master/ops/torchsparse_utils.py", line 20, in initial_voxelize
sparse_hash = torch.unique(pc_hash)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/_jit_internal.py", line 247, in fn
return if_false(*args, **kwargs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/_jit_internal.py", line 247, in fn
return if_false(*args, **kwargs)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/functional.py", line 695, in _return_output
output, _, _ = _unique_impl(input, sorted, return_inverse, return_counts, dim)
File "/home/u/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/functional.py", line 612, in _unique_impl
return_counts=return_counts,
RuntimeError: CUDA error: invalid device function
Segmentation fault (core dumped)

Is it the cuda version erro?My environment cuda == 10.2 ;GPU driver version == 465.27

@JiamingSuen
Copy link
Member

This should be an environment problem. Maybe you can take a look at this reply. You can also try to reinstall the neucon conda environment from scratch.

@HeCraneChen
Copy link

I've added support for the new APIs in torchsparse==1.4.0. Everything should be working fine now. Feel free to reopen this issue if the problem persists. @Nekomiya-fubuki

Hi Jiaming, I was using torch sparse 1.4.0, and it can be imported. But I ran into a similar but slightly different bug. Do you have any suggestions about this?

AttributeError: module 'torchsparse.backend' has no attribute 'hash_cuda'

Traceback (most recent call last):
File "main.py", line 312, in
train()
File "main.py", line 216, in train
loss, scalar_outputs = train_sample(sample)
File "main.py", line 292, in train_sample
outputs, loss_dict = model(sample)
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 511, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/task_runtime/models/neuralrecon.py", line 83, in forward
outputs, loss_dict = self.neucon_net(features, inputs, outputs)
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/task_runtime/models/neucon_network.py", line 158, in forward
feat = self.sp_convsi
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/task_runtime/models/modules.py", line 149, in forward
x0 = initial_voxelize(z, self.pres, self.vres)
File "/mnt/task_runtime/ops/torchsparse_utils.py", line 23, in initial_voxelize
pc_hash = spf.sphash(torch.floor(new_float_coord).int())
File "/miniconda/envs/neocon/lib/python3.7/site-packages/torchsparse/nn/functional/hash.py", line 19, in sphash
return torchsparse.backend.hash_cuda(coords)
AttributeError: module 'torchsparse.backend' has no attribute 'hash_cuda'

@JiamingSuen
Copy link
Member

I've tried to recreate a new conda environment from scratch but I cannot reproduce this issue on my side. Since this is very likely to be a problem of torchsparse, maybe it's a good idea to raise a issue in their repo.

@zhouzilong2020
Copy link

This should be an environment problem. Maybe you can take a look at this reply. You can also try to reinstall the neucon conda environment from scratch.

this fixed my problem, thx a lot!!

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

4 participants