Skip to content

Commit

Permalink
add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
KleinYuan committed Apr 16, 2023
1 parent 22aee1d commit 87e5adc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,6 @@ dmypy.json

# checkpoint
*.pth
outputs/
outputs/

.idea/
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-devel

COPY . /home/appuser
WORKDIR /home/appuser
RUN apt-get update
RUN python -m pip install -e segment_anything
RUN python -m pip install -e GroundingDINO
RUN pip install --upgrade diffusers[torch]
RUN pip install opencv-python pycocotools matplotlib onnxruntime onnx ipykernel
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build-image:
docker build -t=gsa:v0 .

run: build-image
nvidia-docker run --gpus all -it --rm --net=host --privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
-v ${PWD}:/home/appuser \
--name=gsa \
--ipc=host -it gsa:v0
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ See our [notebook file](grounded_sam.ipynb) as an example.
## :hammer_and_wrench: Installation
The code requires `python>=3.8`, as well as `pytorch>=1.7` and `torchvision>=0.8`. Please follow the instructions [here](https://pytorch.org/get-started/locally/) to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.

### Install with Docker

Open one terminal:

```
make run
```

That's it.

If you would like to allow visualization across docker container, open another terminal and type:

```
xhost +
```


### Install without Docker

Install Segment Anything:

```bash
Expand Down

0 comments on commit 87e5adc

Please sign in to comment.