ashawkey / stable-dreamfusion

Text-to-3D & Image-to-3D & Mesh Exportation with NeRF + Diffusion.
Apache License 2.0
7.99k stars 710 forks source link

TypeError: grid_encode_forward(): incompatible function arguments. #108

Open SOTAMak1r opened 1 year ago

SOTAMak1r commented 1 year ago

Description

the whole message is:

Traceback (most recent call last):
  File "main.py", line 162, in <module>
    trainer.train(train_loader, valid_loader, max_epoch)
  File "/mnt/dreamfusion/stable-dreamfusion/nerf/utils.py", line 486, in train
    self.train_one_epoch(train_loader)
  File "/mnt/dreamfusion/stable-dreamfusion/nerf/utils.py", line 698, in train_one_epoch
    self.model.update_extra_state()
  File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/mnt/dreamfusion/stable-dreamfusion/nerf/renderer.py", line 625, in update_extra_state
    sigmas = self.density(cas_xyzs)['sigma'].reshape(-1).detach()
  File "/mnt/dreamfusion/stable-dreamfusion/nerf/network_grid.py", line 150, in density
    sigma, albedo = self.common_forward(x)
  File "/mnt/dreamfusion/stable-dreamfusion/nerf/network_grid.py", line 80, in common_forward
    h = self.encoder(x, bound=self.bound)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/dreamfusion/stable-dreamfusion/gridencoder/grid.py", line 172, in forward
    outputs = grid_encode(inputs, self.embeddings, self.offsets, self.per_level_scale, self.base_resolution, inputs.requires_grad, self.gridtype_id, self.align_corners, self.interp_id)
  File "/usr/local/lib/python3.8/dist-packages/torch/cuda/amp/autocast_mode.py", line 110, in decorate_fwd
    return fwd(*args, **kwargs)
  File "/mnt/dreamfusion/stable-dreamfusion/gridencoder/grid.py", line 54, in forward
    _backend.grid_encode_forward(inputs, embeddings, offsets, outputs, B, D, C, L, S, H, dy_dx, gridtype, align_corners, interpolation) # fucking error
TypeError: grid_encode_forward(): incompatible function arguments. The following argument types are supported:
    1. (arg0: at::Tensor, arg1: at::Tensor, arg2: at::Tensor, arg3: at::Tensor, arg4: int, arg5: int, arg6: int, arg7: int, arg8: float, arg9: int, arg10: Optional[at::Tensor], arg11: int, arg12: bool) -> None

Invoked with: tensor([[0.0062, 0.0011, 0.0017],
        [0.0064, 0.0054, 0.0135],
        [0.0018, 0.0071, 0.0187],
        ...,
        [0.9945, 0.9990, 0.9821],
        [0.9949, 0.9973, 0.9850],
        [0.9960, 0.9968, 0.9981]], device='cuda:0'), tensor([[-7.7486e-07,  5.3644e-05],
        [-8.2314e-05, -7.3612e-05],
        [-3.8505e-05,  2.6822e-05],
        ...,
        [-6.2644e-05, -2.3842e-06],
        [-7.7724e-05, -8.1122e-05],
        [-1.8597e-05, -7.2241e-05]], device='cuda:0', dtype=torch.float16), tensor([     0,   4920,  18744,  51512, 117048, 182584, 248120, 313656, 379192,
        444728, 510264, 575800, 641336, 706872, 772408, 837944, 903480],
       device='cuda:0', dtype=torch.int32), tensor([[[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]],

        [[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]],

        [[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]],

        ...,

        [[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]],

        [[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]],

        [[0., 0.],
         [0., 0.],
         [0., 0.],
         ...,
         [0., 0.],
         [0., 0.],
         [0., 0.]]], device='cuda:0', dtype=torch.float16), 2097152, 3, 2, 16, 0.4666666666666667, 16, None, 1, False, 0

Why the error says that grid_encode_forward() only receive 13 parameters? And why this error occurs?

Steps to Reproduce

run the command:

python3 main.py --text "a hamburger" --workspace trial -O

Expected Behavior

Just solve this confusing error

Environment

Ubuntu 20.04, pytorch 1.12 cuda 11.6

ashawkey commented 1 year ago

@SOTAMak1r Hi, if you updated from a previous commit, you could try to reinstall gridencoder with pip install ./gridencoder.

ryanlu2240 commented 1 year ago

@ashawkey Hi, I reinstall gridencoder but still getting the same error.

Seiano commented 1 year ago

I have the same problem. **File "/workspace/torch-ngp/gridencoder/grid.py", line 54, in forward _backend.grid_encode_forward(inputs, embeddings, offsets, outputs, B, D, C, L, S, H, dy_dx, gridtype, align_corners, interpolation) TypeError: grid_encode_forward(): incompatible function arguments. The following argument types are supported:

  1. (arg0: at::Tensor, arg1: at::Tensor, arg2: at::Tensor, arg3: at::Tensor, arg4: int, arg5: int, arg6: int, arg7: int, arg8: int, arg9: float, arg10: int, arg11: Optional[at::Tensor], arg12: int, arg13: bool, arg14: int) -> None

