Spaces:
Starting
on
L4
Starting
on
L4
# 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. This simplified Dockerfile is based on an intermediate image | |
# (./Dockerfile.base) that already has Tex Live and pyenv installed, thereby | |
# greatly improving build time. It also defers preloading of detikzify models | |
# to runtime to avoid OOM errors. | |
## system setup | |
# ----------------------------------------------------------------------------- | |
FROM registry.hf.space/nllg-detikzify:gpu-7ec758b-nmbqkl3l | |
## 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 | |
# ----------------------------------------------------------------------------- | |
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 | |
## prepare cache for models | |
# ----------------------------------------------------------------------------- | |
RUN mkdir -p $HOME/.cache \ | |
&& chown -R user $HOME/.cache | |
## preload detikzify-v2.5 and launch app | |
# ----------------------------------------------------------------------------- | |
USER user | |
CMD huggingface-cli download nllg/detikzify-v2.5-8b \ | |
&& python app.py | |