-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM doduo1.umcn.nl/uokbaseimage/base:tf2.10-pt1.12 | ||
|
||
USER root | ||
WORKDIR /home/user/ | ||
|
||
# install pyvips | ||
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub | ||
|
||
# download & unpack vips | ||
RUN wget -q https://github.com/libvips/libvips/releases/download/v8.13.0/vips-8.13.0.tar.gz && \ | ||
sudo -S apt-get update && \ | ||
sudo -S apt-get install -y libjpeg-turbo8-dev && \ | ||
sudo -S apt-get install -y libgtk2.0-dev && \ | ||
sudo -S apt-get install -y libgsf-1-dev && \ | ||
sudo -S apt-get install -y libtiff5-dev && \ | ||
sudo -S apt-get install -y libopenslide-dev && \ | ||
tar xf vips-8.13.0.tar.gz > /dev/null 2>&1 | ||
|
||
# sepcify workdir | ||
WORKDIR /home/user/vips-8.13.0/ | ||
|
||
# make and install vips | ||
RUN ./configure && \ | ||
make && \ | ||
sudo -S make install && \ | ||
cd .. && \ | ||
sudo -S ldconfig && \ | ||
sudo -S pip3.9 install pyvips | ||
|
||
WORKDIR /home/user/ | ||
RUN rm vips-8.13.0.tar.gz | ||
|
||
# install ASAP | ||
COPY ASAP*.deb . | ||
RUN apt-get update && \ | ||
apt-get install --assume-yes /home/user/ASAP-2.1-Ubuntu2004.deb && \ | ||
ldconfig && \ | ||
SITE_PACKAGES=`python3 -c "import sysconfig; print(sysconfig.get_paths()['purelib'])"` && \ | ||
printf "/opt/ASAP/bin/\n" > "${SITE_PACKAGES}/asap.pth" && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN rm ASAP*.deb | ||
|
||
USER user | ||
|
||
# clone dino repo and install requirements | ||
RUN git clone https://github.com/computationalpathologygroup/dino.git | ||
RUN pip3 install -r dino/requirements.txt` | ||
|
||
#### Configure entrypoint | ||
COPY run.sh . | ||
ENTRYPOINT ["/bin/bash", "/home/user/run.sh"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
#help | ||
display_help() | ||
{ | ||
echo "DINO by @clementgrisi" | ||
echo | ||
echo "Syntax: docker run dino [-p level] [-c filename] [-w wandb_api_key]" | ||
echo "options:" | ||
echo "-p starts self-supervised pre-training at given level (can be either 'patch' or 'region')" | ||
echo "-c specify config filename" | ||
echo "-w specify wandb API key" | ||
echo | ||
} | ||
|
||
#main | ||
while getopts ":t:p:c:h" opt; do | ||
case $opt in | ||
h) | ||
display_help | ||
exit 1 | ||
;; | ||
p) | ||
level="$OPTARG" | ||
;; | ||
c) | ||
config="$OPTARG" | ||
;; | ||
w) | ||
key="$OPTARG" | ||
;; | ||
\?) | ||
echo "Invalid option: -$OPTARG" >&2 | ||
exit 1 | ||
;; | ||
:) | ||
echo "Option -$OPTARG requires an argument." >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [[ -n $key ]]; then | ||
export WANDB_API_KEY=$key | ||
fi | ||
|
||
if [[ -n $level ]]; then | ||
case $level in | ||
patch) | ||
python3 -m torch.distributed.run --standalone --nproc_per_node=gpu dino/patch.py --config-name "$config" | ||
;; | ||
region) | ||
python3 -m torch.distributed.run --standalone --nproc_per_node=gpu dino/region.py --config-name "$config" | ||
;; | ||
*) | ||
echo "Invalid level option. Please use 'patch' or 'region'" | ||
esac | ||
else | ||
echo "No flag specified. Please use -p flag." | ||
fi |