Skip to content

Commit

Permalink
Add metadata when converting .bin to .safetensors
Browse files Browse the repository at this point in the history
  • Loading branch information
turboderp committed Jan 10, 2024
1 parent 7d37b50 commit 699d127
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/convert_safetensors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import torch
import argparse, os, glob, sys
import argparse, os
from safetensors.torch import save_file

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

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

0 comments on commit 699d127

Please sign in to comment.