# Hayat Elixir AI V5.1 - Meditron3-70B QLoRA Training # ERROR-PROOF v2 — addresses all 17 known HF Space errors # ERR-17 FIX: Disk-safe model loading with shard cleanup FROM nvidia/cuda:12.1.0-devel-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV HF_HOME=/app/hf_cache ENV TRANSFORMERS_CACHE=/app/hf_cache ENV TORCH_HOME=/app/torch_cache ENV PYTHONUNBUFFERED=1 # Faster downloads from HuggingFace Hub ENV HF_HUB_ENABLE_HF_TRANSFER=1 RUN apt-get update && apt-get install -y \ python3 python3-pip git wget curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN chmod -R 777 /app # ERR-07: PyTorch >= 2.4 RUN pip3 install --no-cache-dir \ torch==2.5.1 --index-url https://download.pytorch.org/whl/cu121 # ERR-09/10: Pin ALL versions, include rich RUN pip3 install --no-cache-dir \ transformers==4.46.0 \ peft==0.13.0 \ trl==0.9.6 \ bitsandbytes==0.44.1 \ accelerate==1.0.0 \ datasets==3.0.0 \ huggingface_hub==0.26.0 \ hf_transfer \ rich flask scipy sentencepiece protobuf COPY train.py /app/ COPY hayat_writer_v5_MASTER.jsonl /app/ RUN chmod -R 777 /app EXPOSE 7860 CMD ["python3", "train.py"]