AdamLucek commited on
Commit
22feceb
1 Parent(s): e951fec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -41,7 +41,35 @@ Special VAE used for training: [madebyollin/sdxl-vae-fp16-fix](https://huggingfa
41
  #### How to use
42
 
43
  ```python
44
- # TODO: add an example code snippet for running this diffusion pipeline
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ```
46
 
47
  #### Limitations and bias
 
41
  #### How to use
42
 
43
  ```python
44
+ from diffusers import DiffusionPipeline
45
+ import torch
46
+
47
+ # Load Stable Diffusion XL Base1.0
48
+ pipe = DiffusionPipeline.from_pretrained(
49
+ "stabilityai/stable-diffusion-xl-base-1.0",
50
+ torch_dtype=torch.float16,
51
+ variant="fp16",
52
+ use_safetensors=True
53
+ ).to("cuda")
54
+
55
+ # Optional CPU offloading to save some GPU Memory
56
+ pipe.enable_model_cpu_offload()
57
+
58
+ # Loading Trained Old Book Illustrations LoRA Weights
59
+ pipe.load_lora_weights("AdamLucek/sdxl-base-1.0-oldbookillustrations-lora")
60
+
61
+ # Generate an Image
62
+ prompt = "An Apple"
63
+
64
+ image = pipe(
65
+ prompt = prompt,
66
+ num_inference_steps=50,
67
+ height=1024,
68
+ width=1024,
69
+ ).images[0]
70
+
71
+ # Save the image
72
+ image.save("SDXL_OldBookIllustrations.png")
73
  ```
74
 
75
  #### Limitations and bias