Created
November 9, 2023 11:49
-
-
Save rubenvarela/b842560876898411269015a35335ee63 to your computer and use it in GitHub Desktop.
stable diffusion test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
torch | |
diffusers | |
transformers | |
pandas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from diffusers import DiffusionPipeline | |
import time | |
import pandas as pd | |
pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5") | |
pipe = pipe.to("cpu") | |
# Recommended if your computer has < 64 GB of RAM | |
pipe.enable_attention_slicing() | |
prompt = "a photo of an astronaut riding a horse on mars" | |
out = [] | |
for x in range(5): | |
start = time.time() | |
image = pipe(prompt).images[0] | |
out.append(time.time() - start) | |
image.save('test.png') | |
df = pd.DataFrame(out) | |
print(f"mean: {df.mean()[0]}") | |
print(f"variance: {df.var()[0]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment