File size: 292 Bytes
0936846
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import json
import torch
from safetensors.torch import save_file

parameters = json.loads(open("parameter.json").read())
model_path = parameters["model_path"]

model = torch.load(model_path, weights_only=False)
save_file(model.state_dict(), model_path.rstrip(".pth") + ".safetensors")