Safetensors is a file format and open-source library introduced by Hugging Face in 2022 for storing tensors, the numerical arrays used as AI model weights. It is designed to load data without executing arbitrary code from the file.
Loading objects serialized with pickle can execute arbitrary code. Safetensors focuses on storing weight data, whereas ONNX can also represent a model's computational structure.