pycurate 0.4.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.
- pycurate-0.4.0/LICENSE +202 -0
- pycurate-0.4.0/PKG-INFO +118 -0
- pycurate-0.4.0/README.md +76 -0
- pycurate-0.4.0/pyproject.toml +31 -0
- pycurate-0.4.0/setup.cfg +4 -0
- pycurate-0.4.0/src/pycurate/__init__.py +612 -0
- pycurate-0.4.0/src/pycurate/compute.py +272 -0
- pycurate-0.4.0/src/pycurate/core/blocks.py +271 -0
- pycurate-0.4.0/src/pycurate/core/cluster.py +148 -0
- pycurate-0.4.0/src/pycurate/core/diagnostics.py +292 -0
- pycurate-0.4.0/src/pycurate/core/embed.py +132 -0
- pycurate-0.4.0/src/pycurate/core/neighbors.py +120 -0
- pycurate-0.4.0/src/pycurate/core/scores.py +112 -0
- pycurate-0.4.0/src/pycurate/core/select.py +71 -0
- pycurate-0.4.0/src/pycurate/data.py +343 -0
- pycurate-0.4.0/src/pycurate/domains/_base.py +290 -0
- pycurate-0.4.0/src/pycurate/domains/_dense.py +382 -0
- pycurate-0.4.0/src/pycurate/domains/_posttrain.py +111 -0
- pycurate-0.4.0/src/pycurate/domains/detection/__init__.py +729 -0
- pycurate-0.4.0/src/pycurate/domains/image_text/__init__.py +457 -0
- pycurate-0.4.0/src/pycurate/domains/image_text/models.py +427 -0
- pycurate-0.4.0/src/pycurate/domains/labels/__init__.py +365 -0
- pycurate-0.4.0/src/pycurate/domains/preference/__init__.py +123 -0
- pycurate-0.4.0/src/pycurate/domains/rl/__init__.py +161 -0
- pycurate-0.4.0/src/pycurate/domains/robotics/__init__.py +1251 -0
- pycurate-0.4.0/src/pycurate/domains/segmentation/__init__.py +454 -0
- pycurate-0.4.0/src/pycurate/domains/sft/__init__.py +240 -0
- pycurate-0.4.0/src/pycurate/domains/text/__init__.py +217 -0
- pycurate-0.4.0/src/pycurate/domains/text/models.py +121 -0
- pycurate-0.4.0/src/pycurate/harness.py +329 -0
- pycurate-0.4.0/src/pycurate/io/lance_knn.py +172 -0
- pycurate-0.4.0/src/pycurate/recipe.py +335 -0
- pycurate-0.4.0/src/pycurate/research/__init__.py +12 -0
- pycurate-0.4.0/src/pycurate/research/fidelity.py +241 -0
- pycurate-0.4.0/src/pycurate/research/loop.py +519 -0
- pycurate-0.4.0/src/pycurate/research/multiplier.py +114 -0
- pycurate-0.4.0/src/pycurate/research/proposers.py +351 -0
- pycurate-0.4.0/src/pycurate/research/racing.py +123 -0
- pycurate-0.4.0/src/pycurate/research/simulate.py +123 -0
- pycurate-0.4.0/src/pycurate/research/trials.py +116 -0
- pycurate-0.4.0/src/pycurate/router.py +105 -0
- pycurate-0.4.0/src/pycurate/signals/__init__.py +274 -0
- pycurate-0.4.0/src/pycurate/signals/adoption.py +167 -0
- pycurate-0.4.0/src/pycurate/signals/discover.py +458 -0
- pycurate-0.4.0/src/pycurate/signals/gate.py +253 -0
- pycurate-0.4.0/src/pycurate/signals/sandbox.py +94 -0
- pycurate-0.4.0/src/pycurate/signals/spec.py +449 -0
- pycurate-0.4.0/src/pycurate/signals/store.py +217 -0
- pycurate-0.4.0/src/pycurate.egg-info/PKG-INFO +118 -0
- pycurate-0.4.0/src/pycurate.egg-info/SOURCES.txt +87 -0
- pycurate-0.4.0/src/pycurate.egg-info/dependency_links.txt +1 -0
- pycurate-0.4.0/src/pycurate.egg-info/requires.txt +40 -0
- pycurate-0.4.0/src/pycurate.egg-info/top_level.txt +1 -0
- pycurate-0.4.0/tests/test_agent_research.py +157 -0
- pycurate-0.4.0/tests/test_api.py +119 -0
- pycurate-0.4.0/tests/test_bench_hygiene.py +76 -0
- pycurate-0.4.0/tests/test_bench_libsignals.py +95 -0
- pycurate-0.4.0/tests/test_blocks.py +259 -0
- pycurate-0.4.0/tests/test_claims_check.py +159 -0
- pycurate-0.4.0/tests/test_clip_broad.py +100 -0
- pycurate-0.4.0/tests/test_cluster.py +33 -0
- pycurate-0.4.0/tests/test_curate_levels.py +132 -0
- pycurate-0.4.0/tests/test_defaults.py +242 -0
- pycurate-0.4.0/tests/test_dense_domains.py +239 -0
- pycurate-0.4.0/tests/test_discover.py +155 -0
- pycurate-0.4.0/tests/test_examples_gpu.py +59 -0
- pycurate-0.4.0/tests/test_explicit_columns.py +103 -0
- pycurate-0.4.0/tests/test_feature_liveness.py +208 -0
- pycurate-0.4.0/tests/test_geneva.py +14 -0
- pycurate-0.4.0/tests/test_gpuq_share.py +242 -0
- pycurate-0.4.0/tests/test_guard_subpool.py +149 -0
- pycurate-0.4.0/tests/test_harness.py +102 -0
- pycurate-0.4.0/tests/test_image_text.py +162 -0
- pycurate-0.4.0/tests/test_labels_domain.py +49 -0
- pycurate-0.4.0/tests/test_labels_scale.py +155 -0
- pycurate-0.4.0/tests/test_multiplier.py +30 -0
- pycurate-0.4.0/tests/test_noisy_md.py +200 -0
- pycurate-0.4.0/tests/test_readme_snippets.py +243 -0
- pycurate-0.4.0/tests/test_recipe.py +101 -0
- pycurate-0.4.0/tests/test_robotics_signals.py +283 -0
- pycurate-0.4.0/tests/test_robotics_traj.py +98 -0
- pycurate-0.4.0/tests/test_routing.py +40 -0
- pycurate-0.4.0/tests/test_search.py +41 -0
- pycurate-0.4.0/tests/test_search_size_of.py +45 -0
- pycurate-0.4.0/tests/test_signals.py +174 -0
- pycurate-0.4.0/tests/test_simple_api.py +134 -0
- pycurate-0.4.0/tests/test_trials_concurrency.py +62 -0
- pycurate-0.4.0/tests/test_validate.py +72 -0
- pycurate-0.4.0/tests/test_webvision_ingest.py +93 -0
pycurate-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
pycurate-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pycurate
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Automatic data curation and curation auto-research: signals as zero-copy columns, recipes as views, agents that search recipes against a fixed eval.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: numpy>=1.23
|
|
10
|
+
Requires-Dist: pyarrow>=14
|
|
11
|
+
Requires-Dist: lancedb>=0.40
|
|
12
|
+
Requires-Dist: pylance>=0.30
|
|
13
|
+
Provides-Extra: torch
|
|
14
|
+
Requires-Dist: torch>=2.2; extra == "torch"
|
|
15
|
+
Provides-Extra: text
|
|
16
|
+
Requires-Dist: transformers>=4.45; extra == "text"
|
|
17
|
+
Requires-Dist: tiktoken; extra == "text"
|
|
18
|
+
Requires-Dist: fasttext-numpy2; extra == "text"
|
|
19
|
+
Provides-Extra: vision
|
|
20
|
+
Requires-Dist: transformers>=4.45; extra == "vision"
|
|
21
|
+
Requires-Dist: open_clip_torch; extra == "vision"
|
|
22
|
+
Requires-Dist: pillow; extra == "vision"
|
|
23
|
+
Requires-Dist: webdataset; extra == "vision"
|
|
24
|
+
Provides-Extra: dense
|
|
25
|
+
Requires-Dist: cleanlab>=2.6; extra == "dense"
|
|
26
|
+
Requires-Dist: pycocotools; extra == "dense"
|
|
27
|
+
Requires-Dist: scipy; extra == "dense"
|
|
28
|
+
Requires-Dist: transformers>=4.45; extra == "dense"
|
|
29
|
+
Requires-Dist: pillow; extra == "dense"
|
|
30
|
+
Provides-Extra: research
|
|
31
|
+
Requires-Dist: optuna; extra == "research"
|
|
32
|
+
Requires-Dist: anthropic; extra == "research"
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
35
|
+
Requires-Dist: scikit-learn>=1.2; extra == "test"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
38
|
+
Requires-Dist: mkdocstrings[python]>=0.25; extra == "docs"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: pycurate[dense,research,text,torch,vision]; extra == "all"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# pycurate
|
|
44
|
+
|
|
45
|
+
Curation is a compute multiplier: train on the right subset of your data and you reach the same quality with less
|
|
46
|
+
compute. pycurate does it in one call. Point it at a table of training data. It detects what kind of data it is,
|
|
47
|
+
scores every row with the signals that matter for that kind, applies the strongest established public filter, and
|
|
48
|
+
hands you the subset to train on as a view: read straight from the table without copying it, in a globally shuffled
|
|
49
|
+
order. Seven kinds of data are routed from the schema: web text, noisy labels, image-text pairs, SFT chats,
|
|
50
|
+
preference pairs, RL prompts and robot episodes. Nothing in a default path calls an LLM. Give it your evaluation and
|
|
51
|
+
it tunes the recipe; add `agent=True` and an LLM agent surveys the literature and writes recipes. A tuned recipe is
|
|
52
|
+
applied only if it beats the default on your held-out metric. This is research code, and APIs may change.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "pycurate[all]" # torch, transformers, fastText (DCLM), open_clip, optuna (TPE search), anthropic (opt-in agent)
|
|
58
|
+
# from a checkout: pip install -e ".[all]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## One verb, three levels
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import pycurate as pc
|
|
65
|
+
|
|
66
|
+
ds = pc.load("data/*.parquet", name="pool", uri="./db") # parquet, pandas, pyarrow, hf://... into a Lance table
|
|
67
|
+
|
|
68
|
+
def train_eval(recipe, ids): # your proxy training; higher is better
|
|
69
|
+
model = train(ds.view(ids, columns=["text"]))
|
|
70
|
+
return {"score": evaluate(model), "heldout": evaluate(model)} # use a held-out set the search never sees
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
cur = pc.curate(ds) # 1. default: domain recipe, no LLM, no training
|
|
75
|
+
cur = pc.curate(ds, eval=train_eval, budget=8) # 2. tuned: TPE on your eval, guarded by the default
|
|
76
|
+
cur = pc.curate(ds, eval=train_eval, budget=8, agent=True) # 3. agent: literature signals + LLM recipes, guarded
|
|
77
|
+
print(cur, cur.report["level"], cur.report["guard"]) # what ran, what was picked and why
|
|
78
|
+
loader = cur.to_torch(columns=["text"], batch_size=256) # zero-copy, globally shuffled batches
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`pc.diagnose(ds)` runs pre-flight checks before you spend compute. Level 2 is TPE by default (no LLM); level 3 is
|
|
82
|
+
opt-in and the only path that calls an LLM (a logged-in `claude` CLI, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or the
|
|
83
|
+
`codex` CLI). Without `eval=`, `agent=True` only runs signal discovery and applies the default. Every signal is a
|
|
84
|
+
column, cataloged with its citations and provenance. Tables live on local disk or an object store (S3).
|
|
85
|
+
|
|
86
|
+
## Defaults
|
|
87
|
+
|
|
88
|
+
| kind of data | detected from | `pc.curate(ds)` applies | vs no curation |
|
|
89
|
+
|---|---|---|---|
|
|
90
|
+
| web text | one long text column | DCLM fastText top 10% + SemDeDup | 1.8× (GPT-2-small, 4B tokens) |
|
|
91
|
+
| image-text pairs | image + caption | DFN top 30% + SemDeDup | 3.3× (DataComp-medium) |
|
|
92
|
+
| noisy labels | a class label column | lowest k-NN label disagreement per class | 1.0-6.0×, median 2.8× (13 tasks) |
|
|
93
|
+
| SFT chats | `messages` or prompt/response | reward-model top 50% + prompt SemDeDup | 2.2× (Tulu-3 → Qwen2.5-0.5B) |
|
|
94
|
+
| preference pairs | prompt/chosen/rejected | top 75% by reward-model margin | better held-out z; no curve |
|
|
95
|
+
| RL prompts | problem/answer | learnability: 0 < pass rate < 1, ranked by p(1-p) | ≈1× |
|
|
96
|
+
| robot episodes | episode/action columns | lowest k-NN task-label disagreement per task | n.s. on small sims |
|
|
97
|
+
| object detection / instance masks | box-list or COCO annotation column | ObjectLab: drop flagged images | not benchmarked |
|
|
98
|
+
| semantic segmentation | image + label map | cleanlab.segmentation score ≥ 0.1 | not benchmarked |
|
|
99
|
+
|
|
100
|
+
Each is a compute multiplier against training on the whole pool at matched quality, read off measured curves and
|
|
101
|
+
never extrapolated (gross; DataComp-medium is the 80.2M-pair pool). An agent-searched recipe scored above DFN top 30%
|
|
102
|
+
there on all 3 seeds (3.90×, p = 0.051). Net of curation compute, and against the strongest public filter, see
|
|
103
|
+
[results](docs/results.md#headline-results). Fallbacks when a model cannot run are logged in `cur.report`.
|
|
104
|
+
|
|
105
|
+
## Docs
|
|
106
|
+
|
|
107
|
+
`pip install -e ".[docs]" && mkdocs serve`, or read them in [docs/](docs/index.md):
|
|
108
|
+
[quickstart](docs/quickstart.md) · [which level do I need?](docs/which_level.md) ·
|
|
109
|
+
[the guard](docs/guard.md) · [guides](docs/guides/lm_pretraining.md) · [agent mode](docs/agent.md) ·
|
|
110
|
+
[API](docs/api/index.md) · [results](docs/results.md) · [benchmarks](docs/benchmarks.md) ·
|
|
111
|
+
[contributing](docs/contributing.md).
|
|
112
|
+
Runnable before/after examples on real noisy data (CIFAR-10N, FineWeb, COCO, VOC): [docs/examples.md](docs/examples.md#example-scripts).
|
|
113
|
+
|
|
114
|
+
**Continuing the project?** Start at [HANDOFF.md](HANDOFF.md) (state, results, open items); the full account of what was built and why is [docs/DEVELOPMENT_HISTORY.md](docs/DEVELOPMENT_HISTORY.md), and the day-by-day log is [bench/PLAN.md](bench/PLAN.md).
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
Apache-2.0.
|
pycurate-0.4.0/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# pycurate
|
|
2
|
+
|
|
3
|
+
Curation is a compute multiplier: train on the right subset of your data and you reach the same quality with less
|
|
4
|
+
compute. pycurate does it in one call. Point it at a table of training data. It detects what kind of data it is,
|
|
5
|
+
scores every row with the signals that matter for that kind, applies the strongest established public filter, and
|
|
6
|
+
hands you the subset to train on as a view: read straight from the table without copying it, in a globally shuffled
|
|
7
|
+
order. Seven kinds of data are routed from the schema: web text, noisy labels, image-text pairs, SFT chats,
|
|
8
|
+
preference pairs, RL prompts and robot episodes. Nothing in a default path calls an LLM. Give it your evaluation and
|
|
9
|
+
it tunes the recipe; add `agent=True` and an LLM agent surveys the literature and writes recipes. A tuned recipe is
|
|
10
|
+
applied only if it beats the default on your held-out metric. This is research code, and APIs may change.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install "pycurate[all]" # torch, transformers, fastText (DCLM), open_clip, optuna (TPE search), anthropic (opt-in agent)
|
|
16
|
+
# from a checkout: pip install -e ".[all]"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## One verb, three levels
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import pycurate as pc
|
|
23
|
+
|
|
24
|
+
ds = pc.load("data/*.parquet", name="pool", uri="./db") # parquet, pandas, pyarrow, hf://... into a Lance table
|
|
25
|
+
|
|
26
|
+
def train_eval(recipe, ids): # your proxy training; higher is better
|
|
27
|
+
model = train(ds.view(ids, columns=["text"]))
|
|
28
|
+
return {"score": evaluate(model), "heldout": evaluate(model)} # use a held-out set the search never sees
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
cur = pc.curate(ds) # 1. default: domain recipe, no LLM, no training
|
|
33
|
+
cur = pc.curate(ds, eval=train_eval, budget=8) # 2. tuned: TPE on your eval, guarded by the default
|
|
34
|
+
cur = pc.curate(ds, eval=train_eval, budget=8, agent=True) # 3. agent: literature signals + LLM recipes, guarded
|
|
35
|
+
print(cur, cur.report["level"], cur.report["guard"]) # what ran, what was picked and why
|
|
36
|
+
loader = cur.to_torch(columns=["text"], batch_size=256) # zero-copy, globally shuffled batches
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`pc.diagnose(ds)` runs pre-flight checks before you spend compute. Level 2 is TPE by default (no LLM); level 3 is
|
|
40
|
+
opt-in and the only path that calls an LLM (a logged-in `claude` CLI, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or the
|
|
41
|
+
`codex` CLI). Without `eval=`, `agent=True` only runs signal discovery and applies the default. Every signal is a
|
|
42
|
+
column, cataloged with its citations and provenance. Tables live on local disk or an object store (S3).
|
|
43
|
+
|
|
44
|
+
## Defaults
|
|
45
|
+
|
|
46
|
+
| kind of data | detected from | `pc.curate(ds)` applies | vs no curation |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| web text | one long text column | DCLM fastText top 10% + SemDeDup | 1.8× (GPT-2-small, 4B tokens) |
|
|
49
|
+
| image-text pairs | image + caption | DFN top 30% + SemDeDup | 3.3× (DataComp-medium) |
|
|
50
|
+
| noisy labels | a class label column | lowest k-NN label disagreement per class | 1.0-6.0×, median 2.8× (13 tasks) |
|
|
51
|
+
| SFT chats | `messages` or prompt/response | reward-model top 50% + prompt SemDeDup | 2.2× (Tulu-3 → Qwen2.5-0.5B) |
|
|
52
|
+
| preference pairs | prompt/chosen/rejected | top 75% by reward-model margin | better held-out z; no curve |
|
|
53
|
+
| RL prompts | problem/answer | learnability: 0 < pass rate < 1, ranked by p(1-p) | ≈1× |
|
|
54
|
+
| robot episodes | episode/action columns | lowest k-NN task-label disagreement per task | n.s. on small sims |
|
|
55
|
+
| object detection / instance masks | box-list or COCO annotation column | ObjectLab: drop flagged images | not benchmarked |
|
|
56
|
+
| semantic segmentation | image + label map | cleanlab.segmentation score ≥ 0.1 | not benchmarked |
|
|
57
|
+
|
|
58
|
+
Each is a compute multiplier against training on the whole pool at matched quality, read off measured curves and
|
|
59
|
+
never extrapolated (gross; DataComp-medium is the 80.2M-pair pool). An agent-searched recipe scored above DFN top 30%
|
|
60
|
+
there on all 3 seeds (3.90×, p = 0.051). Net of curation compute, and against the strongest public filter, see
|
|
61
|
+
[results](docs/results.md#headline-results). Fallbacks when a model cannot run are logged in `cur.report`.
|
|
62
|
+
|
|
63
|
+
## Docs
|
|
64
|
+
|
|
65
|
+
`pip install -e ".[docs]" && mkdocs serve`, or read them in [docs/](docs/index.md):
|
|
66
|
+
[quickstart](docs/quickstart.md) · [which level do I need?](docs/which_level.md) ·
|
|
67
|
+
[the guard](docs/guard.md) · [guides](docs/guides/lm_pretraining.md) · [agent mode](docs/agent.md) ·
|
|
68
|
+
[API](docs/api/index.md) · [results](docs/results.md) · [benchmarks](docs/benchmarks.md) ·
|
|
69
|
+
[contributing](docs/contributing.md).
|
|
70
|
+
Runnable before/after examples on real noisy data (CIFAR-10N, FineWeb, COCO, VOC): [docs/examples.md](docs/examples.md#example-scripts).
|
|
71
|
+
|
|
72
|
+
**Continuing the project?** Start at [HANDOFF.md](HANDOFF.md) (state, results, open items); the full account of what was built and why is [docs/DEVELOPMENT_HISTORY.md](docs/DEVELOPMENT_HISTORY.md), and the day-by-day log is [bench/PLAN.md](bench/PLAN.md).
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Apache-2.0.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pycurate"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "Automatic data curation and curation auto-research: signals as zero-copy columns, recipes as views, agents that search recipes against a fixed eval."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "Apache-2.0" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = ["numpy>=1.23", "pyarrow>=14", "lancedb>=0.40", "pylance>=0.30"]
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
# faiss is optional so an existing faiss-gpu install is never replaced; install faiss-cpu or faiss-gpu yourself.
|
|
16
|
+
torch = ["torch>=2.2"]
|
|
17
|
+
text = ["transformers>=4.45", "tiktoken", "fasttext-numpy2"] # fasttext-numpy2: maintained fastText wheels (DCLM / FineWeb-Edu text defaults)
|
|
18
|
+
vision = ["transformers>=4.45", "open_clip_torch", "pillow", "webdataset"]
|
|
19
|
+
dense = ["cleanlab>=2.6", "pycocotools", "scipy", "transformers>=4.45", "pillow"] # detection / segmentation domains (ObjectLab, cleanlab.segmentation, COCO masks)
|
|
20
|
+
research = ["optuna", "anthropic"] # optuna: TPE (the default pc.search strategy); anthropic: opt-in agent
|
|
21
|
+
test = ["pytest>=7", "scikit-learn>=1.2"]
|
|
22
|
+
docs = ["mkdocs-material>=9.5", "mkdocstrings[python]>=0.25"] # the docs site: mkdocs serve / mkdocs build --strict
|
|
23
|
+
all = ["pycurate[torch,text,vision,dense,research]"]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.packages.find]
|
|
26
|
+
where = ["src"]
|
|
27
|
+
|
|
28
|
+
[tool.pytest.ini_options]
|
|
29
|
+
testpaths = ["tests"]
|
|
30
|
+
markers = ["gpu: runs the examples on a CUDA GPU at reduced size (opt-in: pytest -m gpu; skipped without CUDA)"]
|
|
31
|
+
addopts = "-m 'not gpu'"
|
pycurate-0.4.0/setup.cfg
ADDED