Skip to content

Quick question on implementation. #31

Answered by alvarobartt
miguelamendez asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @miguelamendez so the idea behind safetensors is that it's another format for storing tensors in opposition to pickle which is not safe. This doesn't mean that jax.numpy.save, jax.numpy.savez, or any other existing serializing format is not recommended.

The idea behind safejax is to use safetensors to serialize the whole tree, which decomposes the trees in a Python dictionary by joining the keys, so that the original tree is flattened. This is done because safetensors doesn't support the storing of complex structures/trees e.g. FrozenDict in flax. More information on the latter is at huggingface/safetensors#138

So on, the following doesn't work with plain safetensors:

from safetensors.jax

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@miguelamendez
Comment options

Answer selected by miguelamendez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants