relflow
relflow builds PyTorch/Lightning models from nested records. Typed fields represent values; branches combine them into local contexts; decoders learn to predict selected fields from the available context.
Install
Python 3.12 or newer:
uv add relflow
Add relflow[text] for Hugging Face text encoders or relflow[serving] for the
HTTP runtime.
Describe One Record
line_items:
- sku: A12
quantity: 2
price: 19.99
- sku: B07
quantity: 1
price: 45.50
returned: false
YAML makes the shape visible. Applications supply Arrow tables or eager Polars DataFrames with this structure.
import relflow as rf
model = rf.Model(
name="order",
d_model=64,
n_layers=2,
n_heads=4,
batch_size=128,
line_items=rf.Branch(
length=32,
sku=rf.Category(size=4096),
quantity=rf.Number,
price=rf.Number,
),
returned=rf.Boolean(mask=True),
)
Parent keywords name each field. mask=True makes returned a supervised
target whose value never enters the encoder. The branch builds line-item
context before its reduced representation reaches the order root.
Train And Predict
train_table, validation_table, and request_table below are
application-supplied Arrow tables. Prediction requests omit returned.
import lightning.pytorch as lit
model.optimizer = rf.adamw(learning_rate=1e-3)
data = rf.ArrowDataModule(
model=model, train=train_table, validate=validation_table
)
trainer = lit.Trainer(max_epochs=30)
trainer.fit(model=model, datamodule=data)
predictions = model.predict(request_table)
For eager Polars DataFrames, use rf.PolarsDataModule with the same split
arguments. predict returns an Arrow table; decoded results live under its
predictions column at addresses such as order/returned.
Documentation
- Getting started
- Model structure
- Data types
- Arrow and Polars
- Preprocessing
- Training and checkpoints
- Prediction output
Docs use static examples and Typst model diagrams. Build them with make render;
run make check-docs to validate the render in a temporary directory. Package
checks use uv run pytest; synthetic learning checks use make proofs.
See CONTRIBUTING.md for development conventions.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file relflow-0.2.2.tar.gz.
File metadata
- Download URL: relflow-0.2.2.tar.gz
- Upload date:
- Size: 172.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f6d20015b7f4569f736b3efd5a457923a77c2cfd63c3c86ff90f7ed12eb940
|
|
| MD5 |
bd8965ea0f56cb1abc4a7e95fb6a78f8
|
|
| BLAKE2b-256 |
7f9755c6688b8ecf110aa08e24ed1e87499aef64e5b0f830ceac576f57bde47f
|
Provenance
The following attestation bundles were made for relflow-0.2.2.tar.gz:
Publisher:
release.yml on relflow/relflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
relflow-0.2.2.tar.gz -
Subject digest:
50f6d20015b7f4569f736b3efd5a457923a77c2cfd63c3c86ff90f7ed12eb940 - Sigstore transparency entry: 2850369742
- Sigstore integration time:
-
Permalink:
relflow/relflow@39573e92a240a7b3ed48bc8a6e280dc70552e213 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/relflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39573e92a240a7b3ed48bc8a6e280dc70552e213 -
Trigger Event:
push
-
Statement type:
File details
Details for the file relflow-0.2.2-py3-none-any.whl.
File metadata
- Download URL: relflow-0.2.2-py3-none-any.whl
- Upload date:
- Size: 196.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
068d8977914a551c4a168fa150e093fefb580067039cd73ba0c4ae02225591a5
|
|
| MD5 |
51fc1bd90b8ad32dc7fcb37ba1127dd8
|
|
| BLAKE2b-256 |
5557154f41da5cc43412e07927ba757195a746a5d52fe4852676160410905363
|
Provenance
The following attestation bundles were made for relflow-0.2.2-py3-none-any.whl:
Publisher:
release.yml on relflow/relflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
relflow-0.2.2-py3-none-any.whl -
Subject digest:
068d8977914a551c4a168fa150e093fefb580067039cd73ba0c4ae02225591a5 - Sigstore transparency entry: 2850369786
- Sigstore integration time:
-
Permalink:
relflow/relflow@39573e92a240a7b3ed48bc8a6e280dc70552e213 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/relflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39573e92a240a7b3ed48bc8a6e280dc70552e213 -
Trigger Event:
push
-
Statement type: