2 ms·
You can 100% run this on an 8gb card. Make sure to load the model weights in half precision (and optionally enable attention slicing). E.g., using the diffusers
by montebicyclelo 4y ago
You can 100% run this on an 8gb card. Make sure to load the model weights in half precision (and optionally enable attention slicing). E.g., using the diffusers library [1]:
from diffusers import StableDiffusionPipeline
from torch import autocast
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
revision="fp16",
torch_dtype=torch.float16,
use_auth_token=True
)
pipe = pipe.to("cuda")
pipe.enable_attention_slicing()
prompt = "a photo of an astronaut riding a horse on mars"
with autocast("cuda"):
image = pipe(prompt).images[0]
[1] https://github.com/huggingface/diffusers https://github.com/huggingface/diffusers