Metadata-Version: 2.5
Name: tysirai
Version: 0.0.2
Summary: One framework for the datasets and models of a field: load, evaluate, train, compose.
Project-URL: Homepage, https://tysirai.com
Project-URL: Repository, https://github.com/tysirai/tysirai
Project-URL: Issues, https://github.com/tysirai/tysirai/issues
Author: Salah Eddine Bekhouche
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: benchmark,computer vision,deep learning,graph,pytorch
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: fsspec>=2024.2
Requires-Dist: huggingface-hub>=1.0
Requires-Dist: numpy>=1.26
Requires-Dist: packaging>=24.0
Requires-Dist: picklescan>=1.0.4
Requires-Dist: platformdirs>=4.0
Requires-Dist: pydantic>=2.7
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.7
Requires-Dist: safetensors>=0.4
Requires-Dist: torch>=2.4
Requires-Dist: typer>=0.12
Provides-Extra: classical
Provides-Extra: data
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pre-commit>=3.7; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: types-pyyaml; extra == 'dev'
Provides-Extra: face
Provides-Extra: hf
Provides-Extra: jax
Provides-Extra: onnx
Provides-Extra: report
Provides-Extra: tensorflow
Provides-Extra: text
Provides-Extra: train
Provides-Extra: vision
Requires-Dist: pillow>=10.1; extra == 'vision'
Requires-Dist: timm>=1.0; extra == 'vision'
Requires-Dist: torchvision>=0.19; extra == 'vision'
Provides-Extra: vlm
Description-Content-Type: text/markdown

# TysirAI

**One framework from research to deployment.** TysirAI loads the major datasets of a field in a uniform way, runs old and new models (including vision-language models) under one protocol, trains new methods with little code, and reports results that are traceable to their predictions.

> **Status:** early development. v0.0.2 adds hosts, model cards and the first published models: 10 scene text recognition models that load by name. Evaluation, datasets and training come in the next releases.

## Install

```bash
pip install tysirai
tysirai --version
```

From source (for development, or before a release is on PyPI):

```bash
git clone https://github.com/tysirai/tysirai
cd tysirai
pip install .
```

With uv, run `uv sync` instead, and prefix the commands below with `uv run` (for example
`uv run tysirai --version`), or activate `.venv` first.

Python 3.11 or newer and PyTorch 2.4 or newer.

## Load a published model

```bash
pip install "tysirai[vision]"
```

```python
import torch
import tysirai

model = tysirai.load("tysirai/CRNN-STR@v1")  # from huggingface.co/tysirai, checksums checked
images = torch.randint(0, 256, (1, 3, 32, 100), dtype=torch.uint8)  # a batch of images (B, C, H, W)
print(model(images=images)["text:labels"])
```

The published models are listed in the collection
[TysirAI STR models](https://huggingface.co/collections/tysirai/tysirai-str-models-6b109b8f57307b60fc08e4b9).
Each card cites the original paper and code and gives the licenses. `tysirai models check NAME`
runs a model on its fidelity set.

## Quickstart

A model is a graph of nodes declared in JSON or YAML:

```json
{
  "schema": "graph/1",
  "inputs": {"x": "features"},
  "nodes": {
    "proj": {"type": "torch.nn.Linear", "args": {"in_features": 16, "out_features": 8}, "inputs": {"x": "x"}},
    "act":  {"type": "torch.nn.ReLU", "inputs": {"x": "proj:out"}},
    "head": {"type": "cls.LinearHead@1", "args": {"in_features": 8, "num_classes": 3},
             "inputs": {"features": "act:out"}}
  },
  "outputs": {"cls:probs": "head:probs", "cls:label": "head:label"}
}
```

```bash
tysirai validate classifier.json      # no weights loaded; errors name the node and the field
tysirai describe classifier.json      # public inputs, outputs and parameters
tysirai render classifier.json -f mermaid
```

```python
import torch
from tysirai.core.model import GraphModel

model = GraphModel("classifier.json")
out = model(x=torch.randn(4, 16))
model.save_pretrained("my-classifier")  # config.json, model.safetensors, tysirai.json
same = GraphModel.from_pretrained("my-classifier")
```

More in [docs/quickstart.md](docs/quickstart.md) and [docs/graph-format.md](docs/graph-format.md).

## What it will do

- **One graph for every model.** A model is a typed graph of modules, declared in JSON. The same graph is trained, evaluated, attached inside larger stacks, and later served.
- **End-to-end stacks.** Published components (a detector, an aligner, an age model, a VLM) are attached into one system, with per-component error attribution.
- **Protocols as configuration.** Splits, preprocessing, metrics and post-processing are versioned files saved with every result.
- **Catalogs, not hosted data.** Dataset and model cards describe where data and weights come from; a local scanner checks your own copy.
- **Leaderboards built from predictions.** Every row is a model of our organization, run by us, with its predictions and uncertainty; snapshots are citable.
- **Old and new methods together.** Classical methods (LBP, SVM), deep models in PyTorch, JAX or ONNX, and VLMs under the same protocol.

## First domains

1. Scene text recognition (11 specialized models, 5 VLMs, 18 datasets).
2. Age estimation.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). Every change is a pull request that closes one issue.

## Links

- Hugging Face: [huggingface.co/tysirai](https://huggingface.co/tysirai)
- Website: [tysirai.com](https://tysirai.com)

## License

TysirAI is released under the [Apache License 2.0](LICENSE). Models and datasets referenced by the framework keep their own licenses, which are recorded in their cards.
