MzeroMiko / VMamba

VMamba: Visual State Space Models,code is based on mamba
MIT License
2.19k stars 142 forks source link

Concern on using VMamba as a general backbone in MMCV framework. #289

Open BaophanN opened 2 months ago

BaophanN commented 2 months ago

Hi author, I intend to use VMambaT as a general backbone to replace Resnet. However, my code base is implemented in mmcv==1.5.2, mmdet 2.26.0. Is there a workaround so that I can integrate VMamba into the framework of mmcv likes Resnet? Unlike Resnet, VMamba has many components implemented not in Trition so this task may not be so trivial. Thank you

MzeroMiko commented 2 months ago

You can simply copy the file vmamba.py and its dependencies and use it as a plug-and-play module.

If you want to integrate it into mmcv, you can refer to the manual of mmcv for how to build your own net and use it by just modifying the config.py. And then, insert the code in vmamba into it, and it'll work.

BaophanN commented 2 months ago

I did it as plug-and-play like you said. Following mmcv, I first create a folder and put the source code of vmamba.py and all its dependency into that folders, including folder kernels/selective_scan and mamba2. However, when I run the command: cd kernels/selective_scan && pip install . It gave error: ''' ... The error is very long and I only capture the relevant part because from here up they look similar ... 0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 62 registers, 528 bytes cmem[0] ptxas info : Compiling entry function '_Z25selective_scan_fwd_kernelI32Selective_Scan_fwd_kernel_traitsILi32ELi4ELb1EfffEEv13SSMParamsBase' for 'sm_80' ptxas info : Function properties for _Z25selective_scan_fwd_kernelI32Selective_Scan_fwd_kernel_traitsILi32ELi4ELb1EfffEEv13SSMParamsBase 0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 56 registers, 528 bytes cmem[0] ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1666, in _run_ninja_build subprocess.run( File "/opt/conda/envs/lanesegnet/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/workspace/source/kernels/selective_scan/setup.py", line 143, in <module>
      setup(
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
      _build_ext.run(self)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
      build_ext.build_extensions(self)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
      _build_ext.build_extension(self, ext)
    File "/opt/conda/envs/lanesegnet/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
      objects = self.compiler.compile(sources,
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 530, in unix_wrap_ninja_compile
      _write_ninja_file_and_compile_objects(
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1355, in _write_ninja_file_and_compile_objects
      _run_ninja_build(
    File "/opt/conda/envs/lanesegnet/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
      raise RuntimeError(message) from e
  RuntimeError: Error compiling objects for extension
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for selective-scan Running setup.py clean for selective-scan Failed to build selective-scan ERROR: Could not build wheels for selective-scan, which is required to install pyproject.toml-based projects ''' This is my installed package version: mmcv-full 1.5.2 mmdet 2.26.0 mmdet3d 1.0.0rc6 torch 1.9.1+cu111 torchaudio 0.9.1 torchvision 0.10.1+cu111 triton 3.0.0 The mmcv and torch is the requirements of my baseline where I want to plug in VMamba

MzeroMiko commented 2 months ago

selective_scan only support cuda>=11.4, better use cuda>=11.8, that may be the problem.

BaophanN commented 2 months ago

I don't understand how but after reinstalling the same software version as above in another pc with a different gpu, the above error was from a RTX4090, now I reproduce the above procedure on RTX 3060 and discovered that the backbone required selective_scan_cuda_oflex to be trained fast. Is it possible for me to reimplement the selective_scan_cuda_oflex kernel in CUDA 11.1. Since the model I used was built using mmcv-full 1.5.2 which depends on pytorch 1.9 and cuda 11.1. VMamba is compatible with mmdet 3.0, however my code base is from 2.0. I. After sucessfully built the kernel this time, i import and got this error:

>>> import torch
>>> import selective_scan_cuda_oflex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /workspace/source/openlanev2/lib/python3.8/site-packages/selective_scan_cuda_oflex.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda29c10_cuda_check_implementationERKSsS2_ib
MzeroMiko commented 2 months ago

I did try vmamba with mmcv1.5, but i rebuilt mmcv in cuda12.1 rather than rewrite selective scan.

In fact,the original selective scan in mamba only supports cuda>=11.8,and I found that there're only small differences in some packages used in selective scan between cuda11.8 and cuda11.4,so I change the code to make it be compatible with cuda11.4.

However cuda 11.1 has so many differences that it is hard to apply the code to it.

But if you wanna try,I may help when I am available.

