From: Nicolas Patry Date: Wed, 19 Oct 2022 23:26:56 +0000 (+0200) Subject: Explaining the `__metadata__` in the spec. (#23) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a77e317d594ef11f6d22786d1369282b216b490b;p=safetensors.git Explaining the `__metadata__` in the spec. (#23) --- diff --git a/README.md b/README.md index 0fd7cbf..abbc683 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ safely (as opposed to pickle) and that is still fast (zero-copy). 8 bytes: `N`, a u64 int, containing the size of the header N bytes: a JSON utf-8 string representing the header. The header is a dict like {"TENSOR_NAME": {"dtype": "float16", "shape": [1, 16, 256], "offsets": (X, Y)}}, where X and Y are the offsets in the byte buffer of the tensor data + A special key `__metadata__` is allowed to contain free form text map. Rest of the file: byte-buffer. diff --git a/safetensors/README.md b/safetensors/README.md index 0fd7cbf..abbc683 100644 --- a/safetensors/README.md +++ b/safetensors/README.md @@ -10,6 +10,7 @@ safely (as opposed to pickle) and that is still fast (zero-copy). 8 bytes: `N`, a u64 int, containing the size of the header N bytes: a JSON utf-8 string representing the header. The header is a dict like {"TENSOR_NAME": {"dtype": "float16", "shape": [1, 16, 256], "offsets": (X, Y)}}, where X and Y are the offsets in the byte buffer of the tensor data + A special key `__metadata__` is allowed to contain free form text map. Rest of the file: byte-buffer. diff --git a/safetensors/src/lib.rs b/safetensors/src/lib.rs index ae08b3d..74aef0b 100644 --- a/safetensors/src/lib.rs +++ b/safetensors/src/lib.rs @@ -9,6 +9,7 @@ //!8 bytes: `N`, a u64 int, containing the size of the header //!N bytes: a JSON utf-8 string representing the header. //! The header is a dict like {"TENSOR_NAME": {"dtype": "float16", "shape": [1, 16, 256], "offsets": (X, Y)}}, where X and Y are the offsets in the byte buffer of the tensor data +//! A special key `__metadata__` is allowed to contain free form text map. //!Rest of the file: byte-buffer. //! //!