@@ -39,7 +39,7 @@ pip install --upgrade torch diffusers
3939 import torch
4040 from diffusers import DiffusionPipeline
4141
42- pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16)
42+ pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16, use_safetensors = True )
4343 pipe = pipe.to(" cuda" )
4444
4545 prompt = " a photo of an astronaut riding a horse on mars"
@@ -53,7 +53,7 @@ pip install --upgrade torch diffusers
5353 from diffusers import DiffusionPipeline
5454 + from diffusers.models.attention_processor import AttnProcessor2_0
5555
56- pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16).to(" cuda" )
56+ pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16, use_safetensors = True ).to(" cuda" )
5757 + pipe.unet.set_attn_processor(AttnProcessor2_0())
5858
5959 prompt = " a photo of an astronaut riding a horse on mars"
@@ -69,7 +69,7 @@ pip install --upgrade torch diffusers
6969 from diffusers import DiffusionPipeline
7070 from diffusers.models.attention_processor import AttnProcessor
7171
72- pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16).to(" cuda" )
72+ pipe = DiffusionPipeline.from_pretrained(" runwayml/stable-diffusion-v1-5" , torch_dtype = torch.float16, use_safetensors = True ).to(" cuda" )
7373 pipe.unet.set_default_attn_processor()
7474
7575 prompt = " a photo of an astronaut riding a horse on mars"
@@ -107,7 +107,7 @@ path = "runwayml/stable-diffusion-v1-5"
107107
108108run_compile = True # Set True / False
109109
110- pipe = DiffusionPipeline.from_pretrained(path, torch_dtype = torch.float16)
110+ pipe = DiffusionPipeline.from_pretrained(path, torch_dtype = torch.float16, use_safetensors = True )
111111pipe = pipe.to(" cuda" )
112112pipe.unet.to(memory_format = torch.channels_last)
113113
@@ -140,7 +140,7 @@ path = "runwayml/stable-diffusion-v1-5"
140140
141141run_compile = True # Set True / False
142142
143- pipe = StableDiffusionImg2ImgPipeline.from_pretrained(path, torch_dtype = torch.float16)
143+ pipe = StableDiffusionImg2ImgPipeline.from_pretrained(path, torch_dtype = torch.float16, use_safetensors = True )
144144pipe = pipe.to(" cuda" )
145145pipe.unet.to(memory_format = torch.channels_last)
146146
@@ -180,7 +180,7 @@ path = "runwayml/stable-diffusion-inpainting"
180180
181181run_compile = True # Set True / False
182182
183- pipe = StableDiffusionInpaintPipeline.from_pretrained(path, torch_dtype = torch.float16)
183+ pipe = StableDiffusionInpaintPipeline.from_pretrained(path, torch_dtype = torch.float16, use_safetensors = True )
184184pipe = pipe.to(" cuda" )
185185pipe.unet.to(memory_format = torch.channels_last)
186186
@@ -212,9 +212,9 @@ init_image = init_image.resize((512, 512))
212212path = " runwayml/stable-diffusion-v1-5"
213213
214214run_compile = True # Set True / False
215- controlnet = ControlNetModel.from_pretrained(" lllyasviel/sd-controlnet-canny" , torch_dtype = torch.float16)
215+ controlnet = ControlNetModel.from_pretrained(" lllyasviel/sd-controlnet-canny" , torch_dtype = torch.float16, use_safetensors = True )
216216pipe = StableDiffusionControlNetPipeline.from_pretrained(
217- path, controlnet = controlnet, torch_dtype = torch.float16
217+ path, controlnet = controlnet, torch_dtype = torch.float16, use_safetensors = True
218218)
219219
220220pipe = pipe.to(" cuda" )
@@ -240,11 +240,11 @@ import torch
240240
241241run_compile = True # Set True / False
242242
243- pipe = DiffusionPipeline.from_pretrained(" DeepFloyd/IF-I-M-v1.0" , variant = " fp16" , text_encoder = None , torch_dtype = torch.float16)
243+ pipe = DiffusionPipeline.from_pretrained(" DeepFloyd/IF-I-M-v1.0" , variant = " fp16" , text_encoder = None , torch_dtype = torch.float16, use_safetensors = True )
244244pipe.to(" cuda" )
245- pipe_2 = DiffusionPipeline.from_pretrained(" DeepFloyd/IF-II-M-v1.0" , variant = " fp16" , text_encoder = None , torch_dtype = torch.float16)
245+ pipe_2 = DiffusionPipeline.from_pretrained(" DeepFloyd/IF-II-M-v1.0" , variant = " fp16" , text_encoder = None , torch_dtype = torch.float16, use_safetensors = True )
246246pipe_2.to(" cuda" )
247- pipe_3 = DiffusionPipeline.from_pretrained(" stabilityai/stable-diffusion-x4-upscaler" , torch_dtype = torch.float16)
247+ pipe_3 = DiffusionPipeline.from_pretrained(" stabilityai/stable-diffusion-x4-upscaler" , torch_dtype = torch.float16, use_safetensors = True )
248248pipe_3.to(" cuda" )
249249
250250
0 commit comments