MiDaS icon indicating copy to clipboard operation
MiDaS copied to clipboard

RuntimeError: CUDA error: no kernel image is available for execution on the device

Open lednevandrey04 opened this issue 3 years ago • 1 comments

Good afternoon.

I am trying to run MiDaS on my local machine. Nvidia GeForce GT 710 video card installed on the machine So installed pytorch CPU Only package conda install pytorch == 1.8.0 torchvision == 0.9.0 torchaudio == 0.8.0 cpuonly -c pytorch

The following error occurs

.................................................. .................................................. ........... % run run.py --model_type dpt_large .................................................. .................................................. ........... initialize device: cuda start processing processing input \ Foto0000.jpg (1/1)


RuntimeError Traceback (most recent call last) ~ \ MiDaS \ run.py in 186 187 # compute depth maps -> 188 run (args.input_path, args.output_path, args.model_weights, args.model_type, args.optimize)

~ \ MiDaS \ run.py in run (input_path, output_path, model_path, model_type, optimize) 118 sample = torch.from_numpy (img_input) .to (device) .unsqueeze (0) 119 if optimize == True and device == torch.device ("cuda"): -> 120 sample = sample.to (memory_format = torch.channels_last) 121 sample = sample.half () 122 prediction = model.forward (sample)

RuntimeError: CUDA error: no kernel image is available for execution on the device.

Could you tell me what I'm doing wrong

lednevandrey04 avatar Dec 05 '21 16:12 lednevandrey04

haha, so you're having a the opposite problem of when I first started.

Here is a solution for you without troubleshooting the root cause. Go to line 28 and tell it to use the cpu explicitly.

    device = torch.device("cpu")

3dsf avatar Dec 05 '21 18:12 3dsf