-
Notifications
You must be signed in to change notification settings - Fork 485
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
Add stable diffusion example #1149
Add stable diffusion example #1149
Conversation
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.
Thanks @sumanthgenz! I tried it out and it works great. Some comments.
|
||
|
||
resources: | ||
cloud: azure |
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.
Can we leave this out? So people have flexibility.
accelerators: V100:1 | ||
|
||
file_mounts: | ||
/stable_diffusion: ./docker/stable_diffusion |
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.
Change the source (RHS) to .
? See the other comment for dir structure.
@@ -0,0 +1,35 @@ | |||
|
|||
# Steps to run this example: |
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 is great! Can we also put them in a README.md? Can even add Step 0: pip install skypilot
and point to our Installation docs page. Maybe some title like "Run your own Stable Diffusion UI in the cloud with one click"?
examples/stable_diffusion/
README.md
this.yaml
Dockerfile
Goal is for people to come to this dir, look at README and immediately get started.
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.
+1, we should move this to examples/stable_diffusion
@@ -0,0 +1,58 @@ | |||
# Note: this file is from https://github.com/AbdBarho/stable-diffusion-webui-docker/blob/master/build/Dockerfile |
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.
Seems like this file has changes on top of the referred to file. Could we describe those changes here? Wondering if we can take that existing Dockerfile and run it with SkyPilot.
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 docker in the instance cannot compile the original dockerfile from the repo. I removed <<EOF heredoc to fix that, so that was the only change. I will specify that we made that change.
RUN python /info.py /stable-diffusion/frontend/frontend.py | ||
|
||
WORKDIR /stable-diffusion | ||
ENV TRANSFORMERS_CACHE=/cache/transformers TORCH_HOME=/cache/torch CLI_ARGS="" \ |
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.
Are we using the Stable Diffusion ckpt sd-v1-4.ckpt
, or the models downloaded on L44-46?
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.
We are using sd-v1-4.ckpt
In the README, it'd also be great to include some (setting, prompt) combos that generate great-looking pics. (I tried my own prompts and they didn't work out so great.) |
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.
@@ -0,0 +1,35 @@ | |||
|
|||
# Steps to run this example: |
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.
+1, we should move this to examples/stable_diffusion
|
||
run: | | ||
cd stable-diffusion-webui-docker | ||
docker-compose up --build |
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.
is the --build
required? We already run docker-compose build
in setup
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.
good point, i will remove it
# download dev UI version, update the sha below in case you want some other version | ||
# RUN <<EOF | ||
# git clone https://github.com/hlky/stable-diffusion-webui.git | ||
# cd stable-diffusion-webui | ||
# # map to this file: https://github.com/hlky/stable-diffusion-webui/blob/master/.github/sync.yml | ||
# git reset --hard 49e6178fd82ca736f9bbc621c6b12487c300e493 | ||
# cp -t /stable-diffusion/scripts/ webui.py relauncher.py txt2img.yaml | ||
# cp -t /stable-diffusion/configs/webui webui.yaml | ||
# cp -t /stable-diffusion/frontend/ frontend/* | ||
# cd / && rm -rf stable-diffusion-webui | ||
# EOF |
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.
If not used, should we just remove this? Or maybe make the comments more descriptive - right now its not clear what this code block is for.
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 readme looks great! Will be very useful for new users.
examples/stable_diffusion/README.md
Outdated
|
||
2. Run sky launch -c stable-diffusion stable_diffusion_docker.yaml | ||
|
||
3. Run ssh -L 7860:localhost:7860 stable-diffusion |
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.
Add codeblock formatting:
Run `ssh -L 7860:localhost:7860 stable-diffusion`
examples/stable_diffusion/README.md
Outdated
|
||
1. Install skypilot by following these [instructions](https://skypilot.readthedocs.io/en/latest/getting-started/installation.html) | ||
|
||
2. Run sky launch -c stable-diffusion stable_diffusion_docker.yaml |
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.
perhaps add a block git clone and cd to this directory:
git clone https://github.com/skypilot-org/skypilot.git && cd examples/stable_diffusion
sky launch -c stable-diffusion stable_diffusion_docker.yaml
The idea is to have a copy-paste-able readme :)
examples/stable_diffusion/README.md
Outdated
@@ -0,0 +1,33 @@ | |||
## Setup | |||
|
|||
1. Install skypilot by following these [instructions](https://skypilot.readthedocs.io/en/latest/getting-started/installation.html) |
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.
Nit: Add a period at the end of bullet points that are complete sentences
examples/stable_diffusion/README.md
Outdated
|
||
3. Run ssh -L 7860:localhost:7860 stable-diffusion | ||
|
||
4. Open http://localhost:7860/ in browser. |
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.
Add codeblock formatting:
Open [`http://localhost:7860/`](http://localhost:7860/) in browser.
examples/stable_diffusion/README.md
Outdated
|
||
4. Open http://localhost:7860/ in browser. | ||
|
||
5. Type in text prompt and click "Generate" |
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.
Nit: Add a period at the end of bullet points that are complete sentences
4. Open http://localhost:7860/ in browser. | ||
|
||
5. Type in text prompt and click "Generate" | ||
|
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.
Add:
6. Once you are done, run `sky down stable-diffusion` to terminate the VM.
examples/stable_diffusion/Dockerfile
Outdated
@@ -1,4 +1,6 @@ | |||
# Note: this file is from https://github.com/AbdBarho/stable-diffusion-webui-docker/blob/master/build/Dockerfile | |||
# Note: this file is modified from https://github.com/AbdBarho/stable-diffusion-webui-docker/blob/master/build/Dockerfile |
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.
*adapted from
@@ -0,0 +1,24 @@ | |||
# To launch a 1 GPU instance to run stable diffusion web tool. |
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.
Nit: SkyPilot YAML run stable diffusion web tool on 1 V100 GPU.
examples/stable_diffusion/README.md
Outdated
- "donkey playing poker" | ||
- "UC Berkeley student writing code on a laptop" | ||
- "Marvel vs. DC" | ||
- "toilet human" |
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.
Maybe let's remove this one :)
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.
Looks good! The example works well - we can iterate on the README as required later.
Add a Dockerfile needed to create docker environment to run a stable diffusion web tool on GPU.
Add a yaml to launch an instance with a GPU to run said Dockerfile and run the stable diffusion tool (using ssh with port forwarding).