synthefy-tabular 0.2.1__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.
- synthefy_tabular-0.2.1/LICENSE +201 -0
- synthefy_tabular-0.2.1/NOTICE +5 -0
- synthefy_tabular-0.2.1/PKG-INFO +290 -0
- synthefy_tabular-0.2.1/README.md +243 -0
- synthefy_tabular-0.2.1/pyproject.toml +83 -0
- synthefy_tabular-0.2.1/setup.cfg +4 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/__init__.py +17 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/api.py +191 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/__init__.py +1 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/cls_default_noretrieval.json +102 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/model_base.json +51 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/reg_allordinal_poly10_adaptive.json +258 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/reg_allordinal_poly10_adaptive_svd256.json +306 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/reg_allordinal_poly10_noretrieval.json +258 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/configs/reg_default_noretrieval.json +201 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/__init__.py +28 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/analysis.py +1065 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/cli.py +77 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/datasets.py +733 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/models.py +386 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/evaluation/runner.py +598 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/hf.py +169 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/inference/__init__.py +3 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/inference/inference_method.py +318 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/inference/predictor.py +1343 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/inference/preprocess.py +1601 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/model/__init__.py +3 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/model/encoders.py +773 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/model/layer.py +911 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/model/quantile_dist.py +113 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/model/transformer.py +523 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/__init__.py +1 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/cli.py +738 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/config.py +377 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/data_generator.py +5428 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/loss.py +443 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/masking.py +93 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/optim.py +387 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/prefetch.py +175 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/scm_prior_generator.py +1041 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/training/trainer.py +1783 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/utils/__init__.py +1 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/utils/data_utils.py +431 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/utils/inference_utils.py +229 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/utils/loading.py +109 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular/utils/retrieval_utils.py +127 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/PKG-INFO +290 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/SOURCES.txt +55 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/dependency_links.txt +1 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/entry_points.txt +5 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/requires.txt +23 -0
- synthefy_tabular-0.2.1/src/synthefy_tabular.egg-info/top_level.txt +1 -0
- synthefy_tabular-0.2.1/tests/test_api_smoke.py +33 -0
- synthefy_tabular-0.2.1/tests/test_hf.py +6 -0
- synthefy_tabular-0.2.1/tests/test_imports.py +9 -0
- synthefy_tabular-0.2.1/tests/test_inference_e2e.py +80 -0
- synthefy_tabular-0.2.1/tests/test_training_config.py +13 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 StableAI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synthefy-tabular
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Synthefy Tabular foundation model training, inference, and evaluation
|
|
5
|
+
Author: Synthefy
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Synthefy/synthefy-tabular
|
|
8
|
+
Project-URL: Repository, https://github.com/Synthefy/synthefy-tabular
|
|
9
|
+
Project-URL: Issues, https://github.com/Synthefy/synthefy-tabular/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Synthefy/synthefy-tabular/releases
|
|
11
|
+
Keywords: tabular,foundation-model,machine-learning,deep-learning,regression,pytorch,synthetic-data
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: einops>=0.7
|
|
27
|
+
Requires-Dist: huggingface-hub>=1.0
|
|
28
|
+
Requires-Dist: kditransform>=1.0
|
|
29
|
+
Requires-Dist: numpy>=2.0
|
|
30
|
+
Requires-Dist: pandas>=2.0
|
|
31
|
+
Requires-Dist: scikit-learn>=1.4
|
|
32
|
+
Requires-Dist: scipy>=1.13
|
|
33
|
+
Requires-Dist: torch>=2.0
|
|
34
|
+
Requires-Dist: tqdm>=4.65
|
|
35
|
+
Requires-Dist: typing-extensions>=4.10
|
|
36
|
+
Provides-Extra: train
|
|
37
|
+
Requires-Dist: wandb>=0.15.0; extra == "train"
|
|
38
|
+
Requires-Dist: xgboost; extra == "train"
|
|
39
|
+
Provides-Extra: eval
|
|
40
|
+
Requires-Dist: matplotlib; extra == "eval"
|
|
41
|
+
Requires-Dist: openml; extra == "eval"
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: build; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest; extra == "dev"
|
|
45
|
+
Requires-Dist: ruff; extra == "dev"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# Synthefy Tabular
|
|
49
|
+
|
|
50
|
+
Synthefy Tabular is a tabular foundation model for **regression**
|
|
51
|
+
via in-context learning (ICL). Given a few labeled rows as context, it predicts on
|
|
52
|
+
new query rows in a single forward pass, with no task-specific training or fine-tuning.
|
|
53
|
+
The model is trained entirely on synthetic data.
|
|
54
|
+
|
|
55
|
+
This repository contains the public training, inference, evaluation, and Hugging
|
|
56
|
+
Face checkpoint tooling.
|
|
57
|
+
|
|
58
|
+
## Results
|
|
59
|
+
|
|
60
|
+
Mean R² across 96 regression tasks from three public benchmark suites:
|
|
61
|
+
|
|
62
|
+
| Source | Tasks | Mean R² |
|
|
63
|
+
|--------|------:|--------:|
|
|
64
|
+
| OpenML Regression | 11 | 0.6104 |
|
|
65
|
+
| TabArena | 13 | 0.8089 |
|
|
66
|
+
| TALENT | 72 | 0.7591 |
|
|
67
|
+
|
|
68
|
+
Large-N / long-context tables (common in TabArena) are the current focus of the
|
|
69
|
+
large-table training stages.
|
|
70
|
+
|
|
71
|
+
> **Thinking** is an inference-time reasoning extension. Details are forthcoming.
|
|
72
|
+
|
|
73
|
+
## How it works
|
|
74
|
+
|
|
75
|
+
### Architecture
|
|
76
|
+
|
|
77
|
+
Synthefy Tabular is a **FeaturesTransformer (~5.5M parameters)** that alternates
|
|
78
|
+
two kinds of attention:
|
|
79
|
+
|
|
80
|
+
- **Feature attention** learns relationships between columns.
|
|
81
|
+
- **Sample attention** learns relationships between rows (context and query).
|
|
82
|
+
- **In-context learning**: predictions condition on labeled context rows, with no
|
|
83
|
+
gradient updates at inference.
|
|
84
|
+
|
|
85
|
+
Key config: 16 transformer layers, embed_dim 128, hidden 384, 2 heads, the
|
|
86
|
+
**v2-lite** block (SwiGLU + RMSNorm + pre-norm), features grouped in pairs
|
|
87
|
+
(`features_per_group=2`), with **column-specific y-aware** feature attention.
|
|
88
|
+
Features are encoded with RBF embeddings; missing values are handled natively
|
|
89
|
+
via learned mask embeddings.
|
|
90
|
+
|
|
91
|
+
### Synthetic data
|
|
92
|
+
|
|
93
|
+
The model never sees real data during training. Its capability comes from a diverse
|
|
94
|
+
synthetic data generator covering real-world tabular regimes:
|
|
95
|
+
|
|
96
|
+
- **Structural Causal Models (SCM)**: hierarchical DAGs with 8 edge-function types
|
|
97
|
+
(MLP, decision tree, piecewise-linear, polynomial, periodic, RBF, log/exp, conv1d).
|
|
98
|
+
- **Regression priors**: 9 target families (dense/sparse linear, GAM, interactions,
|
|
99
|
+
random MLP, random tree, radial/RBF, Fourier features, chained trigonometric).
|
|
100
|
+
- **Realism augmentations**: discretized features, noise features, correlated blocks,
|
|
101
|
+
structural missingness, label noise, class imbalance.
|
|
102
|
+
- **Learnability filter**: an ExtraTrees signal-quality filter rejects unlearnable
|
|
103
|
+
datasets so training compute is spent on learnable tasks.
|
|
104
|
+
|
|
105
|
+
See [docs/training.md](docs/training.md) for the full recipe.
|
|
106
|
+
|
|
107
|
+
## Install
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install synthefy-tabular
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Optional extras:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pip install "synthefy-tabular[train]" # training-only deps (wandb, xgboost)
|
|
117
|
+
pip install "synthefy-tabular[eval]" # evaluation-only deps (matplotlib, openml)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Develop from source
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git clone https://github.com/Synthefy/synthefy-tabular
|
|
124
|
+
cd synthefy-tabular
|
|
125
|
+
uv sync --extra dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`uv sync` installs a pinned PyTorch build. If that CUDA build does not match your
|
|
129
|
+
driver, install a PyTorch wheel matching your CUDA version instead. The Muon
|
|
130
|
+
optimizer used in training prefers `torch.optim.Muon`; if your PyTorch lacks it,
|
|
131
|
+
the package automatically falls back to a built-in implementation.
|
|
132
|
+
|
|
133
|
+
## Authentication (optional)
|
|
134
|
+
|
|
135
|
+
The default checkpoint at
|
|
136
|
+
[`Synthefy/synthefy-tabular`](https://huggingface.co/Synthefy/synthefy-tabular)
|
|
137
|
+
is **public**: the first inference call downloads and caches it automatically,
|
|
138
|
+
with no token and no access request.
|
|
139
|
+
|
|
140
|
+
A Hugging Face token is only worth setting if you hit anonymous download rate
|
|
141
|
+
limits, or if you point the package at a private/gated checkpoint of your own.
|
|
142
|
+
Provide one in any of these ways:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Option A: env var (one-shot)
|
|
146
|
+
export HF_TOKEN=hf_xxxxxxxx
|
|
147
|
+
|
|
148
|
+
# Option B: persist via the HF CLI (huggingface-hub >= 1.0)
|
|
149
|
+
hf auth login
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# Option C: pass explicitly in code
|
|
154
|
+
from synthefy_tabular import SynthefyTabularRegressor
|
|
155
|
+
model = SynthefyTabularRegressor(token="hf_xxxxxxxx")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Get a token at <https://huggingface.co/settings/tokens> (read scope is
|
|
159
|
+
sufficient). If you supply a local `model_path=` instead, no network access is
|
|
160
|
+
needed at all.
|
|
161
|
+
|
|
162
|
+
## Inference
|
|
163
|
+
|
|
164
|
+
Pretrained weights are hosted on the Hugging Face Hub at
|
|
165
|
+
[`Synthefy/synthefy-tabular`](https://huggingface.co/Synthefy/synthefy-tabular).
|
|
166
|
+
The first call downloads and caches the checkpoint automatically, so a complete
|
|
167
|
+
working example is just:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from sklearn.datasets import load_diabetes
|
|
171
|
+
from sklearn.model_selection import train_test_split
|
|
172
|
+
from synthefy_tabular import SynthefyTabularRegressor
|
|
173
|
+
|
|
174
|
+
X, y = load_diabetes(return_X_y=True)
|
|
175
|
+
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
|
|
176
|
+
|
|
177
|
+
model = SynthefyTabularRegressor() # downloads weights from the HF Hub on first use
|
|
178
|
+
model.fit(X_train, y_train) # "fit" just stores the labeled rows as context
|
|
179
|
+
pred = model.predict(X_test) # predictions in a single forward pass, no training
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
It uses a GPU when one is available and falls back to CPU. A one-shot helper
|
|
183
|
+
skips the object entirely:
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from synthefy_tabular import predict
|
|
187
|
+
pred = predict(X_train, y_train, X_test, task="regression")
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
To run from your own checkpoint instead of the Hub default, pass a path:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
model = SynthefyTabularRegressor(model_path="path/to/checkpoint.pt")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`predict` follows the `TabPFNRegressor.predict` contract: pass
|
|
197
|
+
`output_type="mean"` (default), `"median"`, or `"mode"` to choose the point
|
|
198
|
+
estimate drawn from the model's predictive distribution.
|
|
199
|
+
|
|
200
|
+
Runnable example: [`examples/inference_regression.py`](examples/inference_regression.py).
|
|
201
|
+
More detail in [docs/inference.md](docs/inference.md).
|
|
202
|
+
|
|
203
|
+
## Training
|
|
204
|
+
|
|
205
|
+
Smoke test (2 steps, single GPU, no logging):
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
TOTAL_STEPS=2 NPROC_PER_NODE=1 WANDB_MODE=disabled bash scripts/train.sh
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Training runs entirely on synthetic data and **trains to completion**: there is
|
|
212
|
+
no real-data validation in the loop, so no benchmark data needs to
|
|
213
|
+
be downloaded to train, and no eval signal influences checkpoint selection. Each
|
|
214
|
+
run writes periodic and final checkpoints, and each curriculum tier seeds from
|
|
215
|
+
the previous tier's final checkpoint.
|
|
216
|
+
|
|
217
|
+
### Tier 1: from scratch
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
CUDA_VISIBLE_DEVICES=0,1,2,3 bash scripts/train.sh
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Configurable via environment variables (`TOTAL_STEPS`, `LR`, `BATCH_SIZE`,
|
|
224
|
+
`CUDA_VISIBLE_DEVICES`, ...; see the script header). Checkpoints land in
|
|
225
|
+
`checkpoints/<run>/tier1/`.
|
|
226
|
+
|
|
227
|
+
### Tiers 2 to 5: curriculum continuation
|
|
228
|
+
|
|
229
|
+
One script runs the rest of the curriculum, each tier seeding from the previous
|
|
230
|
+
tier's final checkpoint:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
CUDA_VISIBLE_DEVICES=0,1,2,3 bash scripts/continue_training.sh
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
| Tier | Table shapes (N x F) | Focus |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| 2 | N ≤ 4K, F ≤ 384 | larger tables |
|
|
239
|
+
| 3 | N ≤ 8K, F ≤ 768 | largest tables |
|
|
240
|
+
| 4 | N ≤ 56K, F ≤ 96 | large-N / long-context specialist |
|
|
241
|
+
| 5 | N ≤ 33K, F ≤ 1280 | both-large corner (N and F coupled by a cell budget) |
|
|
242
|
+
|
|
243
|
+
It auto-detects the most recent tier-1 run, or point it at one with
|
|
244
|
+
`RUN_ROOT=checkpoints/<run>`. Run a subset with `START_TIER` / `END_TIER`
|
|
245
|
+
(e.g. `END_TIER=3` for tiers 2 to 3 only).
|
|
246
|
+
|
|
247
|
+
> **Tiers 4 and 5 push N up to 56K rows.** Dense O(N²) sample attention at that
|
|
248
|
+
> scale forces `batch=1` with large gradient accumulation, and can OOM or hang
|
|
249
|
+
> depending on GPU memory. Smoke-probe them first; see the script header.
|
|
250
|
+
|
|
251
|
+
Training uses the **Muon** optimizer (EMA 0.999), a **pinball** loss with 999
|
|
252
|
+
quantiles + a monotonicity penalty, and bf16 mixed precision with DDP. Pass
|
|
253
|
+
`--seed` for reproducible runs. Full options: [docs/training.md](docs/training.md).
|
|
254
|
+
|
|
255
|
+
## Evaluation
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
synthefy-tabular-eval --checkpoint "Synthefy:path/to/checkpoint.pt"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
or `bash scripts/evaluate.sh`. See [docs/evaluation.md](docs/evaluation.md) for
|
|
262
|
+
benchmark sources and how to evaluate a Synthefy Tabular checkpoint.
|
|
263
|
+
|
|
264
|
+
## Hugging Face
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
synthefy-tabular-download # fetch default checkpoint
|
|
268
|
+
synthefy-tabular-upload path/to/checkpoint.pt --repo-id Synthefy/synthefy-tabular
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
See [docs/huggingface.md](docs/huggingface.md).
|
|
272
|
+
|
|
273
|
+
## Repository layout
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
src/synthefy_tabular/
|
|
277
|
+
api.py Public API (SynthefyTabularRegressor, infer, predict)
|
|
278
|
+
model/ FeaturesTransformer architecture
|
|
279
|
+
training/ Data generation, trainer, loss, config, CLI
|
|
280
|
+
inference/ Sklearn-compatible predictor + preprocessing
|
|
281
|
+
evaluation/ Benchmark runner over public benchmark suites
|
|
282
|
+
hf.py Hugging Face download / upload
|
|
283
|
+
scripts/ train.sh, continue_training.sh, evaluate.sh
|
|
284
|
+
docs/ training, inference, evaluation, huggingface guides
|
|
285
|
+
examples/ Runnable inference / upload scripts
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## License
|
|
289
|
+
|
|
290
|
+
See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|