relational-transformer 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- relational_transformer-1.8.0/LICENSE +21 -0
- relational_transformer-1.8.0/PKG-INFO +153 -0
- relational_transformer-1.8.0/README.md +122 -0
- relational_transformer-1.8.0/pyproject.toml +133 -0
- relational_transformer-1.8.0/rustler/.gitignore +1 -0
- relational_transformer-1.8.0/rustler/Cargo.lock +2845 -0
- relational_transformer-1.8.0/rustler/Cargo.toml +43 -0
- relational_transformer-1.8.0/rustler/README.md +12 -0
- relational_transformer-1.8.0/rustler/src/common.rs +67 -0
- relational_transformer-1.8.0/rustler/src/fly.rs +2377 -0
- relational_transformer-1.8.0/rustler/src/lib.rs +37 -0
- relational_transformer-1.8.0/rustler/src/main.rs +29 -0
- relational_transformer-1.8.0/rustler/src/pre.rs +1097 -0
- relational_transformer-1.8.0/src/rt/__init__.py +22 -0
- relational_transformer-1.8.0/src/rt/_env.py +82 -0
- relational_transformer-1.8.0/src/rt/data/__init__.py +40 -0
- relational_transformer-1.8.0/src/rt/data/datasets.py +460 -0
- relational_transformer-1.8.0/src/rt/data/mlock.py +174 -0
- relational_transformer-1.8.0/src/rt/data/resolve.py +145 -0
- relational_transformer-1.8.0/src/rt/data/tasks.py +146 -0
- relational_transformer-1.8.0/src/rt/eval/__init__.py +21 -0
- relational_transformer-1.8.0/src/rt/eval/_eval.py +907 -0
- relational_transformer-1.8.0/src/rt/eval/evaluator.py +405 -0
- relational_transformer-1.8.0/src/rt/eval/legacy.py +117 -0
- relational_transformer-1.8.0/src/rt/eval/metrics.py +16 -0
- relational_transformer-1.8.0/src/rt/eval/relbench.py +162 -0
- relational_transformer-1.8.0/src/rt/model/__init__.py +22 -0
- relational_transformer-1.8.0/src/rt/model/checkpoints.py +81 -0
- relational_transformer-1.8.0/src/rt/model/legacy/__init__.py +16 -0
- relational_transformer-1.8.0/src/rt/model/legacy/_common.py +62 -0
- relational_transformer-1.8.0/src/rt/model/legacy/plurel.py +264 -0
- relational_transformer-1.8.0/src/rt/model/legacy/v1.py +251 -0
- relational_transformer-1.8.0/src/rt/model/net.py +645 -0
- relational_transformer-1.8.0/src/rt/preprocess/__init__.py +37 -0
- relational_transformer-1.8.0/src/rt/preprocess/_preprocess.py +327 -0
- relational_transformer-1.8.0/src/rt/preprocess/embed.py +212 -0
- relational_transformer-1.8.0/src/rt/preprocess/legacy/__init__.py +12 -0
- relational_transformer-1.8.0/src/rt/preprocess/legacy/main.py +201 -0
- relational_transformer-1.8.0/src/rt/progress.py +51 -0
- relational_transformer-1.8.0/src/rt/train/__init__.py +9 -0
- relational_transformer-1.8.0/src/rt/train/_train.py +1414 -0
- relational_transformer-1.8.0/src/rt/train/muon.py +231 -0
- relational_transformer-1.8.0/src/rt/train/swa.py +87 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Relational Transformer Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: relational-transformer
|
|
3
|
+
Version: 1.8.0
|
|
4
|
+
Requires-Dist: beartype
|
|
5
|
+
Requires-Dist: einops
|
|
6
|
+
Requires-Dist: huggingface-hub
|
|
7
|
+
Requires-Dist: ml-dtypes
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: orjson
|
|
10
|
+
Requires-Dist: pandas
|
|
11
|
+
Requires-Dist: polars
|
|
12
|
+
Requires-Dist: pyarrow
|
|
13
|
+
Requires-Dist: pyyaml
|
|
14
|
+
Requires-Dist: safetensors
|
|
15
|
+
Requires-Dist: scikit-learn
|
|
16
|
+
Requires-Dist: sentence-transformers
|
|
17
|
+
Requires-Dist: torch
|
|
18
|
+
Requires-Dist: wandb
|
|
19
|
+
Requires-Dist: matplotlib ; extra == 'dev'
|
|
20
|
+
Requires-Dist: pre-commit ; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest ; extra == 'dev'
|
|
22
|
+
Requires-Dist: tqdm ; extra == 'dev'
|
|
23
|
+
Requires-Dist: wandb-workspaces ; extra == 'dev'
|
|
24
|
+
Requires-Dist: xgboost ; extra == 'dev'
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Summary: Relational Transformer (RT): a foundation model for relational data, bundling a native Rust data-processing engine (rt.rustler).
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
30
|
+
|
|
31
|
+
# Relational Transformer (RT)
|
|
32
|
+
|
|
33
|
+
The official implementation of the **Relational Transformer (RT)**, an
|
|
34
|
+
architecture for **Relational Foundation Models (RFMs)** that predict directly
|
|
35
|
+
over relational databases (tables linked by foreign keys) and generalize
|
|
36
|
+
zero-shot to new databases, tasks, and schemas.
|
|
37
|
+
|
|
38
|
+
| Paper | Venue | Implementation |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| [Relational Transformer: Toward Zero-Shot Foundation Models for Relational Data](https://arxiv.org/abs/2510.06377) | ICLR 2026 | [`rt-v1`](https://github.com/stanford-star/relational-transformer/tree/rt-v1) |
|
|
41
|
+
| [PluRel: Synthetic Data unlocks Scaling Laws for Relational Foundation Models](https://arxiv.org/abs/2602.04029) | ICML 2026 | [`stanford-star/plurel`](https://github.com/stanford-star/plurel) |
|
|
42
|
+
| RT-J: Large-Scale Pretraining of Relational Transformers for Context-Efficient Predictions | In progress | [`main`](https://github.com/stanford-star/relational-transformer) |
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
Install the `rt` package (the model plus the native Rust data engine) from
|
|
47
|
+
GitHub. It builds the extension from source, so you need a
|
|
48
|
+
[Rust toolchain](https://rustup.rs) and Python 3.12+:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install "git+https://github.com/stanford-star/relational-transformer.git"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quickstart
|
|
55
|
+
|
|
56
|
+
The quickest way to try a released checkpoint is on a RelBench
|
|
57
|
+
database already preprocessed into RT's tensor format on the Hub. The example below predicts whether an F1 driver fails to finish a race (`driver-dnf`) with a released RT-J checkpoint:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import os
|
|
61
|
+
|
|
62
|
+
# flex_attention's compiled kernel is CUDA-only; run it eager on CPU/MPS
|
|
63
|
+
os.environ.setdefault("TORCHDYNAMO_DISABLE", "1")
|
|
64
|
+
|
|
65
|
+
import torch
|
|
66
|
+
from huggingface_hub import snapshot_download
|
|
67
|
+
|
|
68
|
+
from rt import RelationalTransformer
|
|
69
|
+
from rt.eval import build_evaluator
|
|
70
|
+
from rt.data import get_tasks
|
|
71
|
+
|
|
72
|
+
device = (
|
|
73
|
+
"cuda" if torch.cuda.is_available()
|
|
74
|
+
else "mps" if torch.backends.mps.is_available()
|
|
75
|
+
else "cpu"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# 1. download one RelBench database, already preprocessed into RT's tensor format
|
|
79
|
+
pre_dir = snapshot_download(
|
|
80
|
+
"stanford-star/relbench-preprocessed",
|
|
81
|
+
repo_type="dataset",
|
|
82
|
+
allow_patterns="rel-f1/*",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# 2. load a pretrained checkpoint (RT-J here)
|
|
86
|
+
model = RelationalTransformer.from_pretrained(
|
|
87
|
+
"stanford-star/rt-j/classification", device=device
|
|
88
|
+
).to(torch.bfloat16)
|
|
89
|
+
cfg = model.config
|
|
90
|
+
|
|
91
|
+
# 3. build an evaluator for one task and predict zero-shot for 5 test rows.
|
|
92
|
+
# the evaluator samples each row's context from the preprocessed DB;
|
|
93
|
+
tasks = get_tasks(pre_dir, [("rel-f1", "driver-dnf")], ("test",),
|
|
94
|
+
embedder=cfg["embedder"])
|
|
95
|
+
ev = build_evaluator(
|
|
96
|
+
tasks, pre_dir,
|
|
97
|
+
embedder=cfg["embedder"], d_text=cfg["d_text"], device=device,
|
|
98
|
+
ctx_size=128, local_ctx_size=64, bfs_width=32, prefer_latest=True,
|
|
99
|
+
num_walks=10_000, walk_length=20, tokens_per_gpu=2**18,
|
|
100
|
+
items_per_task=5, num_workers=0, prefetch_factor=2,
|
|
101
|
+
shuffle_seed=0, context_seed=0, mmap_populate=True, vector_db_path=None,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# evaluate_raw yields one (task, ctx, labels, preds, n) per task
|
|
105
|
+
results = ev.evaluate_raw([(model, "")], [128])
|
|
106
|
+
_task, _ctx, _labels, out, _n = next(iter(results))
|
|
107
|
+
preds = torch.sigmoid(torch.tensor(out[""], dtype=torch.float32))
|
|
108
|
+
print("driver-dnf probability:", [round(p, 3) for p in preds.tolist()])
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> [!NOTE]
|
|
112
|
+
> `items_per_task=5` and `ctx_size=128` keep this demo quick (most of the runtime
|
|
113
|
+
> is one-time warmup). On a GPU, raise `ctx_size` toward RT-J's training context of
|
|
114
|
+
> 8192 (with `local_ctx_size <= ctx_size`) for full accuracy over the whole test
|
|
115
|
+
> split.
|
|
116
|
+
|
|
117
|
+
## Bring your own database
|
|
118
|
+
|
|
119
|
+
Point RT at your **own** database, define a
|
|
120
|
+
prediction task, and infer with a released checkpoint:
|
|
121
|
+
|
|
122
|
+
- **Colab, no setup**: the [fully worked notebook](byod/colab.ipynb)
|
|
123
|
+
([open in Colab](https://colab.research.google.com/github/stanford-star/relational-transformer/blob/main/byod/colab.ipynb))
|
|
124
|
+
runs the whole flow end-to-end on your database (or the bundled demo).
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
We use [pixi](https://pixi.sh) to manage one self-contained
|
|
129
|
+
environment (Python, PyTorch + CUDA, Rust, and all dependencies), built on first
|
|
130
|
+
use. There is nothing to build past `pixi install`: the native Rust extension is
|
|
131
|
+
compiled as part of the project's own editable install.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
git clone https://github.com/stanford-star/relational-transformer.git
|
|
135
|
+
cd relational-transformer
|
|
136
|
+
pixi run pytest # the test suite
|
|
137
|
+
pixi run python examples/train.py # or eval.py, preprocess.py, ...
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Documentation
|
|
141
|
+
|
|
142
|
+
| Guide | Description |
|
|
143
|
+
|---|---|
|
|
144
|
+
| [Downloads](docs/downloads.md) | Bulk-download raw data, preprocessed data, and checkpoints from HuggingFace |
|
|
145
|
+
| [Preprocess](docs/preprocess.md) | Convert RelBench-format databases into RT's on-disk format |
|
|
146
|
+
| [Inference](docs/inference.md) | Run a trained checkpoint; evaluate, engineer, tune, and ensemble contexts |
|
|
147
|
+
| [Pretrain](docs/train.md) | Train RT from scratch, single-GPU to multi-node |
|
|
148
|
+
| [Experiments](expts/README.md) | How experiments in `expts/` are laid out and submitted to slurm |
|
|
149
|
+
|
|
150
|
+
There is no CLI: RT is a library, and a run is a script that calls it. Copy
|
|
151
|
+
something from [`examples/`](examples/) and edit it — every entry point takes
|
|
152
|
+
its arguments explicitly, so nothing is hidden in a default you did not choose.
|
|
153
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Relational Transformer (RT)
|
|
2
|
+
|
|
3
|
+
The official implementation of the **Relational Transformer (RT)**, an
|
|
4
|
+
architecture for **Relational Foundation Models (RFMs)** that predict directly
|
|
5
|
+
over relational databases (tables linked by foreign keys) and generalize
|
|
6
|
+
zero-shot to new databases, tasks, and schemas.
|
|
7
|
+
|
|
8
|
+
| Paper | Venue | Implementation |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| [Relational Transformer: Toward Zero-Shot Foundation Models for Relational Data](https://arxiv.org/abs/2510.06377) | ICLR 2026 | [`rt-v1`](https://github.com/stanford-star/relational-transformer/tree/rt-v1) |
|
|
11
|
+
| [PluRel: Synthetic Data unlocks Scaling Laws for Relational Foundation Models](https://arxiv.org/abs/2602.04029) | ICML 2026 | [`stanford-star/plurel`](https://github.com/stanford-star/plurel) |
|
|
12
|
+
| RT-J: Large-Scale Pretraining of Relational Transformers for Context-Efficient Predictions | In progress | [`main`](https://github.com/stanford-star/relational-transformer) |
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Install the `rt` package (the model plus the native Rust data engine) from
|
|
17
|
+
GitHub. It builds the extension from source, so you need a
|
|
18
|
+
[Rust toolchain](https://rustup.rs) and Python 3.12+:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install "git+https://github.com/stanford-star/relational-transformer.git"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
The quickest way to try a released checkpoint is on a RelBench
|
|
27
|
+
database already preprocessed into RT's tensor format on the Hub. The example below predicts whether an F1 driver fails to finish a race (`driver-dnf`) with a released RT-J checkpoint:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
import os
|
|
31
|
+
|
|
32
|
+
# flex_attention's compiled kernel is CUDA-only; run it eager on CPU/MPS
|
|
33
|
+
os.environ.setdefault("TORCHDYNAMO_DISABLE", "1")
|
|
34
|
+
|
|
35
|
+
import torch
|
|
36
|
+
from huggingface_hub import snapshot_download
|
|
37
|
+
|
|
38
|
+
from rt import RelationalTransformer
|
|
39
|
+
from rt.eval import build_evaluator
|
|
40
|
+
from rt.data import get_tasks
|
|
41
|
+
|
|
42
|
+
device = (
|
|
43
|
+
"cuda" if torch.cuda.is_available()
|
|
44
|
+
else "mps" if torch.backends.mps.is_available()
|
|
45
|
+
else "cpu"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# 1. download one RelBench database, already preprocessed into RT's tensor format
|
|
49
|
+
pre_dir = snapshot_download(
|
|
50
|
+
"stanford-star/relbench-preprocessed",
|
|
51
|
+
repo_type="dataset",
|
|
52
|
+
allow_patterns="rel-f1/*",
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# 2. load a pretrained checkpoint (RT-J here)
|
|
56
|
+
model = RelationalTransformer.from_pretrained(
|
|
57
|
+
"stanford-star/rt-j/classification", device=device
|
|
58
|
+
).to(torch.bfloat16)
|
|
59
|
+
cfg = model.config
|
|
60
|
+
|
|
61
|
+
# 3. build an evaluator for one task and predict zero-shot for 5 test rows.
|
|
62
|
+
# the evaluator samples each row's context from the preprocessed DB;
|
|
63
|
+
tasks = get_tasks(pre_dir, [("rel-f1", "driver-dnf")], ("test",),
|
|
64
|
+
embedder=cfg["embedder"])
|
|
65
|
+
ev = build_evaluator(
|
|
66
|
+
tasks, pre_dir,
|
|
67
|
+
embedder=cfg["embedder"], d_text=cfg["d_text"], device=device,
|
|
68
|
+
ctx_size=128, local_ctx_size=64, bfs_width=32, prefer_latest=True,
|
|
69
|
+
num_walks=10_000, walk_length=20, tokens_per_gpu=2**18,
|
|
70
|
+
items_per_task=5, num_workers=0, prefetch_factor=2,
|
|
71
|
+
shuffle_seed=0, context_seed=0, mmap_populate=True, vector_db_path=None,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# evaluate_raw yields one (task, ctx, labels, preds, n) per task
|
|
75
|
+
results = ev.evaluate_raw([(model, "")], [128])
|
|
76
|
+
_task, _ctx, _labels, out, _n = next(iter(results))
|
|
77
|
+
preds = torch.sigmoid(torch.tensor(out[""], dtype=torch.float32))
|
|
78
|
+
print("driver-dnf probability:", [round(p, 3) for p in preds.tolist()])
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> `items_per_task=5` and `ctx_size=128` keep this demo quick (most of the runtime
|
|
83
|
+
> is one-time warmup). On a GPU, raise `ctx_size` toward RT-J's training context of
|
|
84
|
+
> 8192 (with `local_ctx_size <= ctx_size`) for full accuracy over the whole test
|
|
85
|
+
> split.
|
|
86
|
+
|
|
87
|
+
## Bring your own database
|
|
88
|
+
|
|
89
|
+
Point RT at your **own** database, define a
|
|
90
|
+
prediction task, and infer with a released checkpoint:
|
|
91
|
+
|
|
92
|
+
- **Colab, no setup**: the [fully worked notebook](byod/colab.ipynb)
|
|
93
|
+
([open in Colab](https://colab.research.google.com/github/stanford-star/relational-transformer/blob/main/byod/colab.ipynb))
|
|
94
|
+
runs the whole flow end-to-end on your database (or the bundled demo).
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
We use [pixi](https://pixi.sh) to manage one self-contained
|
|
99
|
+
environment (Python, PyTorch + CUDA, Rust, and all dependencies), built on first
|
|
100
|
+
use. There is nothing to build past `pixi install`: the native Rust extension is
|
|
101
|
+
compiled as part of the project's own editable install.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/stanford-star/relational-transformer.git
|
|
105
|
+
cd relational-transformer
|
|
106
|
+
pixi run pytest # the test suite
|
|
107
|
+
pixi run python examples/train.py # or eval.py, preprocess.py, ...
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
|
|
112
|
+
| Guide | Description |
|
|
113
|
+
|---|---|
|
|
114
|
+
| [Downloads](docs/downloads.md) | Bulk-download raw data, preprocessed data, and checkpoints from HuggingFace |
|
|
115
|
+
| [Preprocess](docs/preprocess.md) | Convert RelBench-format databases into RT's on-disk format |
|
|
116
|
+
| [Inference](docs/inference.md) | Run a trained checkpoint; evaluate, engineer, tune, and ensemble contexts |
|
|
117
|
+
| [Pretrain](docs/train.md) | Train RT from scratch, single-GPU to multi-node |
|
|
118
|
+
| [Experiments](expts/README.md) | How experiments in `expts/` are laid out and submitted to slurm |
|
|
119
|
+
|
|
120
|
+
There is no CLI: RT is a library, and a run is a script that calls it. Copy
|
|
121
|
+
something from [`examples/`](examples/) and edit it — every entry point takes
|
|
122
|
+
its arguments explicitly, so nothing is hidden in a default you did not choose.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.7,<2"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "relational-transformer"
|
|
7
|
+
version = "1.8.0"
|
|
8
|
+
description = "Relational Transformer (RT): a foundation model for relational data, bundling a native Rust data-processing engine (rt.rustler)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
# 3.11, not 3.12: nothing in `src/` uses 3.12-only syntax or stdlib, and a
|
|
12
|
+
# consumer that pins 3.11 (relarena does, `~=3.11.0`) cannot resolve this
|
|
13
|
+
# package at all if the floor is 3.12. Development still happens on 3.12 --
|
|
14
|
+
# that is what `[tool.pixi.dependencies]` asks for.
|
|
15
|
+
requires-python = ">=3.11"
|
|
16
|
+
# Runtime only: what an `import rt.<something>` actually reaches for. Anything
|
|
17
|
+
# used by the repo's own tooling, experiments or plots belongs in `dev` below,
|
|
18
|
+
# so installing this package as a *library* (relarena does) does not drag a
|
|
19
|
+
# plotting stack and a pre-commit install into the consumer's environment.
|
|
20
|
+
dependencies = [
|
|
21
|
+
# roach.slurm ships in this distribution and type-checks its arguments.
|
|
22
|
+
"beartype",
|
|
23
|
+
"einops",
|
|
24
|
+
"huggingface-hub",
|
|
25
|
+
"ml_dtypes",
|
|
26
|
+
"numpy",
|
|
27
|
+
"orjson",
|
|
28
|
+
"pandas",
|
|
29
|
+
"polars",
|
|
30
|
+
"pyarrow",
|
|
31
|
+
"pyyaml",
|
|
32
|
+
"safetensors",
|
|
33
|
+
# mean_absolute_error / roc_auc_score in rt.eval only. The former `<1.6`
|
|
34
|
+
# cap was inherited from a relbench pin, not from anything here.
|
|
35
|
+
"scikit-learn",
|
|
36
|
+
"sentence-transformers",
|
|
37
|
+
"torch",
|
|
38
|
+
# Imported at module scope by rt.train._train and rt.eval._eval, so it is a
|
|
39
|
+
# hard runtime dependency even for a run with `wandb_disabled=True`.
|
|
40
|
+
"wandb",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
# The repo's own tooling and experiments: the test suite, the pre-commit hooks,
|
|
45
|
+
# the wandb workspace builder (expts/fine_tune/workspace.py), and the baselines
|
|
46
|
+
# and plots under expts/. None of it is imported from `src/rt`.
|
|
47
|
+
dev = [
|
|
48
|
+
"matplotlib",
|
|
49
|
+
"pre-commit",
|
|
50
|
+
"pytest",
|
|
51
|
+
"tqdm",
|
|
52
|
+
"wandb-workspaces",
|
|
53
|
+
"xgboost",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[tool.maturin]
|
|
57
|
+
python-source = "src"
|
|
58
|
+
manifest-path = "rustler/Cargo.toml"
|
|
59
|
+
module-name = "rt.rustler"
|
|
60
|
+
# The whole crate, FAISS aside (`vecdb` needs cmake and a BLAS; see rustler/Cargo.toml).
|
|
61
|
+
features = ["pyo3/extension-module"]
|
|
62
|
+
# Nothing extra. `roach` is slurm submission tooling, not part of RT, and lives
|
|
63
|
+
# at the repo root beside `expts/` rather than under `python-source` -- a
|
|
64
|
+
# consumer who `pip install`s this wants a relational transformer, not a batch
|
|
65
|
+
# submitter. Experiments reach it because the bootstrap `cd`s to the checkout,
|
|
66
|
+
# which is the same way they reach `expts`.
|
|
67
|
+
|
|
68
|
+
[tool.pytest.ini_options]
|
|
69
|
+
testpaths = ["tests"]
|
|
70
|
+
# The repo root, so `examples.*` and `expts.*` import the same way in a test as
|
|
71
|
+
# they do in a job (roach targets are module paths relative to the checkout).
|
|
72
|
+
pythonpath = ["."]
|
|
73
|
+
|
|
74
|
+
[tool.pixi.workspace]
|
|
75
|
+
channels = ["conda-forge"]
|
|
76
|
+
platforms = ["linux-64"]
|
|
77
|
+
|
|
78
|
+
# conda-forge's rust package writes an activation script that bakes the
|
|
79
|
+
# environment's own prefix into the linker setting:
|
|
80
|
+
#
|
|
81
|
+
# CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=<prefix>/bin/x86_64-conda-linux-gnu-cc
|
|
82
|
+
#
|
|
83
|
+
# Cargo hashes the per-target linker into every unit's fingerprint, including
|
|
84
|
+
# registry crates that never invoke a linker, so a checkout at a new path
|
|
85
|
+
# rebuilds the entire dependency tree however little changed. Pinning the bare
|
|
86
|
+
# name -- the same binary, resolved through PATH, which puts this environment's
|
|
87
|
+
# bin first -- makes the fingerprint independent of where the environment lives.
|
|
88
|
+
# Measured: a second checkout of the same commit went from 3m39s to 15s.
|
|
89
|
+
[tool.pixi.activation.env]
|
|
90
|
+
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER = "x86_64-conda-linux-gnu-cc"
|
|
91
|
+
|
|
92
|
+
[tool.pixi.dependencies]
|
|
93
|
+
# 3.12, not ">=3.12": on 3.14 the default multiprocessing start method on Linux
|
|
94
|
+
# is forkserver rather than fork, and a forkserver child is built by *pickling*
|
|
95
|
+
# the work over to it. rustler's Sampler is a pyo3 object and does not pickle,
|
|
96
|
+
# so every DataLoader with workers dies with
|
|
97
|
+
#
|
|
98
|
+
# TypeError: cannot pickle 'builtins.Sampler' object
|
|
99
|
+
#
|
|
100
|
+
# rt assumes fork throughout (see the comment in rt/_env.py about workers
|
|
101
|
+
# inheriting the thread budget "at fork"). Pinning the interpreter is the
|
|
102
|
+
# smaller change than making every dataset picklable, and it also puts this
|
|
103
|
+
# environment inside relarena's own `requires-python`.
|
|
104
|
+
python = "3.12.*"
|
|
105
|
+
rust = "*"
|
|
106
|
+
maturin = "*"
|
|
107
|
+
uv = "*"
|
|
108
|
+
|
|
109
|
+
[tool.pixi.pypi-dependencies]
|
|
110
|
+
# The **released wheel**, not an editable install of this checkout. Experiments
|
|
111
|
+
# must exercise the same artifact a user gets from `uv sync --extra rt`, because
|
|
112
|
+
# that is the path that breaks silently: v1.1.0 shipped without
|
|
113
|
+
# `_resolve_cutoff` and every one of our jobs was fine, running the checkout.
|
|
114
|
+
# Bumping this is now part of changing `src/rt` -- `tests/test_release.py` fails
|
|
115
|
+
# if the two drift apart.
|
|
116
|
+
#
|
|
117
|
+
# `expts/` is not packaged (`python-source = "src"`), so it still comes from the
|
|
118
|
+
# checkout, which is what lets a submit script change without a release.
|
|
119
|
+
relational-transformer = { url = "https://github.com/rishabh-ranjan/relational-transformer/releases/download/v1.7.0/relational_transformer-1.7.0-cp311-abi3-manylinux_2_28_x86_64.whl", extras = ["dev"] }
|
|
120
|
+
# snap-stanford's relbench, exactly pinned -- NOT the rishabh-ranjan fork `main`
|
|
121
|
+
# carries. This branch exists to run relarena's experiments (see
|
|
122
|
+
# expts/relarena/), and relarena requires relbench 2.1.2: the package version is
|
|
123
|
+
# the data version there (it ships the dataset checksums), and its Database /
|
|
124
|
+
# get_dataset API is the 2.x one.
|
|
125
|
+
#
|
|
126
|
+
# Nothing in `src/rt` needs the fork for those experiments. `rt.preprocess`
|
|
127
|
+
# mirrors relbench.hf rather than importing it; `rt.data.datasets` imports
|
|
128
|
+
# relbench only to resolve a dataset's test timestamp, which is reached only
|
|
129
|
+
# when `db_cutoff` is set, and relarena passes None because it hands RT a
|
|
130
|
+
# database it has already censored; and `rt.eval.relbench` scores against
|
|
131
|
+
# relbench's own evaluator, which relarena replaces with `task.evaluate`.
|
|
132
|
+
# `main` keeps the fork -- this pin is this branch's, for this purpose.
|
|
133
|
+
relbench = "==2.1.2"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/target/
|