FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-runtime # Install as root RUN pip install --no-cache-dir \ transformers>=4.40.0 \ peft>=0.10.0 \ bitsandbytes>=0.43.0 \ datasets>=2.18.0 \ huggingface-hub>=0.21.0 \ accelerate>=0.27.0 \ sentencepiece \ protobuf # Create non-root user (HF Spaces requirement) RUN useradd -m -u 1000 user RUN mkdir -p /tmp/hf_cache /tmp/buleyean-70b-output && \ chown -R user:user /tmp/hf_cache /tmp/buleyean-70b-output USER user WORKDIR /app COPY app.py . ENV PYTHONUNBUFFERED=1 ENV HF_HOME=/tmp/hf_cache ENV TRANSFORMERS_CACHE=/tmp/hf_cache ENV HF_DATASETS_CACHE=/tmp/hf_cache CMD ["python", "app.py"]