BaophanN commented 2 months ago

Can you clarify more on how you rebuild mmcv and which steps have you followed. Which pytorch version did you use? And how was the performance? Because when I tried to rebuild mmcv 1.5.2 with cuda 12.1 and pytorch 2.1 I got a bunch of mismatch dependency errors? If possible, please provide me with a full list of packages frameworks and the exact steps you have done. It seems that mmcv 1.5.2 requires cuda 11.1, pytorch 1.9 and python 3.8 Thank you

MzeroMiko commented 2 months ago

I say build but not install,which means that the you have to download the source code and build from source yourself.

If you find mismatches,chech the version of cuda you use in CUDA_HOME and pytorch,make sure they are aligned.

BaophanN commented 2 months ago

Which pytorch version did you use to rebuild mmcv 1.5 from source? when you want to build mmcv, you need to have pytorch and cuda already there. Or you mean building pytorch from source, also? Please give me the version of pytorch you have used to build the mmcv 1.5 you have mentioned. Thank you

MzeroMiko commented 2 months ago

torch2.2 + cuda 12.1

BaophanN commented 2 months ago

Thank you for your reply. But as far as I know from mmcv docs, it is impossible to build mmcv 1.5 from source using torch 2.2 and cuda 12.1. It was strange that you can build, because when I use torch 2.1+cuda12.1 and followed the exact build process from: this link. It gave this error: ` /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:597:6: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 597 | if constexpr (num_boxed_args != 0) { | ^~~~~ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build subprocess.run( File "/opt/conda/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '7']' returned non-zero exit status 1.
411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:395:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 395 | AT_DISPATCH_CASE(at::ScalarType::Short, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:233:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 233 | AT_DISPATCH_CASE(at::ScalarType::Double, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:412:3: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’ 412 | AT_DISPATCH_CASE_FLOATING_TYPES(VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:234:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 234 | AT_DISPATCH_CASE(at::ScalarType::Float, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:412:3: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’ 412 | AT_DISPATCH_CASE_FLOATING_TYPES(VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:515:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 515 | AT_DISPATCH_CASE(SCALARTYPE1, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:516:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 516 | AT_DISPATCH_CASE(SCALARTYPE2, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:517:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 517 | AT_DISPATCH_CASE(SCALARTYPE3, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 287 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h: In lambda function: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:391:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 391 | AT_DISPATCH_CASE(at::ScalarType::Byte, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:392:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 392 | AT_DISPATCH_CASE(at::ScalarType::Char, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:393:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 393 | AT_DISPATCH_CASE(at::ScalarType::Int, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:394:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 394 | AT_DISPATCH_CASE(at::ScalarType::Long, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:395:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 395 | AT_DISPATCH_CASE(at::ScalarType::Short, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’ 411 | AT_DISPATCH_CASE_INTEGRAL_TYPES(VA_ARGS) \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:233:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 233 | AT_DISPATCH_CASE(at::ScalarType::Double, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:412:3: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’ 412 | AT_DISPATCH_CASE_FLOATING_TYPES(VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:234:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 234 | AT_DISPATCH_CASE(at::ScalarType::Float, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:412:3: note: in expansion of macro ‘AT_DISPATCH_CASE_FLOATING_TYPES’ 412 | AT_DISPATCH_CASE_FLOATING_TYPES(VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’ 514 | AT_DISPATCH_CASE_ALL_TYPES(VA_ARGS) \ | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:515:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 515 | AT_DISPATCH_CASE(SCALARTYPE1, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | VA_ARGS__ \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:516:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 516 | AT_DISPATCH_CASE(SCALARTYPE2, VA_ARGS) \ | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 56 | if constexpr (!at::should_include_kernel_dtype( \ | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’ 221 | __VA_ARGS \ | ^~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’ 68 | AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \ | ^~~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’ 74 | AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, VA_ARGS) | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:517:3: note: in expansion of macro ‘AT_DISPATCH_CASE’ 517 | AT_DISPATCH_CASE(SCALARTYPE3, VA_ARGS) | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’ 524 | AT_DISPATCH_CASE_ALL_TYPES_AND3( \ | ^~~~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:307:9: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’ 307 | AT_DISPATCH_ALL_TYPES_AND3( | ^~~~~~ In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:1, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4, from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12, from /workspace/source/mmcv/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3, from /workspace/source/mmcv/mmcv/ops/csrc/pytorch/border_align.cpp:2: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h: In static member function ‘static Result c10::impl::BoxedKernelWrapper<Result(Args ...), typename std::enable_if<((c10::guts::conjunction<c10::impl::can_box...>::value && c10::guts::conjunction<c10::guts::disjunction<c10::impl::has_ivalue_to<T, void>, std::is_same<void, T> >, c10::guts::negation<std::is_lvalue_reference<_Tp> > >::value) && (! c10::impl::is_tuple_of_mutable_tensor_refs::value)), void>::type>::call(const c10::BoxedKernel&, const c10::OperatorHandle&, c10::DispatchKeySet, Args ...)’: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 229 | if constexpr (!std::is_same_v<void, Result>) { | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:25: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’? 229 | if constexpr (!std::is_same_v<void, Result>) { | ^~~~~ | is_same /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected primary-expression before ‘void’ 229 | if constexpr (!std::is_same_v<void, Result>) { | ^~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] 229 | if constexpr (!std::is_same_v<void, Result>) { | ^ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected ‘)’ before ‘void’ 229 | if constexpr (!std::is_same_v<void, Result>) { | ~ ^~~~ | ) In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4, from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12, from /workspace/source/mmcv/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3, from /workspace/source/mmcv/mmcv/ops/csrc/pytorch/border_align.cpp:2: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_input_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_input_type()’: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:109:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 109 | if constexpr (guts::typelist::contains<supported_primitive_arg_types, T>::value) { | ^~~~~ In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251, from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4, from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12, from /workspace/source/mmcv/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3, from /workspace/source/mmcv/mmcv/ops/csrc/pytorch/border_align.cpp:2: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_output_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_output_type()’: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:215:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 215 | if constexpr(guts::typelist::contains<supported_primitive_arg_types, T>::value) { | ^~~~~ /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In static member function ‘static void c10::impl::make_boxed_from_unboxed_functor<KernelFunctor, AllowDeprecatedTypes>::call(c10::OperatorKernel, const c10::OperatorHandle&, c10::DispatchKeySet, c10::Stack)’: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:575:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 575 | if constexpr (has_outputs) { | ^~~~~ In file included from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12, from /workspace/source/mmcv/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3, from /workspace/source/mmcv/mmcv/ops/csrc/pytorch/border_align.cpp:2: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h: In static member function ‘static Return c10::Dispatcher::callWithDispatchKeySlowPath(const c10::TypedOperatorHandle<Return(Args ...)>&, at::StepCallbacks&, c10::DispatchKeySet, const c10::KernelFunction&, Args ...)’: /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:597:6: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’ 597 | if constexpr (num_boxed_args != 0) { | ^~~~~ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build subprocess.run( File "/opt/conda/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '7']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "<pip-setuptools-caller>", line 34, in <module>
  File "/workspace/source/mmcv/setup.py", line 392, in <module>
    setup(
  File "/opt/conda/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/opt/conda/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/opt/conda/lib/python3.10/site-packages/setuptools/command/develop.py", line 111, in install_for_development
    self.run_command('build_ext')
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/opt/conda/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
    self.build_extensions()
  File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
    build_ext.build_extensions(self)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
    self._build_extensions_serial()
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
    self.build_extension(ext)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
    _build_ext.build_extension(self, ext)
  File "/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
    objects = self.compiler.compile(
  File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "/opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]`
MzeroMiko commented 2 months ago

I built mmcv==1.5.0 again with torch2.2+cu121, and it works.

all the commands are

git clone https://github.com/open-mmlab/mmcv/ && cd mmcv && git checkout v1.5.0
# modify in setup.py: "--std=c++14" -> "--std=c++17" 
pip install ninja psutil
MMCV_WITH_OPS=1 python setup.py develop
python .dev_scripts/check_installation.py

image

Grimxiaohao commented 1 month ago

Hello BaophanN, did you successfully replace backbone? How did you do it?

BaophanN commented 1 month ago

Thank you author for your kind response. Following your instruction, I have successfully built mmcv 1.5.2. However, due to version conflict, I have problem installing mmdet3d==1.0.0rc6 due to mismatch version between pytorch 2.+ and cuda 12.1. In detail, while installing mmdet3d, I have problems with importlib_metadata, platformdir.

TypeError: FormatCode() got an unexpected keyword argument 'verify'

Still cannot manage to fix this.

MzeroMiko commented 1 month ago

I am not familiar with mmdet3d. Maybe some issues under the repo openmmlab/mmdetection3d would help.