ai-forever / Real-ESRGAN

PyTorch implementation of Real-ESRGAN model
BSD 3-Clause "New" or "Revised" License
463 stars 118 forks source link

UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling') #12

Open wnoiokjfwa opened 1 year ago

ggcr commented 1 year ago

This keeps happening even though I am passing the 'cpu' parameter:

device = torch.device('cpu')

Is there a way to avoid this error popping off in stderr?

nunombispo commented 1 year ago

The problem is in model.py line 59 https://github.com/ai-forever/Real-ESRGAN/blob/362a0316878f41dbdfbb23657b450c3353de5acf/RealESRGAN/model.py#L59

@torch.cuda.amp.autocast() by default always enables CUDA: image

Remove line 59 and add inside the function: torch.autocast(device_type=self.device.type)