Skip to content

Commit 699d127

Browse files
committed
Add metadata when converting .bin to .safetensors
1 parent 7d37b50 commit 699d127

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

util/convert_safetensors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import torch
2-
import argparse, os, glob, sys
2+
import argparse, os
33
from safetensors.torch import save_file
44

55
parser = argparse.ArgumentParser(description="Convert .bin/.pt files to .safetensors")
@@ -12,4 +12,4 @@
1212

1313
out_file = os.path.splitext(file)[0] + ".safetensors"
1414
print(f" -- Saving {out_file}...")
15-
save_file(state_dict, out_file)
15+
save_file(state_dict, out_file, metadata = {'format': 'pt'})

0 commit comments

Comments
 (0)