Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Model prep phase, also cuts down on build context wait time since these models files
  2. # are large and prone to take long to copy...
  3. FROM disco-diffusion-prep:5.1 AS modelprep
  4. FROM nvcr.io/nvidia/pytorch:21.08-py3
  5. ENV PYTHONDONTWRITEBYTECODE 1
  6. ENV PYTHONUNBUFFERED 1
  7. # Install a few dependencies
  8. RUN apt update
  9. RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install -y tzdata imagemagick
  10. # Create a disco user
  11. RUN useradd -ms /bin/bash disco
  12. USER disco
  13. # Set up code directory
  14. RUN mkdir code
  15. WORKDIR /workspace/code
  16. # Copy over models used
  17. COPY --from=modelprep /scratch/models /workspace/code/models
  18. COPY --from=modelprep /scratch/pretrained /workspace/code/pretrained
  19. # Clone Git repositories
  20. RUN git clone https://github.com/alembics/disco-diffusion.git && \
  21. git clone https://github.com/openai/CLIP && \
  22. git clone https://github.com/assafshocher/ResizeRight.git && \
  23. git clone https://github.com/MSFTserver/pytorch3d-lite.git && \
  24. git clone https://github.com/isl-org/MiDaS.git && \
  25. git clone https://github.com/crowsonkb/guided-diffusion.git && \
  26. git clone https://github.com/shariqfarooq123/AdaBins.git
  27. # Install Python packages
  28. RUN pip install imageio imageio-ffmpeg==0.4.4 pyspng==0.1.0 lpips datetime timm ipywidgets omegaconf>=2.0.0 pytorch-lightning>=1.0.8 torch-fidelity einops wandb pandas ftfy
  29. # Precache other big files
  30. COPY --chown=disco --from=modelprep /scratch/clip /home/disco/.cache/clip
  31. COPY --chown=disco --from=modelprep /scratch/model-lpips/vgg16-397923af.pth /home/disco/.cache/torch/hub/checkpoints/vgg16-397923af.pth