|
|
|
|
|
FROM python:3.9 |
|
|
|
|
|
|
|
ENV PATH="/home/user/.local/bin:/opt/conda/bin:$PATH" |
|
|
|
|
|
|
|
ARG PYTORCH_VERSION=2.1.0 |
|
ARG PYTHON_VERSION=3.9 |
|
ARG CUDA_VERSION=11.8 |
|
ARG CU_DNN=8.5.0.96 |
|
ARG MAMBA_VERSION=24.3.0-0 |
|
ARG CUDA_CHANNEL=nvidia |
|
ARG INSTALL_CHANNEL=pytorch |
|
|
|
ARG TARGETPLATFORM |
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
build-essential \ |
|
ca-certificates \ |
|
ccache \ |
|
curl \ |
|
python3 \ |
|
python3-pip \ |
|
git && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
RUN git clone https://github.com/lee-ny/teaching_arithmetic.git /teaching_arithmetic |
|
|
|
|
|
|
|
|
|
RUN case ${TARGETPLATFORM} in \ |
|
"linux/arm64") MAMBA_ARCH=aarch64 ;; \ |
|
*) MAMBA_ARCH=x86_64 ;; \ |
|
esac && \ |
|
curl -fsSL -v -o ~/mambaforge.sh -O "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh" |
|
RUN chmod +x ~/mambaforge.sh && \ |
|
bash ~/mambaforge.sh -b -p /opt/conda && \ |
|
rm ~/mambaforge.sh |
|
|
|
|
|
|
|
RUN case ${TARGETPLATFORM} in \ |
|
"linux/arm64") exit 1 ;; \ |
|
*) /opt/conda/bin/conda update -y conda && \ |
|
/opt/conda/bin/conda install -c "${INSTALL_CHANNEL}" -c "${CUDA_CHANNEL}" -y "python=${PYTHON_VERSION}" "pytorch=$PYTORCH_VERSION" "pytorch-cuda=$(echo $CUDA_VERSION | cut -d'.' -f 1-2)" ;; \ |
|
esac && \ |
|
/opt/conda/bin/conda clean -ya |
|
|
|
|
|
COPY ./requirements.txt requirements.txt |
|
RUN pip install --no-cache-dir --upgrade -r requirements.txt |
|
|
|
|
|
|
|
COPY . /app |
|
RUN mkdir out |
|
RUN mkdir out/addition_train |
|
COPY ./out /out |
|
RUN chmod +x /out |
|
|
|
|
|
COPY ./train.sh /train.sh |
|
RUN chmod +x /train.sh |
|
|
|
|
|
|
|
ENTRYPOINT ["/train.sh"] |