Skip to content

Commit c023468

Browse files
authored
Added Dockerfile along with a file to test Docker (#307)
1 parent d136432 commit c023468

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
2+
ARG DEBIAN_FRONTEND=noninteractive
3+
4+
ENV CUDA_HOME=/usr/local/cuda \
5+
TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" \
6+
SETUPTOOLS_USE_DISTUTILS=stdlib
7+
8+
RUN conda update conda -y
9+
10+
# Install libraries in the brand new image.
11+
RUN apt-get -y update && apt-get install -y --no-install-recommends \
12+
wget \
13+
build-essential \
14+
git \
15+
python3-opencv \
16+
ca-certificates && \
17+
rm -rf /var/lib/apt/lists/*
18+
19+
# Set the working directory for all the subsequent Dockerfile instructions.
20+
WORKDIR /opt/program
21+
22+
RUN git clone https://github.com/IDEA-Research/GroundingDINO.git
23+
24+
RUN mkdir weights ; cd weights ; wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth ; cd ..
25+
26+
RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y
27+
ENV CUDA_HOME=$CONDA_PREFIX
28+
29+
ENV PATH=/usr/local/cuda/bin:$PATH
30+
31+
RUN cd GroundingDINO/ && python -m pip install .
32+
33+
COPY docker_test.py docker_test.py
34+
35+
CMD [ "python", "docker_test.py" ]

docker_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from groundingdino.util.inference import load_model, load_image, predict, annotate
2+
import torch
3+
import cv2
4+
5+
model = load_model("groundingdino/config/GroundingDINO_SwinT_OGC.pyy", "weights/groundingdino_swint_ogc.pth")
6+
model = model.to('cuda:0')
7+
print(torch.cuda.is_available())
8+
print('DONE!')

0 commit comments

Comments
 (0)