This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # created by https://gist.github.com/silveroxides | |
| import torch | |
| from safetensors.torch import save_file | |
| import argparse | |
| import os | |
| def convert_pt_to_safetensors(model_path, safe_path): | |
| model = torch.load(model_path, map_location="cpu", weights_only=False) | |
| metadata = {"format":"pt"} | |
| save_file(model, safe_path, metadata) |