-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Docker support] enabling docker, adding description to readme #134
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
base: main
Are you sure you want to change the base?
Changes from all commits
1f065ce
241808f
ed57090
56652e0
a14d536
c035a67
0890fda
12169c5
a275d9d
a4e7663
7fdee4e
011e831
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,36 @@ | ||||||||||||||
| FROM python:3.8-slim | ||||||||||||||
| RUN apt update && apt install -y wget git libglib2.0-0 libsm6 libxext6 libxrender-dev | ||||||||||||||
| RUN apt clean && rm -rf /var/lib/apt/lists/* | ||||||||||||||
| # RUN useradd -ms /bin/bash stablediff | ||||||||||||||
| # install conda | ||||||||||||||
| RUN wget \ | ||||||||||||||
| https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||||||||||||||
| && mkdir /root/.conda \ | ||||||||||||||
| && bash Miniconda3-latest-Linux-x86_64.sh -b \ | ||||||||||||||
| && rm -f Miniconda3-latest-Linux-x86_64.sh \ | ||||||||||||||
| && echo PATH="/root/miniconda3/bin":$PATH >> .bashrc | ||||||||||||||
| RUN chmod +x /root/miniconda3/bin/conda | ||||||||||||||
| RUN ln -s /root/miniconda3/bin/conda /usr/local/bin/conda | ||||||||||||||
| RUN conda update -y conda | ||||||||||||||
| # i am using git clone instead during development of this dockerfile | ||||||||||||||
| COPY . /app/ | ||||||||||||||
|
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. So as to take advantage of Docker's build cache,
Suggested change
Author
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. need to check if really only the environment.yml is needed, I think the .yml uses the setup.py to build the local package as well, that is why I thought it's needed as well. will check it out though |
||||||||||||||
| RUN mkdir /app/outputs/ | ||||||||||||||
| RUN mkdir /app/weights/ | ||||||||||||||
| # RUN git clone https://github.com/CompVis/stable-diffusion.git /app/ | ||||||||||||||
| WORKDIR /app/ | ||||||||||||||
| RUN conda env create -f environment.yaml -n ldm | ||||||||||||||
| # conda env trick | ||||||||||||||
| RUN rm /usr/local/bin/python | ||||||||||||||
| RUN ln -s /root/miniconda3/envs/ldm/bin/python /usr/local/bin/python | ||||||||||||||
|
Comment on lines
+23
to
+24
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. Have you considered this simpler alternative?
Suggested change
Author
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. yeah at least for me it didn't work when calling python later on... but feel free to try it out 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. you can also look at
Suggested change
|
||||||||||||||
| ENV PROMPT="a drawing of a giraffe riding a motorcycle in space" | ||||||||||||||
| # trigger first download to prevent re-downloading in the future | ||||||||||||||
| # the script will fail as we do not have the weights yet, therefore the exit 0 | ||||||||||||||
| # RUN python scripts/txt2img.py; exit 0 | ||||||||||||||
| # there are even more post install downloads. the image is really big anyways already, | ||||||||||||||
| # so i was thinking about just including the weights as well... open to your ideas! | ||||||||||||||
| RUN wget https://github.com/DagnyT/hardnet/raw/master/pretrained/train_liberty_with_aug/checkpoint_liberty_with_aug.pth -P /root/.cache/torch/hub/checkpoints | ||||||||||||||
| # and now just grab the weights as well | ||||||||||||||
| RUN wget https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media -O weights/sd-v1-4.ckpt | ||||||||||||||
| CMD [ "python", "scripts/txt2img.py", \ | ||||||||||||||
|
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. Along with the other suggestion for
Suggested change
|
||||||||||||||
| "--prompt", "'$PROMPT'", "--plms", "--ckpt", "./weights/sd-v1-4.ckpt", "--skip_grid", \ | ||||||||||||||
| "--n_samples", "1", "--n_iter", "1"] | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| version: "3" | ||
| services: | ||
| stable-diffusor: | ||
| # TODO: exchange this image with an image of CompVis | ||
| image: guestros/stable-diffusion:latest | ||
| build: . | ||
|
JustinGuese marked this conversation as resolved.
|
||
| platform: linux/amd64 | ||
| volumes: | ||
| - ./weights/:/app/weights/ | ||
| - ./outputs/:/app/outputs/ | ||
| environment: | ||
| - PROMPT="a drawing of a giraffe riding a bicycle in space" | ||
| # to make sure all gpus are passed | ||
| deploy: | ||
| resources: | ||
| reservations: | ||
| devices: | ||
| - capabilities: [gpu] | ||
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.
The official continuumio/miniconda3 container images would spare a few lines
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 was hesitant about that because it was last updated 3 months ago... but yeah maybe using that and just do a apt update upgrade...?