TensorShare
🤝 Trade any tensors over the network
TensorShare is a powerful tool enabling ⚡ lightning-fast tensor sharing across networks.
This project leverages the best open-source tools to provide a simple and easy-to-use interface for sharing tensors:
- safetensors for secure tensor serialization and deserialization.
- pydantic for data validation and settings management.
- fastapi for building APIs (and because it's too good to avoid it).
This project is heavily in development and is not ready for production use. Feel free to contribute to the project by opening issues and pull requests.
Usage
Example of tensors serialization with torch:
import torch
from tensorshare import TensorShare
tensors = {
"embeddings": torch.zeros((2, 2)),
"labels": torch.zeros((2, 2)),
}
ts = TensorShare.from_dict(tensors, backend="torch")
print(ts)
# tensors=b'gAAAAAAAAAB7ImVtYmVkZGluZ3MiOnsiZHR5cGUiO...' size=168
You can now freely send the tensors over the network via any means (e.g. HTTP, gRPC, ...).
On the other side, when you receive the tensors, you can deserialize them in any supported backend:
from tensorshare import Backend
np_tensors = ts.to_tensors(backend=Backend.NUMPY)
print(np_tensors)
# {
# 'embeddings': array([[0., 0.], [0., 0.]], dtype=float32),
# 'labels': array([[0., 0.], [0., 0.]], dtype=float32)
# }
For more examples and details, please refer to the Usage section.
Roadmap
- Pydantic schema for sharing tensors ~> TensorShare
- Serialization and deserialization ~> tensorshare.serialization
- TensorProcessor for processing tensors ~> TensorProcessor
- Server for sharing tensors ~> TensorShareServer
- Client for sharing tensors ~> TensorShareClient
- New incredible features! (Check the issues)
Metadata
Release files for tensorshare 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tensorshare-0.1.1.tar.gz | 25.2 kB | Without provenance | Details for tensorshare-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tensorshare-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for tensorshare-0.1.1-py3-none-any.whl |
Total release size: 45.4 kB
Security for tensorshare 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.