HAIS icon indicating copy to clipboard operation
HAIS copied to clipboard

TypeError: forward() takes 6 positional arguments but 7 were given?

Open AI-Hunter opened this issue 3 years ago • 4 comments

@outsidercsy I tried to run test.py using your pretrained model, but it produced the error: Traceback (most recent call last): File "test.py", line 278, in test(model, model_fn, data_name, cfg.test_epoch) File "test.py", line 59, in test preds = model_fn(batch, model, epoch) File "HAIS/model/hais/hais.py", line 371, in test_model_fn ret = model(input_, p2v_map, coords_float, coords[:, 0].int(), batch_offsets, epoch, 'test') File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/HAIS/model/hais/hais.py", line 265, in forward output = self.input_conv(input) File "/home/khalilullah/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/modules.py", line 134, in forward input = module(input) File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/conv.py", line 199, in forward outids.shape[0], self.algo) TypeError: forward() takes 6 positional arguments but 7 were given

Is there any suggestion, please?

my environement: pytorch 1.8 cuda 11.2 spcov 1.2 from your suggested link

AI-Hunter avatar Dec 15 '21 02:12 AI-Hunter

@outsidercsy I tried to run test.py using your pretrained model, but it produced the error: Traceback (most recent call last): File "test.py", line 278, in test(model, model_fn, data_name, cfg.test_epoch) File "test.py", line 59, in test preds = model_fn(batch, model, epoch) File "HAIS/model/hais/hais.py", line 371, in test_model_fn ret = model(input_, p2v_map, coords_float, coords[:, 0].int(), batch_offsets, epoch, 'test') File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/HAIS/model/hais/hais.py", line 265, in forward output = self.input_conv(input) File "/home/khalilullah/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/modules.py", line 134, in forward input = module(input) File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/conv.py", line 199, in forward outids.shape[0], self.algo) TypeError: forward() takes 6 positional arguments but 7 were given

Is there any suggestion, please?

my environement: pytorch 1.8 cuda 11.2 spcov 1.2 from your suggested link

Hi, I have the same problem, do you have a solution?

xiaozheng-liu avatar Mar 07 '22 11:03 xiaozheng-liu

@outsidercsy I tried to run test.py using your pretrained model, but it produced the error: Traceback (most recent call last): File "test.py", line 278, in test(model, model_fn, data_name, cfg.test_epoch) File "test.py", line 59, in test preds = model_fn(batch, model, epoch) File "HAIS/model/hais/hais.py", line 371, in test_model_fn ret = model(input_, p2v_map, coords_float, coords[:, 0].int(), batch_offsets, epoch, 'test') File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/HAIS/model/hais/hais.py", line 265, in forward output = self.input_conv(input) File "/home/khalilullah/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/modules.py", line 134, in forward input = module(input) File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/conv.py", line 199, in forward outids.shape[0], self.algo) TypeError: forward() takes 6 positional arguments but 7 were given Is there any suggestion, please? my environement: pytorch 1.8 cuda 11.2 spcov 1.2 from your suggested link

Hi, I have the same problem, do you have a solution?

Hi, same problem here. My environment is cuda=11.2, cudnn=8.1.1, pytorch=1.8.1+cu111, spconv 1.2 Could it be because that we need to downgrade both spconv and cuda? When I tried to install spconv 1.2 it says that it needs gpu architecture 'compute_86', which leads to higher version of cuda and pytorch. But the suggested pytorch version in requirements.txt is 1.1 But I wonder if there is any ways to deal with this problem without changing the environment?

EalinZyl avatar Mar 08 '22 04:03 EalinZyl

@outsidercsy I tried to run test.py using your pretrained model, but it produced the error: Traceback (most recent call last): File "test.py", line 278, in test(model, model_fn, data_name, cfg.test_epoch) File "test.py", line 59, in test preds = model_fn(batch, model, epoch) File "HAIS/model/hais/hais.py", line 371, in test_model_fn ret = model(input_, p2v_map, coords_float, coords[:, 0].int(), batch_offsets, epoch, 'test') File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/HAIS/model/hais/hais.py", line 265, in forward output = self.input_conv(input) File "/home/khalilullah/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/modules.py", line 134, in forward input = module(input) File "/anaconda3/envs/hais/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/anaconda3/envs/hais/lib/python3.7/site-packages/spconv/conv.py", line 199, in forward outids.shape[0], self.algo) TypeError: forward() takes 6 positional arguments but 7 were given Is there any suggestion, please? my environement: pytorch 1.8 cuda 11.2 spcov 1.2 from your suggested link

Hi, I have the same problem, do you have a solution?

Hi, same problem here. My environment is cuda=11.2, cudnn=8.1.1, pytorch=1.8.1+cu111, spconv 1.2 Could it be because that we need to downgrade both spconv and cuda? When I tried to install spconv 1.2 it says that it needs gpu architecture 'compute_86', which leads to higher version of cuda and pytorch. But the suggested pytorch version in requirements.txt is 1.1 But I wonder if there is any ways to deal with this problem without changing the environment?

Because I'm using an Ampere architecture GPU, I must use cuda>11, and therefore spconv1.2 as suggested. However as I traced back the error I found that it has something to do with the functional.py in spconv/spconv. And as I checked the code I realized that it was because I misunderstood the note of using the modified version of functional.py in README.md. That git source of spconv 1.2 provided was already the modified version. However I had replaced the functional.py with the one in spconv 1.0 provided in the original HAIS folder. It was a stupid mistake and as I changed it back the model worked fine.

EalinZyl avatar Mar 10 '22 05:03 EalinZyl

ha ha, thank you for your reminder, I also replaced the functional.py file of spconv 1.0 before. so stupid

xiaozheng-liu avatar Mar 11 '22 01:03 xiaozheng-liu