logo-generator / convert.py
jonathanrstern's picture
safetensors
194051d
raw
history blame
581 Bytes
import torch
import safetensors
def load_safetensors(file_path: str):
return safetensors.load(file_path)
def save_as_pytorch_bin(tensor_or_state_dict, file_path: str):
torch.save(tensor_or_state_dict, file_path)
if __name__ == "__main__":
safetensors_file_path = "path/to/your/file.safetensors"
pytorch_bin_file_path = "path/to/save/pytorch_lora_weights.bin"
loaded_data = load_safetensors(safetensors_file_path)
save_as_pytorch_bin(loaded_data, pytorch_bin_file_path)
load_safetensors('./LogoRedmond-LogoLoraForSDXL/LogoRedmond_LogoRedAF.safetensors')