Spaces:
Running
on
L4
Running
on
L4
File size: 2,321 Bytes
116a187 4827f56 116a187 4827f56 116a187 81b7736 116a187 c4af1bb 116a187 c4af1bb ca81b44 c4af1bb 116a187 b71501f |
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 |
# Custom docker image for DeTikZify. The default HF Spaces GPU image installs a
# tex live version that is too old for our needs, so we install the correct one
# ourselves.
## system setup
# -----------------------------------------------------------------------------
FROM nvcr.io/nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
ARG DEBIAN_FRONTEND=noninteractive
Run apt update && apt install -y \
ghostscript \
poppler-utils \
git \
make \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
curl \
llvm \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev \
ffmpeg \
libsm6 \
libxext6 \
cmake \
libgl1-mesa-glx \
sudo
# install tex live 2023
ENV PATH=/opt/texbin:$PATH
RUN curl -LO https://github.com/scottkosty/install-tl-ubuntu/raw/master/install-tl-ubuntu \
&& chmod +x ./install-tl-ubuntu \
&& ./install-tl-ubuntu --repository 'https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2023/tlnet-final'\
&& rm ./install-tl-ubuntu
## setup user
# -----------------------------------------------------------------------------
RUN useradd -m -G users -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
## install python dependencies
# -----------------------------------------------------------------------------
# install pyenv
ENV PYENV_ROOT=/opt/pyenv
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN curl https://pyenv.run | bash \
&& chown -R root:users $PYENV_ROOT \
&& chmod -R g+w $PYENV_ROOT
RUN pyenv install 3.11 \
&& pyenv global 3.11 \
&& pyenv rehash \
&& pip install --no-cache-dir --upgrade setuptools wheel \
&& pip install --no-cache-dir 'detikzify[legacy] @ git+https://github.com/potamides/DeTikZify' \
&& pip install --no-cache-dir flash-attn --no-build-isolation \
&& pip install --no-cache-dir spaces
RUN chown -R user $HOME/app
COPY --chown=user . $HOME/app
## preload v2 models
# -----------------------------------------------------------------------------
RUN huggingface-cli download nllg/detikzify-v2-8b \
&& chown -R user $HOME/.cache
## launch app
# -----------------------------------------------------------------------------
USER user
CMD ["python", "app.py"]
|