Invoked with: tensor([[0.2538, 0.2531, 0.2518], [0.2513, 0.2513, 0.2554], [0.2530, 0.2525, 0.2582], ..., [0.7490, 0.7480, 0.7409], [0.7490, 0.7481, 0.7448], [0.7467, 0.7475, 0.7474]], device='cuda:0'), tensor([[-7.7486e-07, 5.3644e-05], [-8.2314e-05, -7.3612e-05], [-3.8505e-05, 2.6822e-05], ..., [ 4.3511e-06, -6.4850e-05], [-9.1195e-06, 7.1645e-05], [ 5.9009e-05, 1.5020e-05]], device='cuda:0', dtype=torch.float16), tensor([ 0, 4920, 20552, 63432, 188432, 561680, 1085968, 1610256, 2134544, 2658832, 3183120, 3707408, 4231696, 4755984, 5280272, 5804560, 6328848], device='cuda:0', dtype=torch.int32), tensor([[[-2.8775e+02, -1.1475e+00], [-4.7812e+00, -1.0879e+00], [ 3.5680e+03, 1.9141e+00], ..., [-2.0504e-04, 1.6172e+00], [ 2.9460e+03, -1.9844e+00], [-1.9625e+02, -1.8193e+00]],

    [[-1.6248e+04,  1.6270e+00],
     [ 2.7812e+00, -1.9873e+00],
     [ 6.9450e+02, -1.8242e+00],
     ...,
     [ 1.6861e-02, -1.8213e+00],
     [ 3.4219e+01,  1.9990e+00],
     [-1.0014e-03, -1.7480e+00]],

    [[ 2.8775e+02, -1.8223e+00],
     [-9.7036e-04,  2.0020e+00],
     [-2.4475e+02, -1.7441e+00],
     ...,
     [ 7.3160e+03,  1.9092e+00],
     [-8.3359e+00, -2.1426e+00],
     [ 3.0625e+01,  1.9775e+00]],

    ...,

    [[-2.7175e+02,  2.0195e+00],
     [ 2.3625e+01,  1.9053e+00],
     [ 9.7275e-05, -1.9707e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]],

    [[ 5.9605e-08,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 5.9605e-08,  0.0000e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]],

    [[ 5.9605e-08,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 5.9605e-08,  0.0000e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]]], device='cuda:0', dtype=torch.float16), 2097152, 3, 2, 16, 0.5333333333333334, 16, None, 0, False, 0

0% 0/100 [00:00<?, ?it/s]**

FlypigW commented 2 weeks ago

stall gridencoder but still getting the same erro

did you solve it?i am in the same situation

FlypigW commented 2 weeks ago

I have the same problem. **File "/workspace/torch-ngp/gridencoder/grid.py", line 54, in forward _backend.grid_encode_forward(inputs, embeddings, offsets, outputs, B, D, C, L, S, H, dy_dx, gridtype, align_corners, interpolation) TypeError: grid_encode_forward(): incompatible function arguments. The following argument types are supported: 1. (arg0: at::Tensor, arg1: at::Tensor, arg2: at::Tensor, arg3: at::Tensor, arg4: int, arg5: int, arg6: int, arg7: int, arg8: int, arg9: float, arg10: int, arg11: Optional[at::Tensor], arg12: int, arg13: bool, arg14: int) -> None

Invoked with: tensor([[0.2538, 0.2531, 0.2518], [0.2513, 0.2513, 0.2554], [0.2530, 0.2525, 0.2582], ..., [0.7490, 0.7480, 0.7409], [0.7490, 0.7481, 0.7448], [0.7467, 0.7475, 0.7474]], device='cuda:0'), tensor([[-7.7486e-07, 5.3644e-05], [-8.2314e-05, -7.3612e-05], [-3.8505e-05, 2.6822e-05], ..., [ 4.3511e-06, -6.4850e-05], [-9.1195e-06, 7.1645e-05], [ 5.9009e-05, 1.5020e-05]], device='cuda:0', dtype=torch.float16), tensor([ 0, 4920, 20552, 63432, 188432, 561680, 1085968, 1610256, 2134544, 2658832, 3183120, 3707408, 4231696, 4755984, 5280272, 5804560, 6328848], device='cuda:0', dtype=torch.int32), tensor([[[-2.8775e+02, -1.1475e+00], [-4.7812e+00, -1.0879e+00], [ 3.5680e+03, 1.9141e+00], ..., [-2.0504e-04, 1.6172e+00], [ 2.9460e+03, -1.9844e+00], [-1.9625e+02, -1.8193e+00]],

    [[-1.6248e+04,  1.6270e+00],
     [ 2.7812e+00, -1.9873e+00],
     [ 6.9450e+02, -1.8242e+00],
     ...,
     [ 1.6861e-02, -1.8213e+00],
     [ 3.4219e+01,  1.9990e+00],
     [-1.0014e-03, -1.7480e+00]],

    [[ 2.8775e+02, -1.8223e+00],
     [-9.7036e-04,  2.0020e+00],
     [-2.4475e+02, -1.7441e+00],
     ...,
     [ 7.3160e+03,  1.9092e+00],
     [-8.3359e+00, -2.1426e+00],
     [ 3.0625e+01,  1.9775e+00]],

    ...,

    [[-2.7175e+02,  2.0195e+00],
     [ 2.3625e+01,  1.9053e+00],
     [ 9.7275e-05, -1.9707e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]],

    [[ 5.9605e-08,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 5.9605e-08,  0.0000e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]],

    [[ 5.9605e-08,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 5.9605e-08,  0.0000e+00],
     ...,
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00],
     [ 0.0000e+00,  0.0000e+00]]], device='cuda:0', dtype=torch.float16), 2097152, 3, 2, 16, 0.5333333333333334, 16, None, 0, False, 0

0% 0/100 [00:00<?, ?it/s]**

same situation,do you solve it?