instafilter icon indicating copy to clipboard operation
instafilter copied to clipboard

Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

Open sugizo opened this issue 2 years ago • 1 comments

env google colab

code

pip install -U instafilter opencv-python 
import cv2
from instafilter import Instafilter
filtered_img = 'aden.jpg'

model = Instafilter('Aden')
new_image = model(ori_img)

result

RuntimeError                              Traceback (most recent call last)
[<ipython-input-37-0b05f7113c97>](https://localhost:8080/#) in <cell line: 3>()
      1 filtered_img = 'aden.jpg'
      2 
----> 3 model = Instafilter('Aden')
      4 new_image = model(ori_img)
      5 

9 frames
[/usr/local/lib/python3.10/dist-packages/torch/serialization.py](https://localhost:8080/#) in validate_cuda_device(location)
    256 
    257     if not torch.cuda.is_available():
--> 258         raise RuntimeError('Attempting to deserialize object on a CUDA '
    259                            'device but torch.cuda.is_available() is False. '
    260                            'If you are running on a CPU-only machine, '

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

best regards

sugizo avatar Dec 13 '23 20:12 sugizo

If you provide a PR I'll merge it in, but I'm not currently supporting this module.

thoppe avatar Dec 15 '23 12:12 thoppe