]> khamidou — GitHub mirrors - safetensors.git/commitdiff
Minor pydoc fixes for torch bindings (#167)
authorJohn B Nelson <jnelso11@gmu.edu>
Fri, 20 Jan 2023 10:07:11 +0000 (02:07 -0800)
committerGitHub <noreply@github.com>
Fri, 20 Jan 2023 10:07:11 +0000 (11:07 +0100)
bindings/python/py_src/safetensors/torch.py

index 1df67f302b9674810f336c296264656884a2d1d8..32964c8f22549d18c2eec9d66bd0e5ed55a2cf03 100644 (file)
@@ -10,7 +10,7 @@ from safetensors import deserialize, safe_open, serialize, serialize_file
 
 def save(tensors: Dict[str, torch.Tensor], metadata: Optional[Dict[str, str]] = None) -> bytes:
     """
-    Saves a dictionnary of tensors into raw bytes in safetensors format.
+    Saves a dictionary of tensors into raw bytes in safetensors format.
 
     Args:
         tensors (`Dict[str, torch.Tensor]`):
@@ -44,7 +44,7 @@ def save_file(
     metadata: Optional[Dict[str, str]] = None,
 ):
     """
-    Saves a dictionnary of tensors into raw bytes in safetensors format.
+    Saves a dictionary of tensors into raw bytes in safetensors format.
 
     Args:
         tensors (`Dict[str, torch.Tensor]`):
@@ -66,7 +66,7 @@ def save_file(
     import torch
 
     tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))}
-    save(tensors, "model.safetensors")
+    save_file(tensors, "model.safetensors")
     ```
     """
     serialize_file(_flatten(tensors), filename, metadata=metadata)