loongson/pypi/: safetensors-0.4.3 metadata and description
author_email | Nicolas Patry <patry.nicolas@protonmail.com> |
classifiers |
|
description_content_type | text/markdown; charset=UTF-8; variant=GFM |
project_urls |
|
provides_extras | dev |
requires_dist |
|
requires_python | >=3.7 |
Because this project isn't in the mirror_whitelist
,
no releases from root/pypi are included.
File | Tox results | History |
---|---|---|
safetensors-0.4.3-cp310-cp310-linux_loongarch64.whl
|
|
|
safetensors-0.4.3-cp311-cp311-linux_loongarch64.whl
|
|
|
safetensors-0.4.3-cp312-cp312-linux_loongarch64.whl
|
|
|
safetensors-0.4.3-cp38-cp38-linux_loongarch64.whl
|
|
|
safetensors-0.4.3-cp39-cp39-linux_loongarch64.whl
|
|
## 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/
```
Render warnings:
<string>:12: (WARNING/2) Inline literal start-string without end-string.
```
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/
```
Render warnings:
<string>:12: (WARNING/2) Inline literal start-string without end-string.