RuntimeError: Expected 4-dimensional input for 4-dimensional weight [3, 1, 11, 11], but got 3-dimensional input of size [3, 900, 1600] instead
Hi! Thanks for your great work.
I have met some bugs when I try to train bungee dataset.
The following are the bugs. Thanks for helping!
Traceback (most recent call last):
File "/home/fanyx2311/.conda/envs/sgs/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/fanyx2311/.conda/envs/sgs/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/fanyx2311/.local/lib/python3.8/site-packages/debugpy/main.py", line 39, in
I've got the same exception. Did you solve the problem?
I've got the same exception. Did you solve the problem?
This problem happened because I was using the wrong versions. My cuda toolkit version was 11.1, and torch related version were torch==1.10.2+cu111, torchvision==0.11.3+cu111 and torchaudio==0.10.2+cu11. You can modify the code of _ssim(...) function by inserting the following two lines at the beginning to solve this problem, but other problems will be encountered (in my case it is this one).
img1 = img1.unsqueeze(0)
img2 = img2.unsqueeze(0)
So the final solution should be using the correct versions. When I upgrade my cuda toolkit to 11.4 and recreate the conda env using
conda env create --file ./environment.yml,
everything is ok now.
By the way, my system info is as following:
~ nvidia-smi
Tue Nov 5 10:26:21 2024
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.182.03 Driver Version: 470.182.03 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:65:00.0 Off | N/A |
| 30% 34C P8 13W / 320W | 5648MiB / 10009MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 7696 C ...vs/scaffold_gs/bin/python 5461MiB |
| 0 N/A N/A 7837 G /usr/lib/xorg/Xorg 18MiB |
| 0 N/A N/A 10021 G /usr/bin/gnome-shell 15MiB |
| 0 N/A N/A 27031 G /usr/lib/xorg/Xorg 112MiB |
| 0 N/A N/A 27160 G /usr/bin/gnome-shell 34MiB |
+-----------------------------------------------------------------------------+
~
~ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_Oct_11_21:27:02_PDT_2021
Cuda compilation tools, release 11.4, V11.4.152
Build cuda_11.4.r11.4/compiler.30521435_0
~
~ conda list | grep torch
ffmpeg 4.3 hf484d3e_0 pytorch
pytorch 1.12.1 py3.7_cuda11.6_cudnn8.3.2_0 pytorch
pytorch-mutex 1.0 cuda pytorch
pytorch-scatter 2.1.0 py37_torch_1.12.0_cu116 pyg
torchaudio 0.12.1 py37_cu116 pytorch
torchvision 0.13.1 py37_cu116 pytorch