File size: 3,196 Bytes
10dd6c2 8aa5379 e9c68d8 8aa5379 218c4a7 f74c60f 33464a2 7da53e2 f74c60f 6fd1f9d f74c60f 23d1ee5 f74c60f 750eb92 2e7fcf1 750eb92 4eaa323 33464a2 5db51af f74c60f bdda622 5db51af 33464a2 5db51af 8aa5379 33464a2 8aa5379 1a4e767 a22a42d 1a4e767 e6fd5f0 1a4e767 92078c7 e6fd5f0 5db51af e6fd5f0 33464a2 28a91ae e6fd5f0 5db51af 1a4e767 5db51af ab146bf 5db51af 8aa5379 3e46726 0d97cbe 5db51af df6f1af 0d97cbe 57e8607 5db51af 89e9079 750eb92 5db51af 0d97cbe ab146bf f74c60f 43a85db 33464a2 f74c60f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# Documentation: https://huggingface.co/docs/hub/spaces-sdks-docker
FROM python:3.9
RUN useradd -m -u 1000 user
COPY --chown=user ./requirements.txt /requirements.txt
COPY --chown=user ./train.sh /train.sh
RUN chmod +x /train.sh
RUN mkdir /app
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
RUN git clone https://github.com/lee-ny/teaching_arithmetic.git /teaching_arithmetic && cd teaching_arithmetic && pip install -e .
COPY --chown=user . /app
#COPY --chown=user /teaching_arithmetic /app
#&& cd teaching_arithmetic && pip install -e .
#COPY --chown=user /teaching_arithmetic /app/teaching_arithmetic
#RUN chmod +x /teaching_arithmetic
#COPY --chown=user . /app
USER user
WORKDIR /app
ENV PATH="/home/user/.local/bin:/opt/conda/bin:$PATH"
ENV HOME="/home/user"
#WORKDIR $HOME/app
#RUN pip install --no-cache-dir --upgrade pip
ARG PYTORCH_VERSION=2.1.0
ARG PYTHON_VERSION=3.9 #8.10
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
# Automatically set by buildx
ARG TARGETPLATFORM
# Update basic dependencies we'll be using.
#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 teaching_arithmetic && pip install -e .
# Install conda
# translating Docker's TARGETPLATFORM into mamba arches
#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
# Install pytorch
# On arm64 we exit with an error code
#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
#USER 1000
#COPY --chown=user ./requirements.txt requirements.txt
#COPY ./requirements.txt requirements.txt
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
#COPY --chown=user teaching_arithmetic /teaching_arithmetic
#COPY . /app
#COPY ./out /out
#RUN chmod 777 -R /out
#RUN chmod +x /out
#COPY ./out/addition_train /out/
#RUN chmod +x /teaching_arithmetic/train.py
#COPY ./train.sh /train.sh
#RUN chmod +x /train.sh
# Expose the secret DEBUG at buildtime and use its value as git remote URL
#RUN --mount=type=secret,id=DEBUG,mode=0444,required=true \
# git init && \
# git remote add origin $(cat /run/secrets/DEBUG)
# USER 1000
RUN chmod +x train.sh
#CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
ENTRYPOINT ["/train.sh"] |