Skip to main content

🤝 Trade any tensors over the network

Project description

TensorShare

🤝 Trade any tensors over the network


TensorShare is a powerful tool enabling ⚡ lightning-fast tensor sharing across networks.

This project leverage 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 mean (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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tensorshare-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

tensorshare-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file tensorshare-0.1.0.tar.gz.

File metadata

  • Download URL: tensorshare-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for tensorshare-0.1.0.tar.gz
Algorithm Hash digest
SHA256 260fa1c747e440e5ea71e1ddcc461019cc2320a1721d647c5657398ad99320d6
MD5 671cfdcede83a7aa27ba71c8cadbd079
BLAKE2b-256 af59a7343604d5365302246facfa28c6b8448c5bd81b34683ae5d3f22a85dc40

See more details on using hashes here.

File details

Details for the file tensorshare-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tensorshare-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a76840dfaaf9f7699acf1ecc0f302744eb0ded73e941ec791b70f960955071ad
MD5 9c365f0f8f9a0d81c3208a6f48c15ac3
BLAKE2b-256 12be729a6c2630d7f968630821e2d9009fd11236ad5cdf8917e21fcbedd3a071

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page