Safetensors documentation

Convert weights to safetensors

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.3.2).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Convert weights to safetensors

PyTorch model weights are commonly saved and stored as .bin files with Python’s pickle utility. To save and store your model weights in the more secure safetensor format, we recommend converting your weights to .safetensors.

The easiest way to convert your model weights is to use the Convert Space, given your model weights are already stored on the Hub. The Convert Space downloads the pickled weights, converts them, and opens a Pull Request to upload the newly converted .safetensors file to your repository.

For larger models, the Space may be a bit slower because its resources are tied up in converting other models. You can also try running the convert.py script (this is what the Space is running) locally to convert your weights.

Feel free to ping @Narsil for any issues with the Space.

< > Update on GitHub