Focus has been put into simple prompts, good one-off generation, slightly muted colours, low memory usage, small model size.
It is intended as easy model for use in larger projects where image generation is needed.
1import torch # Tested with 2.0.1+cu118
2from diffusers import StableDiffusionPipeline # <3
3
4
5# Model location in HF
6model = "https://huggingface.co/vluz/Generalis_V1.1/blob/main/Generalis_v1-1.safetensors"
7
8# Create pipe
9pipe = StableDiffusionPipeline.from_ckpt(model,
10 torch_dtype=torch.float16,
11 safety_checker=None,
12 feature_extractor=None,
13 requires_safety_checker=False,)
14
15# Cleanup
16del pipe.vae.encoder
17torch.cuda.empty_cache()
18
19# Send to GPU
20pipe = pipe.to("cuda")
21
22# Optimize for low vram use and clear cache again
23pipe.enable_vae_tiling()
24pipe.enable_attention_slicing("max")
25pipe.enable_xformers_memory_efficient_attention(attention_op=None)
26pipe.unet.to(memory_format=torch.channels_last)
27pipe.enable_sequential_cpu_offload()
28torch.cuda.empty_cache()
29
30# Set a prompt
31prompt = "a cat"
32
33# Generate image based on prompt
34image = pipe(prompt).images[0]
35
36# Save result image to disk
37image.save("cat.png")