mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.
https://torchsparse.mit.edu
MIT License
1.16k stars 132 forks source link

[BUG] No module or method, attribute in the usage of other repository #219

Closed YunsikShin closed 1 year ago

YunsikShin commented 1 year ago

Is there an existing issue for this?

Current Behavior

I'm reproducing the SPVNAS github code. There are few lines that have issues like below.

  1. train.py # 65 F.set_conv_mode(2) => module 'torchsparse.nn.functional' has no attribute 'set_conv_mode'
  2. core.models.utils.py # 38 hashmap = torchsparse.backend.GPUHashTable(hashmap_keys, hashmap_vals) => AttributeError: module 'torchsparse.backend' has no attribute 'GPUHashTable'
  3. core.models.utils.py # 26 self._caches.idx_query = dict() => AttributeError: 'PointTensor' object has no attribute '_caches'
    • PointTensor in spvnas inherits torchsparse SparseTensor class, so self._caches must be defined in torchsparse SparseTensor

I've searched the old versions of torchsparse and I could not find the set_conv_mode or GPUHashTable and other methods. I installed torchsparse from pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git

Is there anything I missed on the installation??

Expected Behavior

Examples of the current behavior should act normally.

Environment

- GCC:9.4.0
- NVCC:
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
- PyTorch: 1.8.2+cu111
- PyTorch CUDA: 11.1
- TorchSparse: 2.0.0b0

Anything else?

No response

ArlenCHEN commented 1 year ago

@YunsikShin Did you solve the issue? I am facing similar one of the issues

File "torchsparse/nn/modules/conv.pyx", line 99, in torchsparse.nn.modules.conv.Conv3d.forward
File "torchsparse/nn/functional/conv/conv.pyx", line 71, in torchsparse.nn.functional.conv.conv.conv3d
AttributeError: 'SparseTensor' object has no attribute '_caches'
antonyvan commented 1 year ago

I am having the same issues.
With torchsparse2.0, it looks like we don't have these functions and variables. Maybe they are included in torchsparse1.4 but I can't download 1.4.

zhijian-liu commented 1 year ago

Please install the latest version (v2.1.0) of TorchSparse with

python -c "$(curl -fsSL https://raw.githubusercontent.com/mit-han-lab/torchsparse/master/install.py)"