IGITUGraz / WeatherDiffusion

Code for "Restoring Vision in Adverse Weather Conditions with Patch-Based Denoising Diffusion Models" [TPAMI 2023]
MIT License
310 stars 32 forks source link

IndexError: index 32 is out of bounds for dimension 0 with size 32 #5

Closed scv127 closed 2 years ago

scv127 commented 2 years ago

Hi. first,Thank you for releasing the code.

When executing the code in sampling, there is an error, so I ask you a question.

When you enter the model, the size of the tensor is halved. Therefore, the index value does not match. ex) model(x) ::: tensor[64,6,64,64] ==> tensor[32,3,64,64] I don't know why 0 dimensions are halved.

Using device: cuda Note: Currently supports evaluations (restoration) when run only on a single GPU! => using dataset 'AllWeather' => evaluating snowtest100K-L... => creating denoising-diffusion model with wrapper... scratch/ozan/ckpts/AllWeather_ddpm.pth.tar => loaded checkpoint 'scratch/ozan/ckpts/AllWeather_ddpm.pth.tar' (epoch 209, step 470000) starting processing from image ['beautiful_smile_00003'] Traceback (most recent call last): File "eval_diffusion.py", line 83, in main() File "eval_diffusion.py", line 79, in main model.restore(val_loader, validation=args.test_set, r=args.grid_r) File "C:\Users\PIAI\Desktop\WeatherDiffusion\models\restoration.py", line 36, in restore x_output = self.diffusive_restoration(x_cond, r=r) File "C:\Users\PIAI\Desktop\WeatherDiffusion\models\restoration.py", line 45, in diffusive_restoration x_output = self.diffusion.sample_image(x_cond, x, patch_locs=corners, patch_size=p_size) File "C:\Users\PIAI\Desktop\WeatherDiffusion\models\ddm.py", line 194, in sample_image xs = utils.sampling.generalized_steps_overlapping(x, x_cond, seq, self.model, self.betas, eta=0., File "C:\Users\PIAI\Desktop\WeatherDiffusion\utils\sampling.py", line 74, in generalized_steps_overlapping et_output[0, :, hi:hi + p_size, wi:wi + p_size] += outputs[idx] IndexError: index 32 is out of bounds for dimension 0 with size 32

zinuoli commented 1 year ago

@scv127 Hi, I encountered the same problem, can you please tell me how did you solve it? Thanks.

oozdenizci commented 1 year ago

Hi! I believe you are executing the evaluation script on a multi-gpu machine, hence this error may occur. Please run the current version of the evaluation code when there is only one cuda visible device. Note that the second line already prints "Note: Currently supports evaluations (restoration) when run only on a single GPU!" Hopefully this helps!

Naamcheung commented 1 year ago

@scv127 Hi, I encountered the same problem, can you please tell me how did you solve it? Thanks.

同学你好,我也遇到了一样的问题,可以问一下你是否解决了此问题呢,谢谢!

CongUcas commented 1 year ago

@scv127 Hi, I encountered the same problem, can you please tell me how did you solve it? Thanks.

同学你好,我也遇到了一样的问题,可以问一下你是否解决了此问题呢,谢谢!

我也遇到了这个问题,我在终端加输入的命令前加入了 CUDA_VISIBLE_DEVICES=1就可以了,即 CUDA_VISIBLE_DEVICES=1 python eval_diffusion.py --config "allweather.yml" --resume "xxx.pth.tar" --test_set "xxxx" --sampling_timesteps 25 --grid_r 4 只是推理起来非常的慢,我这2080服务器,单卡推理差不多20多分钟1张图

duanduan626 commented 8 months ago

没错,这个处理速度真的是好慢