QuantumLLMInstruct / Dockerfile
BoltzmannEntropy
First commit
8248c84
raw
history blame
3 kB
# Dockerfile customized for deployment on HuggingFace Spaces platform
# -- The Dockerfile has been tailored specifically for use on HuggingFace.
# -- It implies that certain modifications or optimizations have been made with HuggingFace's environment in mind.
# -- It uses "HuggingFace Spaces" to be more specific about the target platform.
# FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel
FROM pytorch/pytorch:2.4.0-cuda12.1-cudnn9-devel
# FOR HF
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
git \
cmake \
python3 \
python3-pip \
python3-venv \
python3-dev \
python3-numpy \
gcc \
build-essential \
gfortran \
wget \
curl \
pkg-config \
software-properties-common \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/*
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
apt-get install -y python3.10 python3-pip
RUN apt-get install -y libopenblas-base libopenmpi-dev
ENV TZ=Asia/Dubai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN useradd -m -u 1000 user
RUN apt-get update && apt-get install -y sudo && \
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
RUN mkdir $HOME/app
RUN mkdir $HOME/app/test_images
# WORKDIR $HOME/app
RUN chown -R user:user $HOME/app
USER user
WORKDIR $HOME/app
RUN python -m pip install qwen-vl-utils
RUN python -m pip install --pre -U -f https://mlc.ai/wheels mlc-llm-nightly-cu122 mlc-ai-nightly-cu122
#python -m pip install --pre -U -f https://mlc.ai/wheels mlc-llm-nightly-cpu mlc-ai-nightly-cpu
RUN python3 -m pip install chromadb db-sqlite3 auto-gptq exllama sqlalchemy
WORKDIR $HOME/app
RUN git clone https://github.com/casper-hansen/AutoAWQ
WORKDIR $HOME/app/AutoAWQ/
RUN python3 -m pip install -e .
WORKDIR $HOME/app
# ENV FLASH_ATTENTION_FORCE_BUILD=TRUE
RUN python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
RUN python -m pip install accelerate diffusers datasets timm flash-attn==2.6.1 gradio
RUN python3 -m pip install --no-deps optimum
RUN python3 -m pip install --no-deps autoawq>=0.1.8
#This seems to be a must : Intel Extension for PyTorch 2.4 needs to work with PyTorch 2.4.*, but PyTorch 2.2.2 is
RUN python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
RUN python3 -m pip install -U accelerate
RUN python3 -m pip install -U git+https://github.com/huggingface/transformers
WORKDIR $HOME/app
COPY --chown=user:user app.py .
COPY --chown=user:user test_images /home/user/app/test_images
ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
RUN python3 -m pip install pennylane sympy pennylane-qiskit duckdb
WORKDIR $HOME/app
EXPOSE 8097 7842 8501 8000 6666 7860
CMD ["python", "app.py"]