Created
June 22, 2023 15:00
-
-
Save takuma104/dcf4626fe2b0564d02c6edd4e9fcb616 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import sys | |
from safetensors.torch import load_file | |
if __name__ == "__main__": | |
filename = sys.argv[1] | |
state_dict = load_file(filename) | |
for key, value in state_dict.items(): | |
if "lora_down" in key: | |
lora_name = key.split(".")[0] | |
lora_dim = value.size()[0] | |
lora_name_alpha = key.split(".")[0] + '.alpha' | |
if lora_name_alpha in state_dict: | |
alpha = state_dict[lora_name_alpha].item() | |
print(lora_name_alpha, alpha, lora_dim, alpha / lora_dim) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://civitai.com/models/15699?modelVersionId=18531