import torch from safetensors.torch import save_file weights = { 'weight': torch.tensor([-1.0, -1.0, -1.0, -1.0]), 'bias': torch.tensor([3.0]), } save_file(weights, 'model.safetensors') print('Created model.safetensors') print(f' weight: {weights["weight"].tolist()}') print(f' bias: {weights["bias"].item()}') print(f' magnitude: {sum(abs(w) for w in weights["weight"].tolist()) + abs(weights["bias"].item()):.0f}')