Fix cpu offloading
#5
by
tolgacangoz
- opened
README.md
CHANGED
@@ -33,7 +33,7 @@ pip install accelerate transformers safetensors diffusers
|
|
33 |
|
34 |
And then setup the zoe-depth model
|
35 |
|
36 |
-
```
|
37 |
import torch
|
38 |
import matplotlib
|
39 |
import matplotlib.cm
|
@@ -106,8 +106,8 @@ controlnet = ControlNetModel.from_pretrained(
|
|
106 |
"diffusers/controlnet-zoe-depth-sdxl-1.0",
|
107 |
use_safetensors=True,
|
108 |
torch_dtype=torch.float16,
|
109 |
-
)
|
110 |
-
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
111 |
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
112 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
113 |
controlnet=controlnet,
|
@@ -115,7 +115,7 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
115 |
variant="fp16",
|
116 |
use_safetensors=True,
|
117 |
torch_dtype=torch.float16,
|
118 |
-
)
|
119 |
pipe.enable_model_cpu_offload()
|
120 |
|
121 |
|
|
|
33 |
|
34 |
And then setup the zoe-depth model
|
35 |
|
36 |
+
```python
|
37 |
import torch
|
38 |
import matplotlib
|
39 |
import matplotlib.cm
|
|
|
106 |
"diffusers/controlnet-zoe-depth-sdxl-1.0",
|
107 |
use_safetensors=True,
|
108 |
torch_dtype=torch.float16,
|
109 |
+
)
|
110 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
111 |
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
112 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
113 |
controlnet=controlnet,
|
|
|
115 |
variant="fp16",
|
116 |
use_safetensors=True,
|
117 |
torch_dtype=torch.float16,
|
118 |
+
)
|
119 |
pipe.enable_model_cpu_offload()
|
120 |
|
121 |
|