From 3aece39e9b0e24f1fbc84cc415238f02c7568102 Mon Sep 17 00:00:00 2001 From: Aleksandr Isakov <43218578+asisakov@users.noreply.github.com> Date: Thu, 25 Jun 2020 17:13:48 +0300 Subject: [PATCH 1/5] Add docker --- README.md | 21 +++++++++++++++++++++ docker/Dockerfile | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 docker/Dockerfile diff --git a/README.md b/README.md index b29d937..464487c 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,27 @@ python src/run.py --eval --n_embd 1536 --n_head 16 --n_layer 48 If your data is not in `/root/downloads/`, set `--ckpt_path` and `--data_path` manually. You should see that the test generative losses are 2.0895, 2.0614, and 2.0466, matching Figure 3 in the paper. +### Docker + +Also, there is 'Dockerfile' in 'image-gpt/Docker' directory. To make a docker-container of the model and use it, you should replace the 'Dockerfile' file to 'image-gpt' directory. +Next, use the 'build' command to create an image: + +``` +docker build -t image-gpt . +``` + +Check the container existence: + +``` +docker images +``` + +After, you can run it by typing: + +``` +docker run image-gpt +``` + ### Citation Please use the following bibtex entry: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..335b17a --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,24 @@ +FROM python:3.6-stretch + +RUN apt-get update && \ + apt-get install -y gcc make apt-transport-https ca-certificates build-essential + +# check pyhon environment +RUN python3 --version +RUN pip3 --version + +# set directory +WORKDIR /image-gpt/src/model.py + +# requirements +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# download pre-trained model +RUN python download.py --model s --ckpt 1000000 + +# download dataset +RUN python download.py --model s --ckpt 1000000 --dataset imagenet + +# run iGPT-S +CMD python src/run.py --eval --n_embd 512 --n_head 8 --n_layer 24 From d265f9432efd601c9b4f27ddc55861307892a0cb Mon Sep 17 00:00:00 2001 From: Aleksandr Isakov <43218578+asisakov@users.noreply.github.com> Date: Thu, 25 Jun 2020 20:56:54 +0300 Subject: [PATCH 2/5] Fix Dockerfile --- docker/Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 335b17a..843c8e5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,17 +8,23 @@ RUN python3 --version RUN pip3 --version # set directory -WORKDIR /image-gpt/src/model.py +WORKDIR /image-gpt/ # requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +COPY ["src/", "download.py", "/src/"] +RUN ls -la /src/* + # download pre-trained model -RUN python download.py --model s --ckpt 1000000 +RUN python /src/download.py --model s --ckpt 1000000 # download dataset -RUN python download.py --model s --ckpt 1000000 --dataset imagenet +RUN python /src/download.py --model s --ckpt 1000000 --dataset imagenet + +# download color clusters +RUN python /src/download.py --model s --ckpt 1000000 --dataset imagenet --clusters # run iGPT-S -CMD python src/run.py --eval --n_embd 512 --n_head 8 --n_layer 24 +CMD python /src/run.py --eval --n_embd 512 --n_head 8 --n_layer 24 From 18ebf40cc9549047c5c0de11a5debbf8d361e0a7 Mon Sep 17 00:00:00 2001 From: Aleksandr Isakov <43218578+asisakov@users.noreply.github.com> Date: Thu, 25 Jun 2020 22:01:38 +0300 Subject: [PATCH 3/5] Fix requirements --- requirements.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2cc521d..dabeab6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,8 @@ +numpy==1.16.3 +tensorflow-gpu==1.13.1 +imageio==2.8.0 fire>=0.1.3 regex==2017.4.5 requests==2.21.0 -tqdm==4.31.1 +tqdm==4.31.1 +scipy==1.4.1 From 02d8191c5547650d131939ba07affc9098af7fca Mon Sep 17 00:00:00 2001 From: Aleksandr Isakov <43218578+asisakov@users.noreply.github.com> Date: Thu, 25 Jun 2020 22:04:27 +0300 Subject: [PATCH 4/5] Fix Dockerfile --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 843c8e5..aeaa627 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ -FROM python:3.6-stretch - +FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 RUN apt-get update && \ - apt-get install -y gcc make apt-transport-https ca-certificates build-essential + apt-get install -y python3-pip && \ + pip3 install # check pyhon environment RUN python3 --version From 47273a62ea6cfe9e38da558a8dc97b399054234d Mon Sep 17 00:00:00 2001 From: Aleksandr Isakov <43218578+asisakov@users.noreply.github.com> Date: Fri, 26 Jun 2020 16:01:13 +0300 Subject: [PATCH 5/5] Fix Dockerfile and README.md --- README.md | 13 +++---------- docker/Dockerfile | 18 +++++++----------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 464487c..ac393a9 100644 --- a/README.md +++ b/README.md @@ -88,23 +88,16 @@ If your data is not in `/root/downloads/`, set `--ckpt_path` and `--data_path` m ### Docker -Also, there is 'Dockerfile' in 'image-gpt/Docker' directory. To make a docker-container of the model and use it, you should replace the 'Dockerfile' file to 'image-gpt' directory. -Next, use the 'build' command to create an image: +Also, there is 'Dockerfile' in 'image-gpt/Docker' directory. To make a docker-container of the model and use it, you should use the 'build' command to create an image (including dot in the end): ``` -docker build -t image-gpt . -``` - -Check the container existence: - -``` -docker images +docker build -t image-gpt -f docker/Dockerfile . ``` After, you can run it by typing: ``` -docker run image-gpt +nvidia-docker run image-gpt ``` ### Citation diff --git a/docker/Dockerfile b/docker/Dockerfile index aeaa627..959d2eb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,30 +1,26 @@ FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 RUN apt-get update && \ apt-get install -y python3-pip && \ - pip3 install - -# check pyhon environment -RUN python3 --version -RUN pip3 --version + pip3 install # set directory WORKDIR /image-gpt/ # requirements COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt +# copy executive files COPY ["src/", "download.py", "/src/"] -RUN ls -la /src/* # download pre-trained model -RUN python /src/download.py --model s --ckpt 1000000 +RUN python3 /src/download.py --model s --ckpt 1000000 # download dataset -RUN python /src/download.py --model s --ckpt 1000000 --dataset imagenet +RUN python3 /src/download.py --model s --ckpt 1000000 --dataset imagenet # download color clusters -RUN python /src/download.py --model s --ckpt 1000000 --dataset imagenet --clusters +RUN python3 /src/download.py --model s --ckpt 1000000 --dataset imagenet --clusters # run iGPT-S -CMD python /src/run.py --eval --n_embd 512 --n_head 8 --n_layer 24 +CMD python3 /src/run.py --eval --n_embd 512 --n_head 8 --n_layer 24