Spaces:
Build error
Build error
# Use a more specific Python version | |
FROM python:3.9.16-slim | |
# Set working directory and environment variables | |
WORKDIR /app | |
ENV TRANSFORMERS_CACHE=/app/cache \ | |
HF_HOME=/app/cache \ | |
PYTHONUNBUFFERED=1 | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
git \ | |
gcc \ | |
g++ \ | |
make \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create writable cache directory | |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
# Install Python packages using a requirements.txt file | |
COPY requirements.txt. | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Authenticate with Hugging Face | |
ARG HF_TOKEN | |
RUN python -c "from huggingface_hub import HfFolder; HfFolder.save_token('$HF_TOKEN')" | |
# Copy train.py file | |
COPY train.py. | |
# Set command to run train.py | |
CMD ["python", "train.py"] |