From a77e317d594ef11f6d22786d1369282b216b490b Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 20 Oct 2022 01:26:56 +0200 Subject: [PATCH] Explaining the `__metadata__` in the spec. (#23) --- README.md | 1 + safetensors/README.md | 1 + safetensors/src/lib.rs | 1 + 3 files changed, 3 insertions(+) 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. //! //! -- 2.43.0