Skip to content

Installation

  • Python 3.8, 3.9, 3.10, or 3.11 is required.
Pip
pip install tensorshare
Poetry
poetry add tensorshare
Pipx
pipx install tensorshare

TensorShare modules

TensorShare is a modular library. It means that you can install only the modules you need to reduce the installation time and the number of dependencies.

Note

We do care about your CI/CD pipelines. That's why we provide a way to install only the necessary modules. Only safetensors and pydantic are mandatory.

Client module

The client module is used to create a TensorShareClient for sending tensors to a FastAPI server.

pip install tensorshare[client]

Note

It installs aiohttp on top of the main dependencies.

Server module

The server module is used to integrate TensorShare with a FastAPI server.

pip install tensorshare[server]

Note

It installs fastapi on top of the main dependencies.

Check the TensorShareServer and the FastAPI integration sections for more details.

Backend Installation

TensorShare is a framework-agnostic library. It means that the default installation does not include any framework and assumes that you will handle the backend (or backends) yourself.

Note

All the backends are optional and can be installed separately, but they all require numpy. That's why they all come with numpy as a dependency.

However, we provide a set of backends that can be installed alongside TensorShare.

  • Jax | flax>=0.6.3, jax>=0.3.25, jaxlib>=0.3.25
pip install tensorshare[jax]
pip install tensorshare[numpy]
pip install tensorshare[paddlepaddle]
pip install tensorshare[tensorflow]
pip install tensorshare[torch]

You can also install all the backends at once:

pip install tensorshare[all]

Contributing

We use Hatch as the package manager for development.

For installing the default environment:

hatch env create 

The quality and tests environments are also available. They will be auto-activated when running the corresponding commands.

# Linting and formatting using black and ruff
hatch run quality:format

# Typechecking using mypy
hatch run quality:typecheck

# Testing using pytest
hatch run tests:run

But you can also create them manually:

hatch env create quality
hatch env create tests

Last update: 2023-08-20
Created: 2023-08-20