问题:RuntimeError: cuDNN error: CUDNN_STATUS_NOT_SUPPORTED.
==> Start testing (5 runs) Run 1 of 5 0%| | 0/4 [00:00<?, ?it/s]/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/torch_version.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. from pkg_resources import packaging # type: ignore[attr-defined] /home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/torch_version.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. from pkg_resources import packaging # type: ignore[attr-defined] /home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/torch_version.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. from pkg_resources import packaging # type: ignore[attr-defined] 0%| | 0/4 [00:45<?, ?it/s] Traceback (most recent call last): File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/data/zhouy24Files/Dlam/DIaM/src/test.py", line 185, in <module> mp.spawn(main_worker, File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 230, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 188, in start_processes while not context.join(): File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 150, in join raise ProcessRaisedException(msg, error_index, failed_process.pid) torch.multiprocessing.spawn.ProcessRaisedException: -- Process 0 terminated with the following error: Traceback (most recent call last): File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap fn(i, *args) File "/data/zhouy24Files/Dlam/DIaM/src/test.py", line 56, in main_worker validate(args=args, val_loader=val_loader, model=model) File "/data/zhouy24Files/Dlam/DIaM/src/test.py", line 105, in validate features_q = model.module.extract_features(qry_img).detach().unsqueeze(1) File "/data/zhouy24Files/Dlam/DIaM/src/model/pspnet.py", line 97, in extract_features x = self.layer0(x) File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/nn/modules/batchnorm.py", line 737, in forward return F.batch_norm( File "/home/zhouy24/miniconda3/envs/dlam/lib/python3.9/site-packages/torch/nn/functional.py", line 2282, in batch_norm return torch.batch_norm( RuntimeError: cuDNN error: CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguous input
参考链接:解决报错 cuDNN error: CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguous input.
实测:添加torch.backends.cudnn.enabled = False
解决问题