Skip to content

Instantly share code, notes, and snippets.

@Filarius
Last active September 29, 2022 00:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Filarius/2c30348cca9266d7dc3a171a1d197e17 to your computer and use it in GitHub Desktop.
Save Filarius/2c30348cca9266d7dc3a171a1d197e17 to your computer and use it in GitHub Desktop.
Script to convert Stable Diffusion weights file into float16
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