From: John B Nelson Date: Fri, 20 Jan 2023 10:07:11 +0000 (-0800) Subject: Minor pydoc fixes for torch bindings (#167) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=bcb033f2e0c18c2737b7832140ccebfe5958d0a1;p=safetensors.git Minor pydoc fixes for torch bindings (#167) --- diff --git a/bindings/python/py_src/safetensors/torch.py b/bindings/python/py_src/safetensors/torch.py index 1df67f3..32964c8 100644 --- a/bindings/python/py_src/safetensors/torch.py +++ b/bindings/python/py_src/safetensors/torch.py @@ -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)