jbilcke-hf's picture
jbilcke-hf HF Staff
we are going to hack into finetrainers
9fd1204
raw
history blame contribute delete
325 Bytes
from typing import Any, Dict, Optional
import safetensors.torch
def safetensors_torch_save_function(weights: Dict[str, Any], filename: str, metadata: Optional[Dict[str, str]] = None):
if metadata is None:
metadata = {}
metadata["format"] = "pt"
safetensors.torch.save_file(weights, filename, metadata)