cyrildiagne / u2net-http

HTTP Wrapper for U^2-Net (Qin et al, Pattern Recognition 2020)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.

avaleriani opened this issue · comments

Hey! First of all, thank you very much for this project I find it very useful. I've tried basnet-http and it worked perfectly but when I try to run this project on OSX I'm getting this error:

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='cpu' to map your storages to the CPU.

Do you know if it's possible to fix it?

I have this same problem as well. I have a Nvidia Quadro 4000 Cuda card.

Yes I believe the default code from U2-Net requires an CUDA runtime.
But I've seen a pull request on the official repo that seems to fix that issue: https://github.com/NathanUA/U-2-Net/pull/7/files#diff-8b7b685d4fd2cecc49d5c01c33e3e7e4

@cyrildiagne Awesome! thank you very much.

For anyone coming here, I solved this issue by adding --gpus all to the docker command:

docker run --gpus all --rm -p 8080:80 u2net