Metadata-Version: 2.4
Name: safetensors
Version: 0.8.0rc0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Dist: safetensors[torch] ; extra == 'all'
Requires-Dist: safetensors[numpy] ; extra == 'all'
Requires-Dist: safetensors[pinned-tf] ; extra == 'all'
Requires-Dist: safetensors[jax] ; extra == 'all'
Requires-Dist: safetensors[paddlepaddle] ; extra == 'all'
Requires-Dist: safetensors[convert] ; extra == 'all'
Requires-Dist: safetensors[quality] ; extra == 'all'
Requires-Dist: safetensors[testing] ; extra == 'all'
Requires-Dist: safetensors[torch] ; extra == 'convert'
Requires-Dist: huggingface-hub>=1.4 ; extra == 'convert'
Requires-Dist: safetensors[all] ; extra == 'dev'
Requires-Dist: safetensors[numpy] ; extra == 'jax'
Requires-Dist: flax>=0.6.3 ; extra == 'jax'
Requires-Dist: jax>=0.3.25 ; extra == 'jax'
Requires-Dist: jaxlib>=0.3.25 ; extra == 'jax'
Requires-Dist: mlx>=0.0.9 ; extra == 'mlx'
Requires-Dist: numpy>=1.24.6 ; extra == 'numpy'
Requires-Dist: safetensors[numpy] ; extra == 'paddlepaddle'
Requires-Dist: paddlepaddle>=2.4.1 ; extra == 'paddlepaddle'
Requires-Dist: safetensors[numpy] ; extra == 'pinned-tf'
Requires-Dist: tensorflow==2.18.0 ; extra == 'pinned-tf'
Requires-Dist: ruff ; extra == 'quality'
Requires-Dist: safetensors[numpy] ; extra == 'tensorflow'
Requires-Dist: tensorflow>=2.11.0 ; extra == 'tensorflow'
Requires-Dist: safetensors[numpy] ; extra == 'testing'
Requires-Dist: h5py>=3.7.0 ; extra == 'testing'
Requires-Dist: setuptools-rust>=1.12.0 ; extra == 'testing'
Requires-Dist: pytest>=9.0 ; extra == 'testing'
Requires-Dist: pytest-benchmark>=5.2 ; extra == 'testing'
Requires-Dist: hypothesis>=6.70.2 ; extra == 'testing'
Requires-Dist: fsspec>=2024.6.0 ; extra == 'testing'
Requires-Dist: s3fs>=2024.6.0 ; extra == 'testing'
Requires-Dist: safetensors[numpy] ; extra == 'testingfree'
Requires-Dist: setuptools-rust>=1.12.0 ; extra == 'testingfree'
Requires-Dist: pytest>=9.0 ; extra == 'testingfree'
Requires-Dist: pytest-benchmark>=5.2 ; extra == 'testingfree'
Requires-Dist: hypothesis>=6.70.2 ; extra == 'testingfree'
Requires-Dist: safetensors[numpy] ; extra == 'torch'
Requires-Dist: torch>=2.4 ; extra == 'torch'
Provides-Extra: all
Provides-Extra: convert
Provides-Extra: dev
Provides-Extra: jax
Provides-Extra: mlx
Provides-Extra: numpy
Provides-Extra: paddlepaddle
Provides-Extra: pinned-tf
Provides-Extra: quality
Provides-Extra: tensorflow
Provides-Extra: testing
Provides-Extra: testingfree
Provides-Extra: torch
License-File: LICENSE
Author-email: Nicolas Patry <patry.nicolas@protonmail.com>, Luc Georges <luc@huggingface.co>, Daniël De Kok <daniel.dekok@huggingface.co>
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/huggingface/safetensors
Project-URL: Source, https://github.com/huggingface/safetensors

## Installation

```
pip install safetensors
```


## Usage

### Numpy

```python
from safetensors.numpy import save_file, load_file
import numpy as np

tensors = {
   "a": np.zeros((2, 2)),
   "b": np.zeros((2, 3), dtype=np.uint8)
}

save_file(tensors, "./model.safetensors")


# Now loading
loaded = load_file("./model.safetensors")
```

### Torch

```python
from safetensors.torch import save_file, load_file
import torch

tensors = {
   "a": torch.zeros((2, 2)),
   "b": torch.zeros((2, 3), dtype=torch.uint8)
}

save_file(tensors, "./model.safetensors")


# Now loading
loaded = load_file("./model.safetensors")
```

### Developing

```
# inside ./safetensors/bindings/python
pip install .[dev]
```
Should be enough to install this library locally.

### Testing

```
# inside ./safetensors/bindings/python
pip install .[dev]
pytest -sv tests/
```

