How to convert ckpt to diffusers format
The community is heavily using both the.ckptand the diffusers format. We are working on having better support for interoperability between the formats, but the recommended approach is always to just upload checkpoints in both formats.Let’s dive a bit into the best approach to convert .ckpt into diffusers format.Option 1.)The easiest and most convenient approach is to just use a space to convert the checkpoint.You can just try it here:SD To Diffusers - a Hugging Face Space by diffusersAs soon as the model is a bit more customized this might however not work. In this case the space tends to open an empty PR or just fails. This means that the conversion didn’t work.Option 2.)Option two is the more error-proof option and should always work.Git clone the repo that has a.ckptand where you want to convert the checkpoint from. E.g.:git lfs install
git clone https://huggingface.co/CiaraRowles/TemporalNetOpen a pull request and follow the instructionscd TemporalNet && git fetch origin refs/pr/13:pr/13andgit checkout pr/14Now convert the checkpoint. For this you need to have a local clonediffusers. Then we recommend to always use thehttps://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.pyscript.You need to make sure to configure your input arguments correctly. We recommend to always pass the following parameters:--original_config_file
--checkpoint_path
--dump_pathLet’s explain them a bit more in-detail:--dump_pathis just the path where the diffusers checkpoint will be save--checkpoint_pathis the path to the.ckptfile to be converted. If multiple.ckptfiles are present, we recommend to always use thelargestone--original_config_file- the original config file. This should be a file that ends with ayamlsuffix. In case no file is present you should try to find the corresponding file in the github repo the.ckptmodel originated from. Some examples:stable-diffusion/configs/stable-diffusion at main · CompVis/stable-diffusion · GitHubstablediffusion/configs/stable-diffusion at main · Stability-AI/stablediffusion · GitHubControlNet/models at main · lllyasviel/ControlNet · GitHubWe recommend to then convert the checkpoint directly into the cloned local repo. For our example above we used the following command. We took thecldm_v15.yamlconfig fromControlNet/models at main · lllyasviel/ControlNet · GitHubsince we know that the model is a sd15 model and a controlnet model and because no config was present in the original repopython ../diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path temporalnetv3.ckpt --original_config_file cldm_v15.yaml --dump_path ./ --controlnetNow we recommend that you test the converted checkpoint and then upload your changes to the PR:git push origin pr/13:refs/pr/13Done!The resulting PR is here:CiaraRowles/TemporalNet · Add diffusers weights
2023-07-07T22:28:02Z
The link in Option1 gives a Runtime error## Memory limit exceeded (16Gi)