lhwcv / mlsd_pytorch

Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"
Apache License 2.0
189 stars 37 forks source link

Compatibility with new RTX 3080 cards #6

Closed dsvua closed 3 years ago

dsvua commented 3 years ago

In case others have similar issues.

On Ubuntu 20.04 with driver 460 and Cuda 11.2, current docker compose did not work.

Until I added Gpu capability in docker-compose.yaml, pytorch did not see video card and complained about missing nvidia driver: RuntimeError: Found no NVIDIA driver on your system.

Next, after docker-compose.yaml fix, default version of torch, gave me this error: GeForce RTX 3080 with CUDA capability sm_86 is not compatible with the current PyTorch installation.

These are changes I made to fix errors above:

diff --git a/Dockerfile b/Dockerfile
index dc3d37a..d4b53b1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,5 +12,6 @@ RUN apt-get update \
     python3 \
     python3-pip \
   && python -m pip install --no-cache-dir -r requirements.txt \
+  && python -m pip install --no-cache-dir torch==1.7.0+cu110 -f https://download.pytorch.org/whl/torch_stable.html \
   && rm -f requirements.txt \
   && rm -rf /var/lib/apt/lists/*
diff --git a/docker-compose.yml b/docker-compose.yml
index a112550..ba7ce58 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -13,3 +13,8 @@ services:
       - ${PWD}:/ws
     working_dir: /ws
     command: "python demo.py"
+    deploy:
+      resources:
+        reservations:
+          devices:
+          - capabilities: [gpu]
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index ba4a747..05f1227 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
 numpy
 opencv-python
 pillow
-torch
+# torch
 Flask
 requests

You need to use docker-compose version 1.27 or newer.

lhwcv commented 3 years ago

@dsvua Thank you for your work! If some one meet the same issue, He/She can refer this.