Last active
September 29, 2022 00:37
-
-
Save Filarius/2c30348cca9266d7dc3a171a1d197e17 to your computer and use it in GitHub Desktop.
Script to convert Stable Diffusion weights file into float16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
model = torch.load("model.ckpt") | |
for x in model['state_dict'].keys(): | |
model['state_dict'][x] = model['state_dict'][x].to(torch.float16) | |
torch.save(model,"model_f16.ckpt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment