Spaces:
Sleeping
Sleeping
File size: 2,266 Bytes
cd299e4 0bf80b6 b375f14 0bf80b6 fbd4fbf 8adecc2 0bf80b6 edda1c9 71f2c10 383ae2a 8adecc2 b51cd0a 88b751b 0bf80b6 9812625 0bf80b6 1c62ccb 31d5d76 0bf80b6 1c62ccb 0bf80b6 1c62ccb 0bf80b6 7748c82 0bf80b6 7f27534 0bf80b6 3075c72 |
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 |
FROM --platform=linux/amd64 ubuntu:latest
ENV PIP_BREAK_SYSTEM_PACKAGES=1
# Install dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y software-properties-common && \
apt-add-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y \
git \
build-essential \
cmake \
python3-pip \
python3.11-dev python3.11-distutils \
wget \
sudo
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# Install requirement packages
COPY ./requirements.txt /tmp/requirements.txt
RUN --mount=type=cache,target=/root/.cache pip install --upgrade -r /tmp/requirements.txt
# Install llvm
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get -y update && apt-get install -y mlir-18-tools llvm-18
# IREE
RUN pip install \
--index-url https://download.pytorch.org/whl/test/cpu torch==2.4.1
RUN pip install iree-turbine
# Install pytorch-mlir
#RUN pip install --pre torch-mlir torch \
# --extra-index-url https://download.pytorch.org/whl/nightly/cpu \
# -f https://github.com/llvm/torch-mlir-release/releases/expanded_assets/dev-wheels
# Add PyTorch-MLIR tools to PATH
#ENV PATH="/root/.local/bin:${PATH}"
# Verify installations
RUN python -c "import torch; print(torch.__version__)" && \
mlir-opt-18 --version && \
llvm-as-18 --version
# Working directory for MLIR operations
#WORKDIR /workspace
# Set up a new user named "user"
RUN useradd -m -o -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
CMD ["python", "main.py"]
|