Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker and devcontainer #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM nvidia/cuda:12.2.2-base-ubuntu20.04

ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG DEBIAN_FRONTEND=noninteractive

ENV TERM=xterm-256color
ENV TZ=Europe/Paris
ENV LANG=en_US.UTF-8
ENV SHELL=/bin/bash

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Install language
RUN apt-get update && apt-get install -y \
locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*

# Install packages
RUN apt update && apt install -y \
git \
tmux \
python3-pip

# Set python as python3
RUN ln -s /usr/bin/python3 /usr/bin/python

# Install pytorch
RUN pip3 install torch==1.8.1 torchvision==0.9.1

USER $USERNAME
CMD ["/bin/bash", "-l"]
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "WaSR-T",
"build": { "dockerfile": "Dockerfile" },
"runArgs": [
"--net", "host",
"--privileged",
"--gpus", "all",
"--shm-size", "16g"
],
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached"
],
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-vscode.cpptools-extension-pack"
]
}
},
"postCreateCommand": "pip install -r /workspaces/WaSR-T/requirements.txt"
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ __pycache__/
venv/

# Project specific
/output/
/output/
/dataset/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ The required Python libraries can be installed using the following pip command
pip install -r requirements.txt
```

<details>
<summary> :whale: <b>Docker</b> </summary>

To use Docker along GPU, you might need to install [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
Now using [devcontainers extension](https://code.visualstudio.com/docs/devcontainers/tutorial) for vscode, you will be able to open the project automaticly in a Docker container.
</details>


## Usage

The WaSR-T model used in our experiments (ResNet-101 backbone) can be initialized with the following code.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytorch-lightning==1.4.4
torchmetrics==0.5.0
tqdm
albumentations
six