Using ckpt and safetensors files with Diffusers
The Diffusers community is actively enhancing the functionality. At the time of writing, we can easily load .ckpt or safetensors checkpoint files using the Diffusers package.
The following code can be used to load and use a safetensors or .ckpt checkpoint file.
Load the safetensors model:
import torch from diffusers import StableDiffusionPipeline model_path = r"model/path/path/model_name.safetensors" pipe = StableDiffusionPipeline.from_single_file( Â Â Â Â model_path, Â Â Â Â torch_dtype = torch.float16 )
Load the .ckpt model with the following code:
import torch from diffusers import StableDiffusionPipeline model_path = r"model/path/path/model_name.ckpt" pipe = StableDiffusionPipeline.from_single_file( Â Â Â Â model_path, Â Â Â Â torch_dtype = torch.float16 )
You are not reading the wrong code; we can load both safetensors and .ckpt...