mknolan's picture
Upload Dockerfile with huggingface_hub
5bae866 verified
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
# Create necessary directories with proper permissions
RUN mkdir -p /app/.cache/huggingface/transformers && \
chmod -R 777 /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
ca-certificates \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Create a working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt ./requirements.txt
# Install dependencies
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt
# Copy the diagnostic script
COPY debug_model_loading.py ./app.py
# Make port 7860 available
EXPOSE 7860
# Run the diagnostic
CMD ["python3", "app.py"]