]> khamidou — GitHub mirrors - safetensors.git/commitdiff
Fix SIZES for torch tensors (#4)
authorSylvain Gugger <35901082+sgugger@users.noreply.github.com>
Fri, 23 Sep 2022 16:58:15 +0000 (12:58 -0400)
committerGitHub <noreply@github.com>
Fri, 23 Sep 2022 16:58:15 +0000 (12:58 -0400)
bindings/python/py_src/safetensors/torch.py

index fa106db6278d705d9d5bfe47f975aec29b7d72c3..8a44747c79e14a9e5347da5be2e524dc4ad5ddb3 100644 (file)
@@ -25,8 +25,12 @@ def save(tensors: Dict[str, torch.Tensor]) -> bytes:
 SIZE = {
     torch.bfloat16: 2,
     torch.float16: 2,
+    torch.float32: 4,
+    torch.uint8: 1,
+    torch.int8: 1,
+    torch.int16: 2,
     torch.int32: 4,
-    torch.int64: 4,
+    torch.int64: 8,
 }