Skip to content

Commit

Permalink
Update docstrings & type-hints (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarobartt authored Dec 27, 2022
1 parent a104c5e commit ba8de5f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bindings/python/py_src/safetensors/flax.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def save(tensors: Dict[str, jnp.DeviceArray], metadata: Optional[Dict[str, str]]
```python
from safetensors.flax import save
import flax
from jax import numpy as jnp
tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))}
byte_data = save(tensors)
Expand All @@ -39,7 +39,7 @@ def save_file(
tensors: Dict[str, jnp.DeviceArray],
filename: str,
metadata: Optional[Dict[str, str]] = None,
):
) -> None:
"""
Saves a dictionnary of tensors into raw bytes in safetensors format.
Expand All @@ -60,7 +60,7 @@ def save_file(
```python
from safetensors.flax import save_file
import flax
from jax import numpy as jnp
tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))}
save(tensors, "model.safetensors")
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/py_src/safetensors/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def save(tensor_dict: Dict[str, np.ndarray], metadata: Optional[Dict[str, str]]
return result


def save_file(tensor_dict: Dict[str, np.ndarray], filename: str, metadata: Optional[Dict[str, str]] = None):
def save_file(tensor_dict: Dict[str, np.ndarray], filename: str, metadata: Optional[Dict[str, str]] = None) -> None:
"""
Saves a dictionnary of tensors into raw bytes in safetensors format.
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/py_src/safetensors/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def save_file(
tensors: Dict[str, tf.Tensor],
filename: str,
metadata: Optional[Dict[str, str]] = None,
):
) -> None:
"""
Saves a dictionnary of tensors into raw bytes in safetensors format.
Expand Down

0 comments on commit ba8de5f

Please sign in to comment.