<h1 align="center">TensorShare</h1>
<div align="center">
<a href="https://pypi.org/project/tensorshare" target="_blank">
<img src="https://img.shields.io/pypi/v/tensorshare.svg" />
</a>
<a href="https://pypi.org/project/tensorshare" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/tensorshare" />
</a>
<a href="https://github.com/chainyo/tensorshare/blob/main/LICENSE" target="_blank">
<img src="https://img.shields.io/pypi/l/tensorshare" />
</a>
<a href="https://github.com/chainyo/tensorshare/actions?workflow=ci-cd" target="_blank">
<img src="https://github.com/chainyo/tensorshare/workflows/ci-cd/badge.svg" />
</a>
<a href="https://codecov.io/gh/chainyo/tensorshare" >
<img src="https://codecov.io/gh/chainyo/tensorshare/branch/main/graph/badge.svg?token=IA2W48WCCN"/>
</a>
<a href="https://github.com/pypa/hatch" target="_blank">
<img src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg" />
</a>
</div>
<p align="center"><em>🤝 Trade any tensors over the network</em></p>
---
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](https://github.com/huggingface/safetensors) for secure tensor serialization and deserialization.
* [pydantic](https://github.com/pydantic/pydantic) for data validation and settings management.
* [fastapi](https://github.com/tiangolo/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:
```python
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:
```python
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](https://chainyo.github.io/tensorshare/usage/introduction).
## Roadmap
- [x] Pydantic schema for sharing tensors ~> [TensorShare](https://chainyo.github.io/tensorshare/usage/tensorshare.md)
- [x] Serialization and deserialization ~> [tensorshare.serialization](https://chainyo.github.io/tensorshare/api/serialization)
- [x] TensorProcessor for processing tensors ~> [TensorProcessor](https://chainyo.github.io/tensorshare/api/processor)
- [x] Server for sharing tensors ~> [TensorShareServer](https://chainyo.github.io/tensorshare/usage/tensorshare_server.md)
- [x] Client for sharing tensors ~> [TensorShareClient](https://chainyo.github.io/tensorshare/usage/tensorshare_client.md)
- [ ] New incredible features! (Check the [issues](https://github.com/chainyo/tensorshare/issues))
Raw data
{
"_id": null,
"home_page": null,
"name": "tensorshare",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.8",
"maintainer_email": null,
"keywords": "artificial intelligence,deep learning,fastapi,jax,machine-learning,network,numpy,paddlepaddle,pydantic,pytorch,safetensors,tensorflow",
"author": null,
"author_email": "Thomas Chaigneau <t.chaigneau.tc@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/59/ae/09bf8b042e2633d3e63a09475b73159b21e7f58466d93fc29a6e7903449c/tensorshare-0.1.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">TensorShare</h1>\n\n<div align=\"center\">\n\t<a href=\"https://pypi.org/project/tensorshare\" target=\"_blank\">\n\t\t<img src=\"https://img.shields.io/pypi/v/tensorshare.svg\" />\n\t</a>\n\t<a href=\"https://pypi.org/project/tensorshare\" target=\"_blank\">\n\t\t<img src=\"https://img.shields.io/pypi/pyversions/tensorshare\" />\n\t</a>\n\t<a href=\"https://github.com/chainyo/tensorshare/blob/main/LICENSE\" target=\"_blank\">\n\t\t<img src=\"https://img.shields.io/pypi/l/tensorshare\" />\n\t</a>\n\t<a href=\"https://github.com/chainyo/tensorshare/actions?workflow=ci-cd\" target=\"_blank\">\n\t\t<img src=\"https://github.com/chainyo/tensorshare/workflows/ci-cd/badge.svg\" />\n\t</a>\n\t<a href=\"https://codecov.io/gh/chainyo/tensorshare\" > \n\t\t<img src=\"https://codecov.io/gh/chainyo/tensorshare/branch/main/graph/badge.svg?token=IA2W48WCCN\"/> \n\t</a>\n\t<a href=\"https://github.com/pypa/hatch\" target=\"_blank\">\n\t\t<img src=\"https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg\" />\n\t</a>\n</div>\n\n<p align=\"center\"><em>\ud83e\udd1d Trade any tensors over the network</em></p>\n\n---\n\nTensorShare is a powerful tool enabling \u26a1 lightning-fast tensor sharing across networks.\n\nThis project leverages the best open-source tools to provide a simple and easy-to-use interface for sharing tensors:\n\n* [safetensors](https://github.com/huggingface/safetensors) for secure tensor serialization and deserialization.\n* [pydantic](https://github.com/pydantic/pydantic) for data validation and settings management.\n* [fastapi](https://github.com/tiangolo/fastapi) for building APIs (and because it's too good to avoid it).\n\n__This project is heavily in development and is not ready for production use.__\n__Feel free to contribute to the project by opening issues and pull requests.__\n\n## Usage\n\nExample of tensors serialization with torch:\n\n```python\nimport torch\nfrom tensorshare import TensorShare\n\ntensors = {\n \"embeddings\": torch.zeros((2, 2)),\n \"labels\": torch.zeros((2, 2)),\n}\nts = TensorShare.from_dict(tensors, backend=\"torch\")\nprint(ts)\n# tensors=b'gAAAAAAAAAB7ImVtYmVkZGluZ3MiOnsiZHR5cGUiO...' size=168\n```\n\nYou can now freely send the tensors over the network via any means (e.g. HTTP, gRPC, ...).\n\nOn the other side, when you receive the tensors, you can deserialize them in any supported backend:\n\n```python\nfrom tensorshare import Backend\n\nnp_tensors = ts.to_tensors(backend=Backend.NUMPY)\nprint(np_tensors)\n# {\n# \t'embeddings': array([[0., 0.], [0., 0.]], dtype=float32),\n# \t'labels': array([[0., 0.], [0., 0.]], dtype=float32)\n# }\n```\n\nFor more examples and details, please refer to the [Usage section](https://chainyo.github.io/tensorshare/usage/introduction).\n\n## Roadmap\n\n- [x] Pydantic schema for sharing tensors ~> [TensorShare](https://chainyo.github.io/tensorshare/usage/tensorshare.md)\n- [x] Serialization and deserialization ~> [tensorshare.serialization](https://chainyo.github.io/tensorshare/api/serialization)\n- [x] TensorProcessor for processing tensors ~> [TensorProcessor](https://chainyo.github.io/tensorshare/api/processor)\n- [x] Server for sharing tensors ~> [TensorShareServer](https://chainyo.github.io/tensorshare/usage/tensorshare_server.md)\n- [x] Client for sharing tensors ~> [TensorShareClient](https://chainyo.github.io/tensorshare/usage/tensorshare_client.md)\n- [ ] New incredible features! (Check the [issues](https://github.com/chainyo/tensorshare/issues))\n",
"bugtrack_url": null,
"license": null,
"summary": "\ud83e\udd1d Trade any tensors over the network",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://chainyo.github.io/tensorshare",
"Issues": "https://github.com/chainyo/tensorshare/issues",
"Source": "https://github.com/chainyo/tensorshare"
},
"split_keywords": [
"artificial intelligence",
"deep learning",
"fastapi",
"jax",
"machine-learning",
"network",
"numpy",
"paddlepaddle",
"pydantic",
"pytorch",
"safetensors",
"tensorflow"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bd9272878af643353442a2cb3368b2310988ce60dd64b0eababaf54064296de8",
"md5": "dc804481c47d707bd0ac7a280fd5987b",
"sha256": "74d14442b3f681068620187503267bf95f301cd281bfc44967d1c1d3c31addb3"
},
"downloads": -1,
"filename": "tensorshare-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc804481c47d707bd0ac7a280fd5987b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.8",
"size": 20197,
"upload_time": "2023-08-20T11:06:40",
"upload_time_iso_8601": "2023-08-20T11:06:40.533159Z",
"url": "https://files.pythonhosted.org/packages/bd/92/72878af643353442a2cb3368b2310988ce60dd64b0eababaf54064296de8/tensorshare-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "59ae09bf8b042e2633d3e63a09475b73159b21e7f58466d93fc29a6e7903449c",
"md5": "9a8d850f5ea458a8c71f9605c3b0183e",
"sha256": "0b48c7ac81dbccfc0fc05a312e17de3abeb1302cbbad73b2afa7913c57d001bb"
},
"downloads": -1,
"filename": "tensorshare-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "9a8d850f5ea458a8c71f9605c3b0183e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.8",
"size": 25158,
"upload_time": "2023-08-20T11:06:38",
"upload_time_iso_8601": "2023-08-20T11:06:38.862485Z",
"url": "https://files.pythonhosted.org/packages/59/ae/09bf8b042e2633d3e63a09475b73159b21e7f58466d93fc29a6e7903449c/tensorshare-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-20 11:06:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chainyo",
"github_project": "tensorshare",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tensorshare"
}