|
| 1 | +FROM pytorch/pytorch:latest |
| 2 | + |
| 3 | +WORKDIR /workspace |
| 4 | + |
| 5 | +# Setup dependencies |
| 6 | +RUN pip install tqdm tensorboardX git+https://github.com/pytorch/ignite.git@distrib |
| 7 | + |
| 8 | +# Setup dataset |
| 9 | +RUN mkdir /workspace/data && python -c 'from torchvision.datasets.cifar import CIFAR10; CIFAR10("/workspace/data", download=True)' |
| 10 | + |
| 11 | +# Copy code |
| 12 | +RUN mkdir /workspace/code |
| 13 | +COPY fastresnet.py /workspace/code/fastresnet.py |
| 14 | +COPY main.py /workspace/code/main.py |
| 15 | +COPY utils.py /workspace/code/utils.py |
| 16 | +COPY gcp_ai_platform/entrypoint.sh /workspace/code/entrypoint.sh |
| 17 | +COPY gcp_ai_platform/parse_cluster_spec.py /workspace/code/parse_cluster_spec.py |
| 18 | + |
| 19 | +# Installs google cloud sdk, this is mostly for using gsutil to export model. |
| 20 | +RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz -o google-cloud-sdk.tar.gz && \ |
| 21 | + mkdir /root/tools && \ |
| 22 | + tar xvzf google-cloud-sdk.tar.gz -C /root/tools && \ |
| 23 | + rm google-cloud-sdk.tar.gz && \ |
| 24 | + /root/tools/google-cloud-sdk/install.sh --usage-reporting=false \ |
| 25 | + --path-update=false --bash-completion=false \ |
| 26 | + --disable-installation-options && \ |
| 27 | + rm -rf /root/.config/* && \ |
| 28 | + ln -s /root/.config /config && \ |
| 29 | + # Remove the backup directory that gcloud creates |
| 30 | + rm -rf /root/tools/google-cloud-sdk/.install/.backup |
| 31 | + |
| 32 | +# Path configuration |
| 33 | +ENV PATH $PATH:/root/tools/google-cloud-sdk/bin |
| 34 | +# Make sure gsutil will use the default service account |
| 35 | +RUN echo '[GoogleCompute]\nservice_account = default' > /etc/boto.cfg |
| 36 | + |
| 37 | +# Sets up the entry point to invoke the trainer. |
| 38 | +ENTRYPOINT ["/bin/bash", "/workspace/code/entrypoint.sh"] |
0 commit comments