-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker support (Tested on RTX3080) + ignoring reproducable files / cache #50
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
models/ | ||
Dockerfile | ||
README.md | ||
LICENSE | ||
assets/ | ||
*.egg-info |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
models/ldm/text2img-large/ | ||
outputs/ | ||
src/ | ||
__pycache__/ | ||
*.egg-info |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04 | ||
MAINTAINER Peter Willemsen <peter@codebuffet.co> | ||
RUN echo "Installing dependencies..." && \ | ||
apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget sudo git build-essential cmake pkg-config liblzma-dev libbz2-dev zlib1g-dev libssl-dev zsh clang && \ | ||
apt-get dist-upgrade -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /src/python | ||
RUN wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz -O python-src.tar.gz && \ | ||
tar xzvf python-src.tar.gz --strip-components=1 && \ | ||
rm python-src.tar.gz && \ | ||
./configure --enable-optimizations --prefix=/opt/python-3.8.5 && \ | ||
make && \ | ||
make install && \ | ||
rm -rf /src/python | ||
WORKDIR / | ||
ENV PATH="/opt/python-3.8.5/bin:${PATH}" | ||
|
||
RUN python3 -m pip install pip==20.3 | ||
RUN pip3 install torch==1.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html | ||
RUN pip3 install numpy==1.19.2 torchvision==0.11.2 albumentations==0.4.3 opencv-python==4.1.2.30 pudb==2019.2 imageio==2.9.0 imageio-ffmpeg==0.4.2 pytorch-lightning==1.6.1 omegaconf==2.1.1 test-tube>=0.7.5 streamlit>=0.73.1 einops==0.3.0 torch-fidelity==0.3.0 transformers==4.3.1 -e "git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers" -e "git+https://github.com/openai/CLIP.git@main#egg=clip" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why not put these in a requirements file so its easier to read? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can do that, except |
||
|
||
RUN mkdir -p /opt/ldm_package | ||
ADD ./setup.py /opt/ldm_package | ||
ADD ./ldm /opt/ldm_package/ldm | ||
ADD ./configs /opt/ldm_package/configs | ||
RUN pip3 install -e /opt/ldm_package | ||
|
||
WORKDIR /opt/ldm | ||
|
||
# Add dev user | ||
RUN useradd -ms /bin/zsh ldm-dev && \ | ||
usermod -aG sudo ldm-dev && \ | ||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
USER ldm-dev | ||
|
||
ENTRYPOINT ["python3"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ This will probably not work on older GPUs. Perhaps we should state it in the documentation somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking of using build args for this. However, I don't know the exact configuration for each GPU. I used an RTX3080, I think that we should just expose the choice of Torch versions as build arg, and then let people choose themselves. We can set a default version that works for most GPU's.
But I don't think GPU with less than 12GB VRAM works anyway, so it narrows down the old GPU's supported, depending on how old we're talking about!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder, is there a better way to get the right Torch version supporting the GPU of the machine running the image builder I'm not aware of? Currently, all my Dockerfiles are configured for my GPU, but it makes it less portable.