Skip to content
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 an example Google Colab / Jupyter Notebook file #9

Open
0xdevalias opened this issue Nov 24, 2022 · 8 comments
Open

Add an example Google Colab / Jupyter Notebook file #9

0xdevalias opened this issue Nov 24, 2022 · 8 comments
Labels
documentation Improvements or additions to documentation

Comments

@0xdevalias
Copy link

Similar to:

@0xdevalias
Copy link
Author

0xdevalias commented Nov 24, 2022

@0xdevalias
Copy link
Author

Should work now, make sure you check the box "redownload original model" when choosing V2

https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

Requires more than 12GB of RAM for now, so free colab probably won't suffice.

Originally posted by @TheLastBen in TheLastBen/fast-stable-diffusion#599 (comment)

@inflamously
Copy link

@0xdevalias Hello there, I hope is it fine for you that I kind of created a "minified" version of your colab which works fine with a T4 using xformers.
Sometimes later I might add other tools like Inpainting, Depth and Upscaling.

https://colab.research.google.com/drive/1wzI9nt8dYqq47I1Y-WvOAiO01y7EBoiO?usp=sharing

@backnotprop
Copy link

Here is a Colab/Gradio setup to play with the depth model:

https://github.com/backnotprop/Colab-Stable-Diffusion-2-Depth-UI/tree/main

@0xdevalias
Copy link
Author

I hope is it fine for you that I kind of created a "minified" version of your colab which works fine with a T4 using xformers.

@inflamously It's not my colab, just one I found on another repo and wanted to ensure was linked and accessible here :)

@0xdevalias
Copy link
Author

The inpainting model should work now without needing to rename the checkpoint.
For anyone who wants to try it: https://colab.research.google.com/drive/1ayH6PUri-vvTXhaoL3NEZr_iVvv2qosR

Originally posted by @uservar in AUTOMATIC1111/stable-diffusion-webui#5011 (comment)

@0xdevalias
Copy link
Author

0xdevalias commented Nov 25, 2022

Yes, stable_diffusion2 is working now. And the few lines of code to get inference is in here:
https://colab.research.google.com/drive/1Na9x7w7RSbk2UFbcnrnuurg7kFGeqBsa?usp=sharing

Originally posted by @hamzafar in huggingface/diffusers#1388 (comment)

!pip install --upgrade git+https://github.com/huggingface/diffusers.git transformers accelerate scipy
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
import torch

model_id = "stabilityai/stable-diffusion-2"

# Use the Euler scheduler here instead
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "beautiful gaze"

image = pipe(prompt, height=768, width=768).images[0]
image

@woctezuma
Copy link

woctezuma commented Nov 26, 2022

Alternatively, run stable_diffusion.ipynb. Open In Colab

@dmarx dmarx added the documentation Improvements or additions to documentation label Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants