Spaces:
Sleeping
Sleeping
| # MatGL M3GNet predictor Space. | |
| # 2026-06-05: migrated DGL -> PyG. The old DGL stack (dgl==2.2.0 + torchdata + | |
| # the retired M3GNet-MP-2021.2.8-PES model) no longer works (model 404'd; MatGL | |
| # dropped DGL at 3.0.4). Now: MatGL 4.x (PyG default) + torch-geometric. | |
| # CRITICAL: matgl is PINNED (==4.0.1). The previous Dockerfile left `matgl` | |
| # unpinned, so an HF rebuild silently pulled a newer matgl that broke model load. | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| libcurl4 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Pinned dependency stack (verified 2026-06-05: loads M3GNet-PES-MatPES-PBE-2025.2 | |
| # + predicts a NaCl cell = -1.969 eV). | |
| RUN pip install --no-cache-dir "numpy<2" | |
| RUN pip install --no-cache-dir torch==2.3.0 --index-url https://download.pytorch.org/whl/cpu | |
| RUN pip install --no-cache-dir torch-geometric | |
| RUN pip install --no-cache-dir "matgl==4.0.1" pymatgen gradio | |
| # Non-root user (HF Spaces convention) | |
| RUN useradd -m -u 1000 user | |
| RUN chown -R user:user /app | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/app/.cache | |
| COPY --chown=user app.py /app/ | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |