Spaces:
Running
Running
# 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 chown -R user:user $HOME/app | |
USER user | |
WORKDIR $HOME/app | |
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 faster_whisper jiwer pydub | |
#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 scipy | |
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 heb.wav . | |
COPY --chown=user:user noise.wav . | |
ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces | |
WORKDIR $HOME/app | |
EXPOSE 8097 7842 8501 8000 6666 7860 | |
CMD ["python", "app.py"] |