dariuscty commited on
Commit
672ecc3
·
verified ·
1 Parent(s): 795d51b

Restore RSI-Anything inference resources and LabHorizon dataset

Browse files

Restore the 150-file content snapshot of the previous release f6f7025fea858ed1d7bf68c8e9046ca6adf0b18b, including all domain checkpoints, inference sources, dataset guides and LabHorizon Level 1 data.

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LICENSE +190 -0
  2. MANIFEST.json +594 -0
  3. MODEL_INDEX.json +60 -0
  4. NOTICE +14 -0
  5. README.md +107 -0
  6. THIRD_PARTY_NOTICES.md +47 -0
  7. _base_models/Qwen2.5-Coder-3B-Instruct/LICENSE +54 -0
  8. _base_models/Qwen2.5-Coder-3B-Instruct/NOTICE +1 -0
  9. _base_models/README.md +41 -0
  10. _base_models/ReasonFlux-Coder-7B/BASE_MODEL_LICENSE +202 -0
  11. _base_models/ReasonFlux-Coder-7B/README.md +38 -0
  12. code_repair/README.md +142 -0
  13. code_repair/checkpoints/codecontests_final/inference.json +12 -0
  14. code_repair/checkpoints/codecontests_final/public_world/domain.pt +3 -0
  15. code_repair/checkpoints/codecontests_final/public_world/inference.json +10 -0
  16. code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_config.json +26 -0
  17. code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_model.safetensors +3 -0
  18. code_repair/checkpoints/codecontests_final/suite_readout.pt +3 -0
  19. code_repair/checkpoints/transfer_final/inference.json +12 -0
  20. code_repair/checkpoints/transfer_final/public_world/domain.pt +3 -0
  21. code_repair/checkpoints/transfer_final/public_world/inference.json +10 -0
  22. code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_config.json +26 -0
  23. code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_model.safetensors +3 -0
  24. code_repair/checkpoints/transfer_final/suite_readout.pt +3 -0
  25. code_repair/codecontests/src/artifacts.py +12 -0
  26. code_repair/codecontests/src/coder.py +69 -0
  27. code_repair/codecontests/src/cure_wm.py +94 -0
  28. code_repair/codecontests/src/fixtures.py +4 -0
  29. code_repair/codecontests/src/public_context.py +4 -0
  30. code_repair/codecontests/src/ranking.py +32 -0
  31. code_repair/codecontests/src/seed.py +5 -0
  32. code_repair/codecontests/src/semantic_world.py +62 -0
  33. code_repair/codecontests/src/world.py +110 -0
  34. code_repair/codecontests/vendor/jepa-anything-core/LICENSE +202 -0
  35. code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/__init__.py +2 -0
  36. code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/baselines.py +70 -0
  37. code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/opf.py +64 -0
  38. code_repair/infer.py +64 -0
  39. code_repair/requirements.txt +8 -0
  40. code_repair/transfer/src/artifacts.py +12 -0
  41. code_repair/transfer/src/coder.py +69 -0
  42. code_repair/transfer/src/common.py +42 -0
  43. code_repair/transfer/src/cure_wm.py +91 -0
  44. code_repair/transfer/src/executor.py +45 -0
  45. code_repair/transfer/src/fixtures.py +4 -0
  46. code_repair/transfer/src/judge_child.py +34 -0
  47. code_repair/transfer/src/models.py +50 -0
  48. code_repair/transfer/src/public_context.py +4 -0
  49. code_repair/transfer/src/runner.py +29 -0
  50. code_repair/transfer/src/sandbox_launch.py +21 -0
LICENSE ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Copyright 2026 RSI-Anything contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
MANIFEST.json ADDED
@@ -0,0 +1,594 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "LICENSE": {
3
+ "bytes": 10770,
4
+ "sha256": "543ff600afd0cd4c006dc1f5d9b9b8fc29c259fd7fbca127c0224910bbb94896"
5
+ },
6
+ "MODEL_INDEX.json": {
7
+ "bytes": 1882,
8
+ "sha256": "c37dc31b2220348bf278206da59177817c194921af8cf203e8e9b02bd92293db"
9
+ },
10
+ "NOTICE": {
11
+ "bytes": 662,
12
+ "sha256": "8835e051e4e9f9480ecbfb219763a2978a39577b9593680342cee28f18b1deaa"
13
+ },
14
+ "README.md": {
15
+ "bytes": 8206,
16
+ "sha256": "5eefa4c6732084f01a2cea04a222449609d9f5b9a61c41a55541367e0e6df9ff"
17
+ },
18
+ "THIRD_PARTY_NOTICES.md": {
19
+ "bytes": 3863,
20
+ "sha256": "f37b8353a1e19a811127c33349c781eb42fddfddd8cc2e7055fb6e948cc9a2c5"
21
+ },
22
+ "_base_models/Qwen2.5-Coder-3B-Instruct/LICENSE": {
23
+ "bytes": 7388,
24
+ "sha256": "ef52482bb785733093dc9a2e8edd8e764c77d12d8e9d8f10a80c9b547d32d0f9"
25
+ },
26
+ "_base_models/Qwen2.5-Coder-3B-Instruct/NOTICE": {
27
+ "bytes": 110,
28
+ "sha256": "b9714db3499a9b07fcacbe36d446de1d05dd9f819f4156693724515ad9c753c9"
29
+ },
30
+ "_base_models/README.md": {
31
+ "bytes": 2412,
32
+ "sha256": "f3faf59eb647328883e11b7edae02d7d8c553f79ab2f468a1031922f05a6f586"
33
+ },
34
+ "_base_models/ReasonFlux-Coder-7B/BASE_MODEL_LICENSE": {
35
+ "bytes": 11343,
36
+ "sha256": "832dd9e00a68dd83b3c3fb9f5588dad7dcf337a0db50f7d9483f310cd292e92e"
37
+ },
38
+ "_base_models/ReasonFlux-Coder-7B/README.md": {
39
+ "bytes": 1325,
40
+ "sha256": "933e51e19b5ca4dbcec7fcee130427db8e7f1166bcb065d1819d15adc725eeea"
41
+ },
42
+ "code_repair/README.md": {
43
+ "bytes": 5663,
44
+ "sha256": "6ac4bc3a7c7246b743e1e98c32c31a5ea5eb932be29a988cadf33eed0ad27cb0"
45
+ },
46
+ "code_repair/checkpoints/codecontests_final/inference.json": {
47
+ "bytes": 742,
48
+ "sha256": "65f3c8576c48b27235e4802537795389c53b951dbcc0e2f9c7de8e5f1742a6b4"
49
+ },
50
+ "code_repair/checkpoints/codecontests_final/public_world/domain.pt": {
51
+ "bytes": 3489349,
52
+ "sha256": "7a48412bae22de33243342507bf9b468b8eeef4ff108876e81d739c40fbe6eb6"
53
+ },
54
+ "code_repair/checkpoints/codecontests_final/public_world/inference.json": {
55
+ "bytes": 461,
56
+ "sha256": "292bc9a30d28c3590fe6597c224f428014dfac388b0f853f37d0e4ba29cc01ad"
57
+ },
58
+ "code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_config.json": {
59
+ "bytes": 518,
60
+ "sha256": "32b6744b4f2313fb3724578cfa3c8d1d401d80c872328301aa9cec03b00c8850"
61
+ },
62
+ "code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_model.safetensors": {
63
+ "bytes": 29528024,
64
+ "sha256": "547055dab769b39bb7ee3734713324e093a554aab49d9fd94d8ab3d1795aa8ce"
65
+ },
66
+ "code_repair/checkpoints/codecontests_final/suite_readout.pt": {
67
+ "bytes": 72605,
68
+ "sha256": "4db0e287d0cd526f34efe2958ef020b76dfb30939038ac6a7b76bf2614467d0f"
69
+ },
70
+ "code_repair/checkpoints/transfer_final/inference.json": {
71
+ "bytes": 742,
72
+ "sha256": "cbe4ccfafba495c7f0c99193861a480958a056f7e1ed34bcbcde36e1e414d390"
73
+ },
74
+ "code_repair/checkpoints/transfer_final/public_world/domain.pt": {
75
+ "bytes": 3489349,
76
+ "sha256": "fe0f754d603465ba91200e7ad10232f374ee5626e2d4b5a999205d74011cdcfb"
77
+ },
78
+ "code_repair/checkpoints/transfer_final/public_world/inference.json": {
79
+ "bytes": 461,
80
+ "sha256": "5febd5255574af19fdb58013f899856d60acefd9a75c1f72088cec701b79cca9"
81
+ },
82
+ "code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_config.json": {
83
+ "bytes": 518,
84
+ "sha256": "92c108d23c1aec50044afb5eef89e0c11cc7e67f325b3e774c9dd6f288c30ae4"
85
+ },
86
+ "code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_model.safetensors": {
87
+ "bytes": 29528024,
88
+ "sha256": "ef4e41b5439b3e3739e26043cb9c7ddd48e9776d49d365101607a1e43fe54eb1"
89
+ },
90
+ "code_repair/checkpoints/transfer_final/suite_readout.pt": {
91
+ "bytes": 72605,
92
+ "sha256": "fe7643dfb1b6d76fa8ceb6480f156c3e8afa8d9ce7517d640d8d7f48390a2c43"
93
+ },
94
+ "code_repair/codecontests/src/artifacts.py": {
95
+ "bytes": 648,
96
+ "sha256": "e0911ccb1215c66106be9f9b57b91642ac7c1878b889205adaca144c2ec36b7b"
97
+ },
98
+ "code_repair/codecontests/src/coder.py": {
99
+ "bytes": 4021,
100
+ "sha256": "641ddaf82235dcbd4ee75c2df5024578cd1778b88540a459339a65f6606b5887"
101
+ },
102
+ "code_repair/codecontests/src/cure_wm.py": {
103
+ "bytes": 4043,
104
+ "sha256": "8f7401429ea82424741d5dd11eb34b5b863bc77dbc2432b8c805987ee38961da"
105
+ },
106
+ "code_repair/codecontests/src/fixtures.py": {
107
+ "bytes": 177,
108
+ "sha256": "602253a8655246d5dfd0d2b423b93d03856f4f86ca5b9439373b33f4a2096f54"
109
+ },
110
+ "code_repair/codecontests/src/public_context.py": {
111
+ "bytes": 260,
112
+ "sha256": "230ed6795f3d922e7afd8f6456d7ca5fcff6b90553f59812664ddc70dbf50d8a"
113
+ },
114
+ "code_repair/codecontests/src/ranking.py": {
115
+ "bytes": 2036,
116
+ "sha256": "52a63312155070da44bb1ee0ac978fa635f275789d72903525823e22f31edab0"
117
+ },
118
+ "code_repair/codecontests/src/seed.py": {
119
+ "bytes": 178,
120
+ "sha256": "69bce2ae06084f545e3f448e9e36a978ae3b50e69c9436fb53fe4e5fa886617c"
121
+ },
122
+ "code_repair/codecontests/src/semantic_world.py": {
123
+ "bytes": 2731,
124
+ "sha256": "67b88d4c3bd74b59f06cf64151c8b2937b5419319ace7d1da4a7544708d9440b"
125
+ },
126
+ "code_repair/codecontests/src/world.py": {
127
+ "bytes": 5101,
128
+ "sha256": "7c05f12d8afa3d0f44d9df6b2e4f00a8eb5e069ee6df9ca4a0b3bb7ed4787259"
129
+ },
130
+ "code_repair/codecontests/vendor/jepa-anything-core/LICENSE": {
131
+ "bytes": 11358,
132
+ "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
133
+ },
134
+ "code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/__init__.py": {
135
+ "bytes": 113,
136
+ "sha256": "68590deed525b0197737ca2d27d6f10f5ba354326530d237d9d9066c2af6b238"
137
+ },
138
+ "code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/baselines.py": {
139
+ "bytes": 3372,
140
+ "sha256": "0df0524c1146ebfa19c0ac4991ca3fb48bd778473f9c9439bee6001bb16bf41c"
141
+ },
142
+ "code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/opf.py": {
143
+ "bytes": 3554,
144
+ "sha256": "f0fd479d0f72e26d0adff9621e4494343df3256f4cdeace4f6a173d6ebb0501d"
145
+ },
146
+ "code_repair/infer.py": {
147
+ "bytes": 4108,
148
+ "sha256": "bcdc93b170014eba76c9266948a9a0f6d6c0f9bdb9896b5f486bd888a0ab16f9"
149
+ },
150
+ "code_repair/requirements.txt": {
151
+ "bytes": 140,
152
+ "sha256": "7ec0aba91ac5cff8aa26533603e6ca0c99e62dd301043218032168d376126649"
153
+ },
154
+ "code_repair/transfer/src/artifacts.py": {
155
+ "bytes": 648,
156
+ "sha256": "e0911ccb1215c66106be9f9b57b91642ac7c1878b889205adaca144c2ec36b7b"
157
+ },
158
+ "code_repair/transfer/src/coder.py": {
159
+ "bytes": 4021,
160
+ "sha256": "641ddaf82235dcbd4ee75c2df5024578cd1778b88540a459339a65f6606b5887"
161
+ },
162
+ "code_repair/transfer/src/common.py": {
163
+ "bytes": 2378,
164
+ "sha256": "6ce65a7f27a3d05d5dd1a694c4eab00bd8cf7a15352ffcaf5c0bd3fe15e79e2e"
165
+ },
166
+ "code_repair/transfer/src/cure_wm.py": {
167
+ "bytes": 3792,
168
+ "sha256": "729bf6ca0a17b330827ec4378beba3ea3d1cb2c02173cbcf7928bf7c6352b821"
169
+ },
170
+ "code_repair/transfer/src/executor.py": {
171
+ "bytes": 3597,
172
+ "sha256": "3be082d50e1006d940284e500d8d3b9e5dbf290a61a35a4a6b80a0d3d1102ef7"
173
+ },
174
+ "code_repair/transfer/src/fixtures.py": {
175
+ "bytes": 177,
176
+ "sha256": "602253a8655246d5dfd0d2b423b93d03856f4f86ca5b9439373b33f4a2096f54"
177
+ },
178
+ "code_repair/transfer/src/judge_child.py": {
179
+ "bytes": 2162,
180
+ "sha256": "756ea1fee278f8a9b5e0c1d7c33c954860c4bfbeddc2f9a2c1fddc31d70586a2"
181
+ },
182
+ "code_repair/transfer/src/models.py": {
183
+ "bytes": 3354,
184
+ "sha256": "439c0c6853fccaebd865213dc2bc6b65967223868d51714b1b8657ee62af2861"
185
+ },
186
+ "code_repair/transfer/src/public_context.py": {
187
+ "bytes": 260,
188
+ "sha256": "230ed6795f3d922e7afd8f6456d7ca5fcff6b90553f59812664ddc70dbf50d8a"
189
+ },
190
+ "code_repair/transfer/src/runner.py": {
191
+ "bytes": 1503,
192
+ "sha256": "dd715593df8826294eb1675c65a13a8c4828433b2499a105d645692ace1b44bc"
193
+ },
194
+ "code_repair/transfer/src/sandbox_launch.py": {
195
+ "bytes": 1712,
196
+ "sha256": "de3806c96724f7a3e6105624e055dc338dfb9843277b0384a7ea7b9bc5e9b7b8"
197
+ },
198
+ "code_repair/transfer/src/seed.py": {
199
+ "bytes": 178,
200
+ "sha256": "69bce2ae06084f545e3f448e9e36a978ae3b50e69c9436fb53fe4e5fa886617c"
201
+ },
202
+ "code_repair/transfer/src/semantic_world.py": {
203
+ "bytes": 2731,
204
+ "sha256": "67b88d4c3bd74b59f06cf64151c8b2937b5419319ace7d1da4a7544708d9440b"
205
+ },
206
+ "code_repair/transfer/src/world.py": {
207
+ "bytes": 5101,
208
+ "sha256": "7c05f12d8afa3d0f44d9df6b2e4f00a8eb5e069ee6df9ca4a0b3bb7ed4787259"
209
+ },
210
+ "code_repair/transfer/vendor/apps/LICENSE": {
211
+ "bytes": 1070,
212
+ "sha256": "8f6401fb0b1fbfcac17aac8d61e4e1b0d2de9aa190d8aa655fedc5fd783b2ace"
213
+ },
214
+ "code_repair/transfer/vendor/apps/pyext.py": {
215
+ "bytes": 17064,
216
+ "sha256": "0c03582c95be4e6726da7bcb4ddf50dbb1993d9ecc20c8a87f8fbc13d27d69e8"
217
+ },
218
+ "code_repair/transfer/vendor/apps/testing_util.py": {
219
+ "bytes": 23773,
220
+ "sha256": "9a4e58ff2634ef606c42597457c0733910862e0588ea750d901265bbfe65d36f"
221
+ },
222
+ "code_repair/transfer/vendor/jepa-anything-core/LICENSE": {
223
+ "bytes": 11358,
224
+ "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
225
+ },
226
+ "code_repair/transfer/vendor/jepa-anything-core/src/jepa_anything_core/__init__.py": {
227
+ "bytes": 113,
228
+ "sha256": "68590deed525b0197737ca2d27d6f10f5ba354326530d237d9d9066c2af6b238"
229
+ },
230
+ "code_repair/transfer/vendor/jepa-anything-core/src/jepa_anything_core/baselines.py": {
231
+ "bytes": 3372,
232
+ "sha256": "0df0524c1146ebfa19c0ac4991ca3fb48bd778473f9c9439bee6001bb16bf41c"
233
+ },
234
+ "code_repair/transfer/vendor/jepa-anything-core/src/jepa_anything_core/opf.py": {
235
+ "bytes": 3554,
236
+ "sha256": "f0fd479d0f72e26d0adff9621e4494343df3256f4cdeace4f6a173d6ebb0501d"
237
+ },
238
+ "code_repair/transfer/vendor/lcb/LICENSE": {
239
+ "bytes": 1070,
240
+ "sha256": "104099948b78ebc36f2e951b3a7973b956adfa7d39aaec0d1512f97a2686d15d"
241
+ },
242
+ "code_repair/transfer/vendor/lcb/testing_util.py": {
243
+ "bytes": 18276,
244
+ "sha256": "b7cb6a8a69807bb868150a61742e25d7bb5328bbe01d514471b6ec43c9fa9ed2"
245
+ },
246
+ "gui_interaction/README.md": {
247
+ "bytes": 2544,
248
+ "sha256": "2279d1b245ed0869b843f131b2a92b450be316751d37f88a8d0f99a284fa834b"
249
+ },
250
+ "gui_interaction/base_manifest.json": {
251
+ "bytes": 3376,
252
+ "sha256": "ecd50038bc116ea0e36cad406d8a8c2d76b646215ff5271e5dfe3d8cdc5effb1"
253
+ },
254
+ "gui_interaction/checkpoints/final/policy/adapter_config.json": {
255
+ "bytes": 569,
256
+ "sha256": "60ede01aeaf9f823c972cbc053a7fb7d9643d4e2b02f9e99bef5ff5d85c6f262"
257
+ },
258
+ "gui_interaction/checkpoints/final/policy/adapter_model.safetensors": {
259
+ "bytes": 40400200,
260
+ "sha256": "bd3c28813cdc81f8bf530815b418581eb8a14d470269392635439ab5da3951da"
261
+ },
262
+ "gui_interaction/checkpoints/final/policy/inference.json": {
263
+ "bytes": 263,
264
+ "sha256": "9df0ded3be6e2a3bc05facf06439244e5c9798b2171c55068a95a34dd05cbbf9"
265
+ },
266
+ "gui_interaction/checkpoints/final/world/gui_state.pt": {
267
+ "bytes": 4231627,
268
+ "sha256": "9480d5f780dc8b119a8871ee539a405fa3e4889c01e43c5b529bfc739ac56382"
269
+ },
270
+ "gui_interaction/checkpoints/final/world/inference.json": {
271
+ "bytes": 364,
272
+ "sha256": "36ae257be9fb869a2ea2368e63e685e73d7c4a36186bf036a7e42430182365ca"
273
+ },
274
+ "gui_interaction/checkpoints/final/world/online_lora/adapter_config.json": {
275
+ "bytes": 578,
276
+ "sha256": "a37338b235215141308275466d56e84de79da213fe808a73d95f4d9e2c745cc3"
277
+ },
278
+ "gui_interaction/checkpoints/final/world/online_lora/adapter_model.safetensors": {
279
+ "bytes": 29528024,
280
+ "sha256": "60dba2a203c6b6d37740e681c0f9dce6b1afb9230e80c4ead3df6f100e9b43ea"
281
+ },
282
+ "gui_interaction/controller_selected.json": {
283
+ "bytes": 81,
284
+ "sha256": "f3e227b1a72045fb74da5464148f54cb8b7464e3e3261fd49441752f39e3216d"
285
+ },
286
+ "gui_interaction/controller_world.json": {
287
+ "bytes": 84,
288
+ "sha256": "62422d39d21af38b95ffd1d6f3945a9b0d1515a05a4b70c4aeecf2dda6568100"
289
+ },
290
+ "gui_interaction/infer.py": {
291
+ "bytes": 1367,
292
+ "sha256": "add8fed0b0fbc1a20913f088c3547c88fcf1fedd1c3efaa3ec9ae8a70f663db1"
293
+ },
294
+ "gui_interaction/licenses/d3.LICENSE": {
295
+ "bytes": 1429,
296
+ "sha256": "cfbbc38bc63359f41eef41f92314754d6652fd1a17d016de344926d5de34b7d5"
297
+ },
298
+ "gui_interaction/licenses/jquery-ui.LICENSE": {
299
+ "bytes": 1817,
300
+ "sha256": "de33fb695880d0b07615d4b86f78cd43796906959ade5fdfef70968827a0db78"
301
+ },
302
+ "gui_interaction/licenses/jquery.LICENSE": {
303
+ "bytes": 1606,
304
+ "sha256": "f980a306a01e5881cc8004115f7e6dde44e7f5296477237d37d169a86ce7c094"
305
+ },
306
+ "gui_interaction/protocol.json": {
307
+ "bytes": 1663,
308
+ "sha256": "919a421ee03c8b6b6d25ce94a3683f7d594f86722b425db4645cb066e5784feb"
309
+ },
310
+ "gui_interaction/requirements.txt": {
311
+ "bytes": 159,
312
+ "sha256": "277dbc55ffe869bce349021ea5a67a093b74d908577d4330480cc015ad03a7b7"
313
+ },
314
+ "gui_interaction/src/common.py": {
315
+ "bytes": 2973,
316
+ "sha256": "7d754b17dd9ef1d739585b8abb2adfdb487f287f8ed2513cb8c3492273aeecd1"
317
+ },
318
+ "gui_interaction/src/experiment.py": {
319
+ "bytes": 7117,
320
+ "sha256": "ef73f6c2595ad32df365f4139e39890b607c0ce1a3fe94b2867cdf40564b334c"
321
+ },
322
+ "gui_interaction/src/gui_env.py": {
323
+ "bytes": 4063,
324
+ "sha256": "0661cb2c5a7a8dc95610d4766cd0323d8fc002bc2df27fea8601c9073ad949c6"
325
+ },
326
+ "gui_interaction/src/gui_world.py": {
327
+ "bytes": 5812,
328
+ "sha256": "fe98cb6dc1c24b803edaa10625237d4a16064d975946b4fd985f1daa10f37e85"
329
+ },
330
+ "gui_interaction/src/policy_service.py": {
331
+ "bytes": 5230,
332
+ "sha256": "1e6a6202abc05092903a334782eb1f5e48a4709459aa5eb8ea55faa1ccdcbfc1"
333
+ },
334
+ "gui_interaction/vendor/miniwob-plusplus/LICENSE": {
335
+ "bytes": 1222,
336
+ "sha256": "fd6529fb8f648d4130fd969e3d7fc740c9992a0bd94a1998f52555a873311511"
337
+ },
338
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/common/ui_utils.js": {
339
+ "bytes": 558,
340
+ "sha256": "9d604606165982f3d10db5c1485733eb0748022c1bf4b74509e345617f3ad283"
341
+ },
342
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/core.css": {
343
+ "bytes": 1582,
344
+ "sha256": "795f8e686125b71e89a21ffe9e03406c6498f1e135175ba63321f3051a720042"
345
+ },
346
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/core.js": {
347
+ "bytes": 21848,
348
+ "sha256": "d430c9768840bc8d35635a0eaf319513bbfbc4ceea7beddbc41f5398e0ca546d"
349
+ },
350
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/d3.v3.min.js": {
351
+ "bytes": 151665,
352
+ "sha256": "8ca4da6691fb142cd76283014e887e7c3e61e3b63eff9ebb08eeb5c51d56aafb"
353
+ },
354
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/external/jquery/jquery.js": {
355
+ "bytes": 293430,
356
+ "sha256": "430f36f9b5f21aae8cc9dca6a81c4d3d84da5175eaedcf2fdc2c226302cb3575"
357
+ },
358
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_444444_256x240.png": {
359
+ "bytes": 7006,
360
+ "sha256": "eaf7c7ee2747275dda6c53e731a10db1a7b15f4fbb46e1b69d6bb2056bc9fd81"
361
+ },
362
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_555555_256x240.png": {
363
+ "bytes": 7074,
364
+ "sha256": "5d04051dfd9d2d740355404f98a683d1ec0feb2fca7d76e533c1a6e5ce92dd2e"
365
+ },
366
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_777620_256x240.png": {
367
+ "bytes": 4676,
368
+ "sha256": "9dbe4a0d03feed6f65eb2560a0a8b4ba4264545ee8fd31c1763a3b219d0328d6"
369
+ },
370
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_777777_256x240.png": {
371
+ "bytes": 7013,
372
+ "sha256": "e75b27211e16fcf94715168001bb7055ca376d46f928110ba3d0825232452e5a"
373
+ },
374
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_cc0000_256x240.png": {
375
+ "bytes": 4632,
376
+ "sha256": "02891575d4358e9edde3e42d94057f8e9f82a9d64376f71ee86cef149d30537e"
377
+ },
378
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/images/ui-icons_ffffff_256x240.png": {
379
+ "bytes": 6313,
380
+ "sha256": "b6b06deef2b924cc3835d63f4883d47882734a33e71b212d917a68cede3b8e9d"
381
+ },
382
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/jquery-ui.min.css": {
383
+ "bytes": 32076,
384
+ "sha256": "ac1c8f94750b39b12327a5d0c56fdf946dabfb6d91e5d2a202879ff9a5d67e29"
385
+ },
386
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/core/jquery-ui/jquery-ui.min.js": {
387
+ "bytes": 253669,
388
+ "sha256": "28ce75d953678c4942df47a11707a15e3c756021cf89090e3e6aa7ad6b6971c3"
389
+ },
390
+ "gui_interaction/vendor/miniwob-plusplus/miniwob/html/miniwob/click-checkboxes.html": {
391
+ "bytes": 1973,
392
+ "sha256": "b799bd1749dd603029e7479c56efceb38a425af47c04267fe46f6d7a64ac1895"
393
+ },
394
+ "gui_interaction/world_core/src/artifacts.py": {
395
+ "bytes": 648,
396
+ "sha256": "e0911ccb1215c66106be9f9b57b91642ac7c1878b889205adaca144c2ec36b7b"
397
+ },
398
+ "gui_interaction/world_core/src/world.py": {
399
+ "bytes": 5171,
400
+ "sha256": "6878cee06e0d69ac535abbdd2deab0ae375ef8a0511af0bedd03dc0699b66149"
401
+ },
402
+ "gui_interaction/world_core/vendor/JEPA-Anything/LICENSE": {
403
+ "bytes": 10771,
404
+ "sha256": "956f9000f7a82cc5d997e72bd0134aa465bf6ab5e4686f7f3da38dd7ac310af0"
405
+ },
406
+ "gui_interaction/world_core/vendor/JEPA-Anything/jepa-anything-core/LICENSE": {
407
+ "bytes": 11358,
408
+ "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
409
+ },
410
+ "gui_interaction/world_core/vendor/JEPA-Anything/jepa-anything-core/src/jepa_anything_core/__init__.py": {
411
+ "bytes": 113,
412
+ "sha256": "68590deed525b0197737ca2d27d6f10f5ba354326530d237d9d9066c2af6b238"
413
+ },
414
+ "gui_interaction/world_core/vendor/JEPA-Anything/jepa-anything-core/src/jepa_anything_core/baselines.py": {
415
+ "bytes": 3372,
416
+ "sha256": "0df0524c1146ebfa19c0ac4991ca3fb48bd778473f9c9439bee6001bb16bf41c"
417
+ },
418
+ "gui_interaction/world_core/vendor/JEPA-Anything/jepa-anything-core/src/jepa_anything_core/opf.py": {
419
+ "bytes": 3554,
420
+ "sha256": "f0fd479d0f72e26d0adff9621e4494343df3256f4cdeace4f6a173d6ebb0501d"
421
+ },
422
+ "immune_science/README.md": {
423
+ "bytes": 847,
424
+ "sha256": "59a1a18d88cbf2b53022e1cd7faf8e92d3982abaf2d8cdb439c48289908537f5"
425
+ },
426
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/.gitattributes": {
427
+ "bytes": 2504,
428
+ "sha256": "9e75dd981de037ec3769f24f790e126bc5a160b6871f510214e68dc70649aeeb"
429
+ },
430
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/COPY_METADATA.json": {
431
+ "bytes": 2117,
432
+ "sha256": "4de6c4d87947435f802a8785083a16b90161bf305452e79240ca69a5c579fddc"
433
+ },
434
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/README.md": {
435
+ "bytes": 9766,
436
+ "sha256": "e8c74b011eeef08cb70c904ed95e1c6fb519d7a86b9a8731edff59331862fb43"
437
+ },
438
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/assets/figure2_pipeline.png": {
439
+ "bytes": 1275346,
440
+ "sha256": "2153bf1bb6b1ae1a2f7d2f8394a15e2a23685b97b4763254ea0fc1c816d8053d"
441
+ },
442
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/assets/figure3_agent.png": {
443
+ "bytes": 472735,
444
+ "sha256": "86e79e1489830c5cdcbbeb47d6b5a51ad33fab83840b065b441e9e840773d21a"
445
+ },
446
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/assets/terser.png": {
447
+ "bytes": 6523644,
448
+ "sha256": "b5d9ced44d7842e5b6737e2d1f18f4f9893242befbec506598f881b8eb46331a"
449
+ },
450
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/data/test-00000-of-00001.parquet": {
451
+ "bytes": 36479690,
452
+ "sha256": "8eda80dc10e8d22657667ca738813b31418ff64eecaf56823c02e1ded8873222"
453
+ },
454
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/data/train-00000-of-00002.parquet": {
455
+ "bytes": 275521988,
456
+ "sha256": "3b1d891ddd029759061214191a901e3bddb625064af84e4be51682a6415577ad"
457
+ },
458
+ "laboratory_planning/LabHorizon-3D-Asset-Perception/data/train-00001-of-00002.parquet": {
459
+ "bytes": 270794618,
460
+ "sha256": "3346201bc7a65135cc0a90f45ccf399f77221162213a59259e664836a8ad8de7"
461
+ },
462
+ "laboratory_planning/README.md": {
463
+ "bytes": 6268,
464
+ "sha256": "ec3180f65e4daaec0031d503105db8ec2083cebd3e2527d79a00ce0d0e213fba"
465
+ },
466
+ "laboratory_planning/checkpoints/seed1401/config.json": {
467
+ "bytes": 28528,
468
+ "sha256": "0106d57600d9ea86f486bf69015245125620319f762a5fbafa25080585d574bb"
469
+ },
470
+ "laboratory_planning/checkpoints/seed1401/world.safetensors": {
471
+ "bytes": 1592352,
472
+ "sha256": "f18ef629e90467f38d999de2d555b12a772036af8b92f788877d8550e8615a64"
473
+ },
474
+ "laboratory_planning/checkpoints/seed1402/config.json": {
475
+ "bytes": 28561,
476
+ "sha256": "8f06988f0b0d8cfb6f0dead68a7b8415bbb24f450b721606d9fd39834ea88996"
477
+ },
478
+ "laboratory_planning/checkpoints/seed1402/world.safetensors": {
479
+ "bytes": 1592352,
480
+ "sha256": "81325038013905ed7708295d56b0cadfca86cd80a5e8a610907cb2ea937dcfba"
481
+ },
482
+ "laboratory_planning/checkpoints/seed1403/config.json": {
483
+ "bytes": 28483,
484
+ "sha256": "afbff60113ddc962ad84131c05df912abd5d3e72d45f45c45ceb61787cf35637"
485
+ },
486
+ "laboratory_planning/checkpoints/seed1403/world.safetensors": {
487
+ "bytes": 1592352,
488
+ "sha256": "22b46be00873f7486b0394ade3f38e1bbdbbeb15a3d5099023b4ff2af2f37a9a"
489
+ },
490
+ "laboratory_planning/infer.py": {
491
+ "bytes": 1689,
492
+ "sha256": "6b1ab0d16c9642c711cc2b230abc78fc15eaf74711205317b819edf9b742f91c"
493
+ },
494
+ "laboratory_planning/licenses/JEPA-Anything.LICENSE": {
495
+ "bytes": 11358,
496
+ "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
497
+ },
498
+ "laboratory_planning/licenses/LabHorizon-parser.LICENSE": {
499
+ "bytes": 1064,
500
+ "sha256": "50a10ce443898c39ba1abce5e424142b3c66f00d5bf02487bf7f669048077cad"
501
+ },
502
+ "laboratory_planning/requirements.txt": {
503
+ "bytes": 45,
504
+ "sha256": "b7a9419ead27cdeb4cd65285367db323e9d5c7b66ad9f1d9af10fa85251180e0"
505
+ },
506
+ "laboratory_planning/src/features.py": {
507
+ "bytes": 3833,
508
+ "sha256": "548cd2bd1e480729e69107b9cf5b4b518a1d7906c88eae5117617a1145084eb4"
509
+ },
510
+ "laboratory_planning/src/jepa_anything_core/__init__.py": {
511
+ "bytes": 44,
512
+ "sha256": "1f1dc7944f46bf1e8183ac980436daa222f040a00fd512be42025356c67c756d"
513
+ },
514
+ "laboratory_planning/src/jepa_anything_core/opf.py": {
515
+ "bytes": 3633,
516
+ "sha256": "6689c24acf0e8be54b272b049d2899dfbde24e61cb0fb20a8d0ccf5bdcb17853"
517
+ },
518
+ "laboratory_planning/src/plan_schema.py": {
519
+ "bytes": 5053,
520
+ "sha256": "b89c766fc127d2ebb48831f5ffa534c3e527181290a6e6665b502b2b322aab4c"
521
+ },
522
+ "laboratory_planning/src/world.py": {
523
+ "bytes": 5194,
524
+ "sha256": "7a9a1cd83a04effeeabfda100f09fc7da356789e266269189505932b50d2668f"
525
+ },
526
+ "reaction_optimization/README.md": {
527
+ "bytes": 4295,
528
+ "sha256": "e385b05dfa7ae30f9b20869ea1e101942a5bcf46a60ff8e378de8028055c5dbd"
529
+ },
530
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/config.json": {
531
+ "bytes": 2083,
532
+ "sha256": "ae2ce6b52f5f99b3a7ed87ba8317e857c6bc5071e6a2f7a62826ec7fdaaa831a"
533
+ },
534
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/inference_config.json": {
535
+ "bytes": 427,
536
+ "sha256": "afb0a71282429009d9f53958aeeb57bed919679232d90dc8653e3992752809d7"
537
+ },
538
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/tokenizer/special_tokens_map.json": {
539
+ "bytes": 2592,
540
+ "sha256": "aa219f552e23a80ffb1fad73e7a60deba518b122df88b9a2e619491b1bbba80d"
541
+ },
542
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/tokenizer/tokenizer.json": {
543
+ "bytes": 36598,
544
+ "sha256": "486a79883b7b07e23cff5a3a678701a7a174a3f99c327769b99101a29444c035"
545
+ },
546
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/tokenizer/tokenizer_config.json": {
547
+ "bytes": 28790,
548
+ "sha256": "217c7fe97affbbdc50f0c0bf64e1cce880521626d4cc8cc8483422f14071d7e3"
549
+ },
550
+ "reaction_optimization/checkpoints/reactiont5_jepa_yield/world.safetensors": {
551
+ "bytes": 807244044,
552
+ "sha256": "fd1b4a669ad5c433212fcd4ad474682b529655f62fdb0a0ab9b933be94216ffe"
553
+ },
554
+ "reaction_optimization/infer.py": {
555
+ "bytes": 2066,
556
+ "sha256": "a54bbf56b6be9fd3c7581a070ab3fab90a573435457654a4bb9b7a8fc33ea356"
557
+ },
558
+ "reaction_optimization/licenses/JEPA-Anything-LICENSE": {
559
+ "bytes": 11358,
560
+ "sha256": "c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c"
561
+ },
562
+ "reaction_optimization/licenses/ReactionT5v2-LICENSE.txt": {
563
+ "bytes": 1071,
564
+ "sha256": "3d4dc7cd14e0c54788a357430cb3deb8295f881fc6ef852d8ba1409adf87c274"
565
+ },
566
+ "reaction_optimization/requirements.txt": {
567
+ "bytes": 102,
568
+ "sha256": "3137b7bc842f88313cf416bf5570f531cf051d69d8848fdc4594fa8de599c454"
569
+ },
570
+ "reaction_optimization/src/__init__.py": {
571
+ "bytes": 37,
572
+ "sha256": "f989582e0c3d4045c3bc884fcaf54be34cb1871e7393026ad3dd5205f9d8867a"
573
+ },
574
+ "reaction_optimization/src/jepa_core/__init__.py": {
575
+ "bytes": 31,
576
+ "sha256": "86c015670b36d53a4bddb08ca7b5e5be05d4438e48fc32a14d187b8f4abe2912"
577
+ },
578
+ "reaction_optimization/src/jepa_core/opf.py": {
579
+ "bytes": 3125,
580
+ "sha256": "5c18d27b81ca07ccdd1227f9a538c99d3d7f700ac2f382185a271c5aca9a4c22"
581
+ },
582
+ "reaction_optimization/src/reactiont5_jepa.py": {
583
+ "bytes": 3359,
584
+ "sha256": "0c226df6f430fa41f5abdd42f4c1966765656a6fd5f650974c388baad3e12833"
585
+ },
586
+ "reaction_optimization/src/reactiont5_model.py": {
587
+ "bytes": 1679,
588
+ "sha256": "b519333fb32052da669b32c36855a61f8de2e9a567fb2080a947d8bb080f1cb1"
589
+ },
590
+ "reaction_optimization/src/yield_predictor.py": {
591
+ "bytes": 3551,
592
+ "sha256": "45e7583c325079d3ccf3a260e42e2055c6bed8097b34f9a06f47b2a0f63d3612"
593
+ }
594
+ }
MODEL_INDEX.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backbone_directory": {
3
+ "environment_variable": "RSI_BASE_MODELS_DIR",
4
+ "default": "~/.cache/rsi_anything/base_models"
5
+ },
6
+ "backbones": {
7
+ "ReasonFlux-Coder-7B": {
8
+ "repo_id": "Gen-Verse/ReasonFlux-Coder-7B",
9
+ "download_url": "https://huggingface.co/Gen-Verse/ReasonFlux-Coder-7B",
10
+ "revision": "6860a2fd222bd2e18e8a5b62a9c0887d2ba70c36"
11
+ },
12
+ "Qwen2.5-Coder-3B-Instruct": {
13
+ "repo_id": "Qwen/Qwen2.5-Coder-3B-Instruct",
14
+ "download_url": "https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct",
15
+ "revision": "488639f1ff808d1d3d0ba301aef8c11461451ec5"
16
+ }
17
+ },
18
+ "code_repair": {
19
+ "policy": "ReasonFlux-Coder-7B",
20
+ "encoder": "Qwen2.5-Coder-3B-Instruct",
21
+ "models": [
22
+ "code_repair/checkpoints/codecontests_final",
23
+ "code_repair/checkpoints/transfer_final"
24
+ ],
25
+ "entry": "code_repair/infer.py"
26
+ },
27
+ "gui_interaction": {
28
+ "policy": "ReasonFlux-Coder-7B",
29
+ "encoder": "Qwen2.5-Coder-3B-Instruct",
30
+ "models": [
31
+ "gui_interaction/checkpoints/final/policy",
32
+ "gui_interaction/checkpoints/final/world"
33
+ ],
34
+ "entry": "gui_interaction/infer.py"
35
+ },
36
+ "laboratory_planning": {
37
+ "model_type": "opf_jepa_laboratory_outcome_ensemble",
38
+ "world_models": [
39
+ "laboratory_planning/checkpoints/seed1401",
40
+ "laboratory_planning/checkpoints/seed1402",
41
+ "laboratory_planning/checkpoints/seed1403"
42
+ ],
43
+ "entry": "laboratory_planning/infer.py",
44
+ "input": "task_and_four_candidate_plans",
45
+ "device": "cpu"
46
+ },
47
+ "reaction_optimization": {
48
+ "model_type": "reactiont5_jepa_reaction_yield",
49
+ "world_model": "reaction_optimization/checkpoints/reactiont5_jepa_yield",
50
+ "entry": "reaction_optimization/infer.py",
51
+ "input": "reaction_smiles_csv_or_json",
52
+ "devices": [
53
+ "cpu",
54
+ "cuda"
55
+ ]
56
+ },
57
+ "immune_science": {
58
+ "status": "planned"
59
+ }
60
+ }
NOTICE ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ RSI-Anything
2
+ Copyright 2026 RSI-Anything contributors.
3
+
4
+ Project-owned inference code is licensed under Apache-2.0.
5
+
6
+ This collection includes JEPA-Anything core, APPS and LiveCodeBench execution
7
+ utilities, and MiniWoB++ interface resources, including D3, jQuery and jQuery UI.
8
+ Their original copyright and license materials are retained.
9
+ See THIRD_PARTY_NOTICES.md for component locations and model terms.
10
+
11
+ Built with Qwen. Model weights and adapters retain their upstream and
12
+ base-model terms, including the Qwen Research License for the 3B backbone.
13
+
14
+ Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved.
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ configs:
3
+ - config_name: labhorizon_3d_asset_perception
4
+ data_files:
5
+ - split: train
6
+ path: laboratory_planning/LabHorizon-3D-Asset-Perception/data/train-*.parquet
7
+ - split: test
8
+ path: laboratory_planning/LabHorizon-3D-Asset-Perception/data/test-*.parquet
9
+ ---
10
+
11
+ <div align="center">
12
+
13
+ # RSI-Anything
14
+ ### Domain-General World Models for Recursive Self-Improvement across Domains
15
+
16
+ Predict outcomes · Guide actions · Improve decisions
17
+
18
+ </div>
19
+
20
+ RSI-Anything connects world-model predictions, action selection, and external feedback to improve agents across computational and scientific tasks. Built on JEPA-Anything, it brings a shared improvement process to domains with different observations, actions, and evaluation criteria.
21
+
22
+ A policy proposes candidate actions, and a world model anticipates their consequences. Selected actions receive external feedback, which informs subsequent decisions and supports improvements retained across recursive iterations. This collection brings together the resulting inference resources and final checkpoints.
23
+
24
+ ## Domains at a glance
25
+
26
+ | Domain | Task focus | Guide |
27
+ | --- | --- | --- |
28
+ | **Code repair** | Turn task requirements and execution feedback into correct programs. | [Code repair](code_repair/README.md) |
29
+ | **GUI interaction** | Translate user instructions and interface observations into successful action sequences. | [GUI interaction](gui_interaction/README.md) |
30
+ | **Laboratory planning** | Compose laboratory operations into plans that satisfy experimental goals and constraints. | [Laboratory planning](laboratory_planning/README.md) |
31
+ | **Reaction optimization** | Predict reaction outcomes from molecular inputs and candidate experimental conditions. | [Reaction optimization](reaction_optimization/README.md) |
32
+ | **Immune science** | Forecast intervention effects and use biological evidence to prioritize scientific hypotheses. | [Immune science](immune_science/README.md) |
33
+
34
+ ## Tasks
35
+
36
+ ### Code repair
37
+
38
+ The agent receives a programming objective, a current implementation, and observed execution feedback. Its task is to produce a program that satisfies the specification while resolving errors exposed by the available tests. Candidate actions are complete solutions or revisions to the current program.
39
+
40
+ A world model predicts how each candidate is likely to behave, helping select which program to execute next. Execution returns concrete feedback, such as incorrect outputs or runtime errors, that guides further refinement. The output is a final program together with a record of the selected revisions and their observed behavior.
41
+
42
+ ### GUI interaction
43
+
44
+ The agent receives a natural-language instruction and observes the current interface state. It chooses a sequence of actions, such as clicking controls, changing selections, and submitting forms, to complete the user's request. Each action can change both the visible interface and the remaining steps needed to finish the task.
45
+
46
+ The policy proposes actions from the current observation, while the world model predicts their consequences and likelihood of task completion. Interaction feedback reveals the next interface state and whether the goal has been achieved. The resulting action sequence is evaluated by successful completion and the number of actions used.
47
+
48
+ ### Laboratory planning
49
+
50
+ The agent receives an experimental objective, a laboratory context, available materials, operational constraints, and a library of permitted actions. It connects these actions into a coherent procedure, choosing an appropriate order and passing the outputs of earlier operations into later ones.
51
+
52
+ A successful plan reaches the experimental goal while respecting action signatures, resource availability, and procedural constraints. The world model reads the task and candidate procedures, predicts their quality and relative improvement, and estimates the risk of a worse outcome. These forecasts guide selection among structurally valid plans. Task evaluation provides feedback on whether the selected procedure achieves the requested outcome.
53
+
54
+ The collection also includes [LabHorizon Level 1 3D Asset Perception](laboratory_planning/LabHorizon-3D-Asset-Perception/README.md), with 3,000 training and 200 test examples. Load it with the `labhorizon_3d_asset_perception` dataset configuration; [usage](laboratory_planning/README.md#labhorizon-level-1-3d-asset-perception).
55
+
56
+ ### Reaction optimization
57
+
58
+ The world model receives a chemical reaction specification, including reactants, reagents, catalysts, and an intended product. It predicts the expected reaction yield, providing a way to compare candidate conditions before experimental evaluation.
59
+
60
+ A JEPA model encodes the molecular inputs, predicts a latent reaction state, and maps that state to a yield estimate. The output pairs each reaction specification with its predicted outcome, supporting condition comparison and planning in an experimental workflow.
61
+
62
+ ### Immune science
63
+
64
+ This domain connects immune-state forecasting with intervention analysis and scientific hypothesis generation. Inputs describe cellular, tissue, and individual immune contexts together with proposed interventions, such as cytokine changes, genetic perturbations, or candidate therapies.
65
+
66
+ An action-conditioned world model predicts how these interventions may change immune states and biological readouts. An analysis agent combines the forecasts with experimental evidence to compare interventions, revise interpretations, and prioritize hypotheses for further investigation. Scientific-agent workflow evolution supports the construction and refinement of this predictive analysis process.
67
+
68
+ ## Getting started
69
+
70
+ Each domain guide describes its inference resources and usage. Open the guide for the task you want to run; the [backbone download guide](./_base_models/README.md) provides the upstream models used by code repair and GUI interaction.
71
+
72
+ The local inference examples run from this collection's root directory. The language-model entry points use Linux and CUDA-enabled PyTorch. Create a separate environment using the Python version and pinned dependencies in the relevant domain guide. Set paths for prepared task inputs and generated outputs:
73
+
74
+ ```bash
75
+ cd RSI-Anything-Inference
76
+ export RSI_BASE_MODELS_DIR="$HOME/.cache/rsi_anything/base_models"
77
+ export INPUT_DIR=/path/to/inputs
78
+ export OUTPUT_DIR=/path/to/outputs
79
+ mkdir -p "$OUTPUT_DIR"
80
+ ```
81
+
82
+ Download the required backbone models to `RSI_BASE_MODELS_DIR` using the [download guide](./_base_models/README.md). The default location is `~/.cache/rsi_anything/base_models`. Code repair and GUI interaction load the downloaded backbones with their local adapters and predictive heads. Laboratory planning and reaction optimization load their local world-model checkpoints and predictive resources directly. Entry points save predictions to the supplied output paths.
83
+
84
+ ## Collection layout
85
+
86
+ ```text
87
+ RSI-Anything-Inference/
88
+ ├── README.md
89
+ ├── LICENSE
90
+ ├── THIRD_PARTY_NOTICES.md
91
+ ├── MODEL_INDEX.json
92
+ ├── MANIFEST.json
93
+ ├── _base_models/ # Backbone download guide and model licenses
94
+ ├── code_repair/ # Program generation and revision
95
+ ├── gui_interaction/ # Instruction-guided interface actions
96
+ ├── laboratory_planning/ # World-model forecasts for experimental plans
97
+ ├── reaction_optimization/ # Reaction yield prediction with a JEPA world model
98
+ └── immune_science/ # Immune intervention analysis
99
+ ```
100
+
101
+ [MODEL_INDEX.json](MODEL_INDEX.json) maps domains to inference entry points and checkpoints. [MANIFEST.json](MANIFEST.json) records file sizes and checksums.
102
+
103
+ Project code is released under [Apache-2.0](LICENSE). Model and component terms are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
104
+
105
+ ## Contact and collaboration
106
+
107
+ RSI-Anything is under active development. We welcome collaboration on new domains, world models, evaluation tasks, and applications of recursive self-improvement. New methods, experiments, and checkpoints will be shared as the project develops. For collaboration or project questions, contact [cty21@tsinghua.org.cn](mailto:cty21@tsinghua.org.cn).
THIRD_PARTY_NOTICES.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Licenses and attribution
2
+
3
+ Project-owned RSI-Anything inference code is licensed under [Apache-2.0](LICENSE). Built with Qwen. Model weights and adapters retain the applicable upstream and base-model terms.
4
+
5
+ ## Models
6
+
7
+ | Component | Terms | Included materials |
8
+ | --- | --- | --- |
9
+ | ReasonFlux-Coder-7B | MIT, as declared in its upstream model card; its Qwen2.5-7B-Instruct base uses Apache-2.0. | [Original model card](_base_models/ReasonFlux-Coder-7B/README.md), [base-model license](_base_models/ReasonFlux-Coder-7B/BASE_MODEL_LICENSE). |
10
+ | Qwen2.5-Coder-3B-Instruct and derived world-model adapters | Qwen Research License. | [Original license](_base_models/Qwen2.5-Coder-3B-Instruct/LICENSE), [required attribution](_base_models/Qwen2.5-Coder-3B-Instruct/NOTICE). |
11
+ | ReactionT5v2-derived JEPA yield world model | MIT upstream model terms. | [Original license](reaction_optimization/licenses/ReactionT5v2-LICENSE.txt). |
12
+
13
+ The Qwen Research License covers non-commercial research and evaluation; commercial use requires a separate grant from its licensor.
14
+
15
+ ## Code and task resources
16
+
17
+ | Component | Terms | Included materials |
18
+ | --- | --- | --- |
19
+ | JEPA-Anything core | Apache-2.0. | [Code repair core](code_repair/codecontests/vendor/jepa-anything-core/LICENSE), [transfer core](code_repair/transfer/vendor/jepa-anything-core/LICENSE), [GUI core](gui_interaction/world_core/vendor/JEPA-Anything/jepa-anything-core/LICENSE), [laboratory core](laboratory_planning/licenses/JEPA-Anything.LICENSE), [reaction core](reaction_optimization/licenses/JEPA-Anything-LICENSE). |
20
+ | JEPA-Anything GUI dependencies | Apache-2.0. | [Original license](gui_interaction/world_core/vendor/JEPA-Anything/LICENSE). |
21
+ | ReactionT5v2 inference architecture | MIT. | [Original license](reaction_optimization/licenses/ReactionT5v2-LICENSE.txt). |
22
+ | Laboratory plan parser | MIT. | [Original license](laboratory_planning/licenses/LabHorizon-parser.LICENSE). |
23
+ | APPS execution utilities | MIT. | [Original license](code_repair/transfer/vendor/apps/LICENSE). |
24
+ | LiveCodeBench execution utilities | MIT. | [Original license](code_repair/transfer/vendor/lcb/LICENSE). |
25
+ | MiniWoB++ interface resources | MIT. | [Original license](gui_interaction/vendor/miniwob-plusplus/LICENSE). |
26
+ | D3 3.5.12 | BSD-3-Clause. | [Original license](gui_interaction/licenses/d3.LICENSE). |
27
+ | jQuery 1.12.4 | MIT. | [Original license](gui_interaction/licenses/jquery.LICENSE). |
28
+ | jQuery UI 1.12.1 | MIT. | [Original license](gui_interaction/licenses/jquery-ui.LICENSE). |
29
+
30
+ Original copyright headers in the bundled browser resources are retained. The D3 and jQuery licenses correspond to the versions supplied with the task interface.
31
+
32
+ ## Upstream sources
33
+
34
+ - [ReactionT5v2-yield model card](https://huggingface.co/sagawa/ReactionT5v2-yield)
35
+ - [ReactionT5v2](https://github.com/sagawatatsuya/ReactionT5v2)
36
+
37
+ - [ReasonFlux-Coder-7B model card](https://huggingface.co/Gen-Verse/ReasonFlux-Coder-7B/blob/6860a2fd222bd2e18e8a5b62a9c0887d2ba70c36/README.md)
38
+ - [Qwen2.5-7B-Instruct license](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/a09a35458c702b33eeacc393d103063234e8bc28/LICENSE)
39
+ - [ReasonFlux base-model description](https://arxiv.org/html/2506.03136#S4.SS1.SSS2)
40
+ - [Qwen2.5-Coder-3B-Instruct license](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct/blob/488639f1ff808d1d3d0ba301aef8c11461451ec5/LICENSE)
41
+ - [JEPA-Anything](https://github.com/Gen-Verse/JEPA-Anything)
42
+ - [APPS](https://github.com/hendrycks/apps)
43
+ - [LiveCodeBench](https://github.com/LiveCodeBench/LiveCodeBench)
44
+ - [MiniWoB++](https://github.com/Farama-Foundation/miniwob-plusplus)
45
+ - [D3 3.5.12 license](https://github.com/d3/d3/blob/v3.5.12/LICENSE)
46
+ - [jQuery 1.12.4 license](https://github.com/jquery/jquery/blob/1.12.4/LICENSE.txt)
47
+ - [jQuery UI 1.12.1 license](https://github.com/jquery/jquery-ui/blob/1.12.1/LICENSE.txt)
_base_models/Qwen2.5-Coder-3B-Instruct/LICENSE ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Qwen RESEARCH LICENSE AGREEMENT
2
+
3
+ Qwen RESEARCH LICENSE AGREEMENT Release Date: September 19, 2024
4
+
5
+ By clicking to agree or by using or distributing any portion or element of the Qwen Materials, you will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately.
6
+
7
+ 1. Definitions
8
+ a. This Qwen RESEARCH LICENSE AGREEMENT (this "Agreement") shall mean the terms and conditions for use, reproduction, distribution and modification of the Materials as defined by this Agreement.
9
+ b. "We" (or "Us") shall mean Alibaba Cloud.
10
+ c. "You" (or "Your") shall mean a natural person or legal entity exercising the rights granted by this Agreement and/or using the Materials for any purpose and in any field of use.
11
+ d. "Third Parties" shall mean individuals or legal entities that are not under common control with us or you.
12
+ e. "Qwen" shall mean the large language models, and software and algorithms, consisting of trained model weights, parameters (including optimizer states), machine-learning model code, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by us.
13
+ f. "Materials" shall mean, collectively, Alibaba Cloud's proprietary Qwen and Documentation (and any portion thereof) made available under this Agreement.
14
+ g. "Source" form shall mean the preferred form for making modifications, including but not limited to model source code, documentation source, and configuration files.
15
+ h. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
16
+ i. "Non-Commercial" shall mean for research or evaluation purposes only.
17
+
18
+ 2. Grant of Rights
19
+ a. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Alibaba Cloud's intellectual property or other rights owned by us embodied in the Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Materials FOR NON-COMMERCIAL PURPOSES ONLY.
20
+ b. If you are commercially using the Materials, you shall request a license from us.
21
+
22
+ 3. Redistribution
23
+ You may distribute copies or make the Materials, or derivative works thereof, available as part of a product or service that contains any of them, with or without modifications, and in Source or Object form, provided that you meet the following conditions:
24
+ a. You shall give any other recipients of the Materials or derivative works a copy of this Agreement;
25
+ b. You shall cause any modified files to carry prominent notices stating that you changed the files;
26
+ c. You shall retain in all copies of the Materials that you distribute the following attribution notices within a "Notice" text file distributed as a part of such copies: "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved."; and
27
+ d. You may add your own copyright statement to your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of your modifications, or for any such derivative works as a whole, provided your use, reproduction, and distribution of the work otherwise complies with the terms and conditions of this Agreement.
28
+
29
+ 4. Rules of use
30
+ a. The Materials may be subject to export controls or restrictions in China, the United States or other countries or regions. You shall comply with applicable laws and regulations in your use of the Materials.
31
+ b. If you use the Materials or any outputs or results therefrom to create, train, fine-tune, or improve an AI model that is distributed or made available, you shall prominently display “Built with Qwen” or “Improved using Qwen” in the related product documentation.
32
+
33
+ 5. Intellectual Property
34
+ a. We retain ownership of all intellectual property rights in and to the Materials and derivatives made by or for us. Conditioned upon compliance with the terms and conditions of this Agreement, with respect to any derivative works and modifications of the Materials that are made by you, you are and will be the owner of such derivative works and modifications.
35
+ b. No trademark license is granted to use the trade names, trademarks, service marks, or product names of us, except as required to fulfill notice requirements under this Agreement or as required for reasonable and customary use in describing and redistributing the Materials.
36
+ c. If you commence a lawsuit or other proceedings (including a cross-claim or counterclaim in a lawsuit) against us or any entity alleging that the Materials or any output therefrom, or any part of the foregoing, infringe any intellectual property or other right owned or licensable by you, then all licenses granted to you under this Agreement shall terminate as of the date such lawsuit or other proceeding is commenced or brought.
37
+
38
+ 6. Disclaimer of Warranty and Limitation of Liability
39
+ a. We are not obligated to support, update, provide training for, or develop any further version of the Qwen Materials or to grant any license thereto.
40
+ b. THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. WE MAKE NO WARRANTY AND ASSUME NO RESPONSIBILITY FOR THE SAFETY OR STABILITY OF THE MATERIALS AND ANY OUTPUT THEREFROM.
41
+ c. IN NO EVENT SHALL WE BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE MATERIALS OR ANY OUTPUT OF IT, NO MATTER HOW IT’S CAUSED.
42
+ d. You will defend, indemnify and hold harmless us from and against any claim by any third party arising out of or related to your use or distribution of the Materials.
43
+
44
+ 7. Survival and Termination.
45
+ a. The term of this Agreement shall commence upon your acceptance of this Agreement or access to the Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein.
46
+ b. We may terminate this Agreement if you breach any of the terms or conditions of this Agreement. Upon termination of this Agreement, you must delete and cease use of the Materials. Sections 6 and 8 shall survive the termination of this Agreement.
47
+
48
+ 8. Governing Law and Jurisdiction.
49
+ a. This Agreement and any dispute arising out of or relating to it will be governed by the laws of China, without regard to conflict of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
50
+ b. The People's Courts in Hangzhou City shall have exclusive jurisdiction over any dispute arising out of this Agreement.
51
+
52
+ 9. Other Terms and Conditions.
53
+ a. Any arrangements, understandings, or agreements regarding the Material not stated herein are separate from and independent of the terms and conditions of this Agreement. You shall request a separate license from us, if you use the Materials in ways not expressly agreed to in this Agreement.
54
+ b. We shall not be bound by any additional or different terms or conditions communicated by you unless expressly agreed.
_base_models/Qwen2.5-Coder-3B-Instruct/NOTICE ADDED
@@ -0,0 +1 @@
 
 
1
+ Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved.
_base_models/README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Backbone Models
2
+
3
+ Code repair and GUI interaction use task-specific checkpoints with upstream backbone models. Download those backbones and keep them in a shared model directory outside this collection.
4
+
5
+ | Model and download | Used by | Role |
6
+ | --- | --- | --- |
7
+ | [ReasonFlux-Coder-7B](https://huggingface.co/Gen-Verse/ReasonFlux-Coder-7B) | [Code repair](../code_repair/README.md), [GUI interaction](../gui_interaction/README.md) | Program generation and action proposal. |
8
+ | [Qwen2.5-Coder-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct) | [Code repair](../code_repair/README.md), [GUI interaction](../gui_interaction/README.md) | Encoding backbone for the JEPA world models. |
9
+
10
+ ## Download
11
+
12
+ After installing the code-repair or GUI requirements, use the `hf` command to download its required models. These commands select the versions used with the released checkpoints:
13
+
14
+ ```bash
15
+ export RSI_BASE_MODELS_DIR="$HOME/.cache/rsi_anything/base_models"
16
+ mkdir -p "$RSI_BASE_MODELS_DIR"
17
+
18
+ hf download Gen-Verse/ReasonFlux-Coder-7B \
19
+ --revision 6860a2fd222bd2e18e8a5b62a9c0887d2ba70c36 \
20
+ --local-dir "$RSI_BASE_MODELS_DIR/ReasonFlux-Coder-7B"
21
+
22
+ hf download Qwen/Qwen2.5-Coder-3B-Instruct \
23
+ --revision 488639f1ff808d1d3d0ba301aef8c11461451ec5 \
24
+ --local-dir "$RSI_BASE_MODELS_DIR/Qwen2.5-Coder-3B-Instruct"
25
+ ```
26
+
27
+ Code repair and GUI interaction use both models. Laboratory planning loads its local JEPA world models directly. Reaction optimization loads its local ReactionT5 + JEPA yield world model directly. These entries support CPU inference; the reaction-yield model also supports CUDA.
28
+
29
+ ## Model paths
30
+
31
+ Entry points read `RSI_BASE_MODELS_DIR`, which defaults to `~/.cache/rsi_anything/base_models`. An existing model directory can be used by setting this variable to its parent folder. Keep the weights, configuration, and tokenizer together in each model folder:
32
+
33
+ ```text
34
+ $RSI_BASE_MODELS_DIR/
35
+ ├── ReasonFlux-Coder-7B/
36
+ └── Qwen2.5-Coder-3B-Instruct/
37
+ ```
38
+
39
+ Domain adapters and predictive heads remain in each task's `checkpoints/` folder and are loaded automatically. The `_base_models/` folder in this collection contains this guide and the original model license and attribution materials. See the [third-party notices](../THIRD_PARTY_NOTICES.md) for model terms and [MODEL_INDEX.json](../MODEL_INDEX.json) for the resource mapping.
40
+
41
+ [← Collection overview](../README.md)
_base_models/ReasonFlux-Coder-7B/BASE_MODEL_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 2024 Alibaba Cloud
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.
_base_models/ReasonFlux-Coder-7B/README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: transformers
4
+ ---
5
+
6
+ <p align="center">
7
+ <img src="https://github.com/yinjjiew/Data/raw/main/cure/overviewplot.png" width="100%"/>
8
+ </p>
9
+
10
+
11
+ <p align="center">
12
+ <img src="https://github.com/yinjjiew/Data/raw/main/cure/results.png" width="100%"/>
13
+ </p>
14
+
15
+
16
+
17
+
18
+
19
+ # Introduction to our ReasonFlux-Coders
20
+
21
+ We introduce **ReasonFlux-Coders**, trained with **CURE**, our algorithm for co-evolving an LLM's coding and unit test generation abilities.
22
+
23
+ * **ReasonFlux-Coder-7B** and **ReasonFlux-Coder-14B** outperform similarly sized Qwen Coders, DeepSeek Coders, and Seed-Coders, and naturally integrate into common test-time scaling and agentic coding pipelines.
24
+ * **ReasonFlux-Coder-4B** is our Long-CoT model, outperforming Qwen3-4B while achieving 64.8% efficiency in unit test generation. We have demonstrated its ability to serve as a reward model for training base models via reinforcement learning (see our [paper](https://arxiv.org/abs/2506.03136)).
25
+
26
+
27
+ [Paper](https://arxiv.org/abs/2506.03136) | [Code](https://github.com/Gen-Verse/CURE)
28
+
29
+ # Citation
30
+
31
+ ```
32
+ @article{wang2025cure,
33
+ title={Co-Evolving LLM Coder and Unit Tester via Reinforcement Learning},
34
+ author={Wang, Yinjie and Yang, Ling and Tian, Ye and Shen, Ke and Wang, Mengdi},
35
+ journal={arXiv preprint arXiv:2506.03136},
36
+ year={2025}
37
+ }
38
+ ```
code_repair/README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Code Repair
2
+
3
+ **Use predicted execution outcomes and observed test feedback to improve programs.**
4
+
5
+ The agent generates candidate solutions or revisions, predicts their likely behavior, and selects a program for execution. Feedback from that execution guides the next revision. This folder contains the final checkpoints and inference resources for CodeContests, APPS Introductory, and LiveCodeBench.
6
+
7
+ ## Code and usage
8
+
9
+ The implementation and usage guides are available on GitHub:
10
+
11
+ - [Source code and task guide](https://github.com/Gen-Verse/RSI-Anything/tree/main/tasks/code_repair)
12
+ - [Checkpoint evaluation guide](https://github.com/Gen-Verse/RSI-Anything/blob/main/docs/reproduction.en.md#evaluate-600-episodes-with-recorded-inputs)
13
+ - [Model and asset setup](https://github.com/Gen-Verse/RSI-Anything/blob/main/docs/assets.md)
14
+
15
+ ## Setup
16
+
17
+ Use Python 3.13 on Linux with CUDA. With Conda installed, run from the collection root:
18
+
19
+ ```bash
20
+ conda create -n rsi-code python=3.13 -y
21
+ conda activate rsi-code
22
+ python -m pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
23
+ python -m pip install -r code_repair/requirements.txt
24
+ ```
25
+
26
+ Program execution uses Linux namespaces, `mount`, `unshare`, and `runuser`, and runs submitted programs with `/usr/bin/python3`. On Ubuntu or Debian, install its system dependencies:
27
+
28
+ ```bash
29
+ sudo apt-get update
30
+ sudo apt-get install -y util-linux mount python3 python3-numpy
31
+ sudo runuser -u nobody -- unshare -Urn /usr/bin/python3 -I -c "import numpy; print(numpy.__version__)"
32
+ ```
33
+
34
+ Run inference with administrator privileges for the isolated program executor. The `--rank-only` mode scores supplied candidates from their recorded public feedback.
35
+
36
+ Download **ReasonFlux-Coder-7B** and **Qwen2.5-Coder-3B-Instruct** to `RSI_BASE_MODELS_DIR` using the [backbone download guide](../_base_models/README.md).
37
+
38
+ ## Task inputs
39
+
40
+ Provide one task object per line in a JSONL file. Each task contains `task_id`, `problem`, and `public_tests`. Each public test contains `test_id`, `input`, and `expected`; use the `public_` prefix for test IDs. For script tasks, `input` is standard input and `expected` is the expected standard output. The examples below are expanded for readability; save each object as a single JSONL line.
41
+
42
+ ### CodeContests
43
+
44
+ Use this format for `codecontests.jsonl`. `timeout` is the execution time limit in seconds and defaults to 3:
45
+
46
+ ```json
47
+ {
48
+ "task_id": "sum-example",
49
+ "problem": "Read two integers from standard input and print their sum.",
50
+ "public_tests": [
51
+ {
52
+ "test_id": "public_0",
53
+ "input": "2 3\n",
54
+ "expected": "5\n"
55
+ }
56
+ ],
57
+ "timeout": 3
58
+ }
59
+ ```
60
+
61
+ ### APPS Introductory and LiveCodeBench
62
+
63
+ Transfer tasks also contain `dataset`, `fn_name`, `starter_code`, and `timeout`. Set `dataset` to `apps` for APPS Introductory or `lcb` for LiveCodeBench. For script tasks, use empty strings for `fn_name` and `starter_code`:
64
+
65
+ ```json
66
+ {
67
+ "task_id": "apps-sum-example",
68
+ "dataset": "apps",
69
+ "problem": "Read two integers from standard input and print their sum.",
70
+ "fn_name": "",
71
+ "starter_code": "",
72
+ "timeout": 3,
73
+ "public_tests": [
74
+ {
75
+ "test_id": "public_0",
76
+ "input": "2 3\n",
77
+ "expected": "5\n"
78
+ }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ For callable tasks, set `fn_name` to the required method name, include the provided `Solution` signature in `starter_code`, and preserve the benchmark's function-call input and expected-output format.
84
+
85
+ ### Ranking existing candidates
86
+
87
+ For `--rank-only`, add `current_code` as a complete program string, `candidates` as a list of four program strings, and `feedback` as the current program's public execution results. The `feedback` object has this format:
88
+
89
+ ```json
90
+ {
91
+ "results": [
92
+ {
93
+ "test_id": "public_0",
94
+ "status": "WA",
95
+ "actual": "-1\n",
96
+ "expected": "5\n",
97
+ "stderr": "",
98
+ "seconds": 0.01
99
+ }
100
+ ],
101
+ "wall_seconds": 0.01
102
+ }
103
+ ```
104
+
105
+ Use the recorded test status (`AC`, `WA`, `RE`, `TLE`, or `CE`) and measured execution time for each result.
106
+
107
+ ## Run inference
108
+
109
+ Set `INPUT_DIR` and `OUTPUT_DIR` as described in the [overview](../README.md#getting-started). Run CodeContests inference:
110
+
111
+ ```bash
112
+ CUDA_VISIBLE_DEVICES=0 python code_repair/infer.py \
113
+ --protocol codecontests \
114
+ --input "$INPUT_DIR/codecontests.jsonl" \
115
+ --output "$OUTPUT_DIR/codecontests_predictions.jsonl" \
116
+ --seed 0
117
+ ```
118
+
119
+ For APPS Introductory or LiveCodeBench, save the task rows in `transfer_tasks.jsonl` and run:
120
+
121
+ ```bash
122
+ CUDA_VISIBLE_DEVICES=0 python code_repair/infer.py \
123
+ --protocol transfer \
124
+ --input "$INPUT_DIR/transfer_tasks.jsonl" \
125
+ --output "$OUTPUT_DIR/transfer_predictions.jsonl" \
126
+ --seed 0
127
+ ```
128
+
129
+ Add `--rank-only` to either command to score supplied candidates using the input fields above. Outputs contain the final program and world-model predictions.
130
+
131
+ ## Checkpoints
132
+
133
+ | Component | Resource |
134
+ | --- | --- |
135
+ | Coding policy | [ReasonFlux-Coder-7B](https://huggingface.co/Gen-Verse/ReasonFlux-Coder-7B) |
136
+ | World-model backbone | [Qwen2.5-Coder-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct) |
137
+ | CodeContests world model | [codecontests_final](checkpoints/codecontests_final/) |
138
+ | APPS and LiveCodeBench world model | [transfer_final](checkpoints/transfer_final/) |
139
+
140
+ The two world-model checkpoints share the Qwen2.5-Coder-3B encoder and JEPA-Anything prediction architecture, with different learned adapters and predictive heads. `codecontests_final` is used by `--protocol codecontests`; `transfer_final` is shared by APPS Introductory and LiveCodeBench through `--protocol transfer`. Each run loads the checkpoint for its selected protocol.
141
+
142
+ [← Collection overview](../README.md)
code_repair/checkpoints/codecontests_final/inference.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "semantic_opf",
3
+ "arithmetic_precision": "native_bfloat16_backbone_float32_domain",
4
+ "model_identity": "6d68629ead66699ce8c99c12362bcba1c33e23dd0810b0b37cf9360b276338ed",
5
+ "files": {
6
+ "public_world/domain.pt": "7a48412bae22de33243342507bf9b468b8eeef4ff108876e81d739c40fbe6eb6",
7
+ "public_world/online_lora/adapter_config.json": "32b6744b4f2313fb3724578cfa3c8d1d401d80c872328301aa9cec03b00c8850",
8
+ "public_world/online_lora/adapter_model.safetensors": "547055dab769b39bb7ee3734713324e093a554aab49d9fd94d8ab3d1795aa8ce",
9
+ "suite_readout.pt": "4db0e287d0cd526f34efe2958ef020b76dfb30939038ac6a7b76bf2614467d0f",
10
+ "public_world/inference.json": "292bc9a30d28c3590fe6597c224f428014dfac388b0f853f37d0e4ba29cc01ad"
11
+ }
12
+ }
code_repair/checkpoints/codecontests_final/public_world/domain.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a48412bae22de33243342507bf9b468b8eeef4ff108876e81d739c40fbe6eb6
3
+ size 3489349
code_repair/checkpoints/codecontests_final/public_world/inference.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "opf",
3
+ "encoder_max_length": 16384,
4
+ "model_identity": "9e22d0c79ac75f30c6ef31b3ae40a6b6a0eb0e1ce2b9b4ee9d2d90fa1fb75f83",
5
+ "files": {
6
+ "domain.pt": "7a48412bae22de33243342507bf9b468b8eeef4ff108876e81d739c40fbe6eb6",
7
+ "online_lora/adapter_config.json": "32b6744b4f2313fb3724578cfa3c8d1d401d80c872328301aa9cec03b00c8850",
8
+ "online_lora/adapter_model.safetensors": "547055dab769b39bb7ee3734713324e093a554aab49d9fd94d8ab3d1795aa8ce"
9
+ }
10
+ }
code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "bias": "none",
4
+ "fan_in_fan_out": false,
5
+ "inference_mode": true,
6
+ "init_lora_weights": true,
7
+ "loftq_config": {},
8
+ "lora_alpha": 32,
9
+ "lora_bias": false,
10
+ "lora_dropout": 0.0,
11
+ "megatron_core": "megatron.core",
12
+ "peft_type": "LORA",
13
+ "qalora_group_size": 16,
14
+ "r": 16,
15
+ "rank_pattern": {},
16
+ "target_modules": [
17
+ "k_proj",
18
+ "q_proj",
19
+ "o_proj",
20
+ "v_proj"
21
+ ],
22
+ "task_type": "FEATURE_EXTRACTION",
23
+ "use_dora": false,
24
+ "use_qalora": false,
25
+ "use_rslora": false
26
+ }
code_repair/checkpoints/codecontests_final/public_world/online_lora/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:547055dab769b39bb7ee3734713324e093a554aab49d9fd94d8ab3d1795aa8ce
3
+ size 29528024
code_repair/checkpoints/codecontests_final/suite_readout.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4db0e287d0cd526f34efe2958ef020b76dfb30939038ac6a7b76bf2614467d0f
3
+ size 72605
code_repair/checkpoints/transfer_final/inference.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "semantic_opf",
3
+ "arithmetic_precision": "native_bfloat16_backbone_float32_domain",
4
+ "model_identity": "2aef0d0326ea7cfc72e0647710f39ad5ce9146249a6e91bb9b162a5206332384",
5
+ "files": {
6
+ "public_world/domain.pt": "fe0f754d603465ba91200e7ad10232f374ee5626e2d4b5a999205d74011cdcfb",
7
+ "public_world/online_lora/adapter_config.json": "92c108d23c1aec50044afb5eef89e0c11cc7e67f325b3e774c9dd6f288c30ae4",
8
+ "public_world/online_lora/adapter_model.safetensors": "ef4e41b5439b3e3739e26043cb9c7ddd48e9776d49d365101607a1e43fe54eb1",
9
+ "suite_readout.pt": "fe7643dfb1b6d76fa8ceb6480f156c3e8afa8d9ce7517d640d8d7f48390a2c43",
10
+ "public_world/inference.json": "5febd5255574af19fdb58013f899856d60acefd9a75c1f72088cec701b79cca9"
11
+ }
12
+ }
code_repair/checkpoints/transfer_final/public_world/domain.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe0f754d603465ba91200e7ad10232f374ee5626e2d4b5a999205d74011cdcfb
3
+ size 3489349
code_repair/checkpoints/transfer_final/public_world/inference.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "opf",
3
+ "encoder_max_length": 16384,
4
+ "model_identity": "a812fd2d26bb7fcd828ded22fc4ed9b2f1bccb2d3b339aaeabd51ea643fe0568",
5
+ "files": {
6
+ "domain.pt": "fe0f754d603465ba91200e7ad10232f374ee5626e2d4b5a999205d74011cdcfb",
7
+ "online_lora/adapter_config.json": "92c108d23c1aec50044afb5eef89e0c11cc7e67f325b3e774c9dd6f288c30ae4",
8
+ "online_lora/adapter_model.safetensors": "ef4e41b5439b3e3739e26043cb9c7ddd48e9776d49d365101607a1e43fe54eb1"
9
+ }
10
+ }
code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "bias": "none",
4
+ "fan_in_fan_out": false,
5
+ "inference_mode": true,
6
+ "init_lora_weights": true,
7
+ "loftq_config": {},
8
+ "lora_alpha": 32,
9
+ "lora_bias": false,
10
+ "lora_dropout": 0.0,
11
+ "megatron_core": "megatron.core",
12
+ "peft_type": "LORA",
13
+ "qalora_group_size": 16,
14
+ "r": 16,
15
+ "rank_pattern": {},
16
+ "target_modules": [
17
+ "o_proj",
18
+ "v_proj",
19
+ "q_proj",
20
+ "k_proj"
21
+ ],
22
+ "task_type": "FEATURE_EXTRACTION",
23
+ "use_dora": false,
24
+ "use_qalora": false,
25
+ "use_rslora": false
26
+ }
code_repair/checkpoints/transfer_final/public_world/online_lora/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef4e41b5439b3e3739e26043cb9c7ddd48e9776d49d365101607a1e43fe54eb1
3
+ size 29528024
code_repair/checkpoints/transfer_final/suite_readout.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe7643dfb1b6d76fa8ceb6480f156c3e8afa8d9ce7517d640d8d7f48390a2c43
3
+ size 72605
code_repair/codecontests/src/artifacts.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib,json
2
+ from pathlib import Path
3
+ def hash_object(value):
4
+ return hashlib.sha256(json.dumps(value,sort_keys=True,ensure_ascii=False,separators=(',',':')).encode()).hexdigest()
5
+ def checkpoint_manifest(path):
6
+ path=Path(path).resolve()
7
+ metadata=json.loads((path/'inference.json').read_text())
8
+ for name,expected in metadata['files'].items():
9
+ p=(path/name).resolve()
10
+ if path not in p.parents or not p.is_file() or hashlib.sha256(p.read_bytes()).hexdigest()!=expected:
11
+ raise RuntimeError('Model file checksum mismatch: '+name)
12
+ return metadata,metadata.get('model_identity',hash_object(metadata))
code_repair/codecontests/src/coder.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import time
3
+ from dataclasses import dataclass
4
+ from cure_wm import TestCase
5
+ CODE_FENCE = re.compile('```(?:python|py)?\\s*\\n(.*?)```', re.I | re.S)
6
+ TEST_INPUT = re.compile('\\*\\*Test Input:\\*\\*\\s*```[^\\n]*\\n(.*?)```', re.I | re.S)
7
+ TEST_OUTPUT = re.compile('\\*\\*Test Output:\\*\\*\\s*```[^\\n]*\\n(.*?)```', re.I | re.S)
8
+
9
+ def extract_code(text):
10
+ matches = CODE_FENCE.findall(text)
11
+ if matches:
12
+ return matches[-1].strip() + '\n'
13
+ tail = text.split('</think>')[-1].strip()
14
+ lines = tail.splitlines()
15
+ for (i, line) in enumerate(lines):
16
+ if line.startswith(('import ', 'from ', 'def ', 'class ', 'if __name__', 'n =', 'n=', 'a =', 'a=', 's =', 's=')):
17
+ return '\n'.join(lines[i:]).strip() + '\n'
18
+ return ''
19
+
20
+ @dataclass(frozen=True)
21
+ class Generation:
22
+ text: str
23
+ input_tokens: int
24
+ output_tokens: int
25
+ seconds: float
26
+
27
+ class FrozenCoder:
28
+
29
+ def __init__(self, model_path):
30
+ import torch
31
+ from transformers import AutoModelForCausalLM, AutoTokenizer
32
+ self.torch = torch
33
+ self.tokenizer = AutoTokenizer.from_pretrained(model_path, local_files_only=True)
34
+ self.model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map='cuda:0', local_files_only=True).eval()
35
+
36
+ def _generate(self, user_prompt, *, n=1, seed=0, max_new_tokens=2048):
37
+ torch = self.torch
38
+ prompt = self.tokenizer.apply_chat_template([{'role': 'system', 'content': 'You are a helpful assistant for solving Python coding problems.'}, {'role': 'user', 'content': user_prompt}], tokenize=False, add_generation_prompt=True)
39
+ tokens = self.tokenizer(prompt, return_tensors='pt', truncation=False).to('cuda:0')
40
+ input_length = tokens['input_ids'].shape[1]
41
+ if input_length + max_new_tokens > 20000:
42
+ raise ValueError(f'Prompt too long: {input_length} tokens')
43
+ torch.manual_seed(seed)
44
+ started = time.monotonic()
45
+ with torch.inference_mode():
46
+ outputs = self.model.generate(**tokens, do_sample=True, temperature=0.8, top_p=0.95, max_new_tokens=max_new_tokens, num_return_sequences=n, pad_token_id=self.tokenizer.eos_token_id)
47
+ elapsed = time.monotonic() - started
48
+ generations = []
49
+ for seq in outputs:
50
+ continuation = seq[input_length:].tolist()
51
+ if self.tokenizer.eos_token_id in continuation:
52
+ output_tokens = continuation.index(self.tokenizer.eos_token_id) + 1
53
+ else:
54
+ output_tokens = len(continuation)
55
+ generations.append(Generation(self.tokenizer.decode(continuation[:output_tokens], skip_special_tokens=True), input_length, output_tokens, elapsed / n))
56
+ return tuple(generations)
57
+
58
+ def initial(self, problem, seed):
59
+ prompt = f'Think first, then write a complete Python script for the problem below. Read from standard input and print the answer to standard output. Put the final runnable script in one ```python block.\n\nProblem:\n{problem}'
60
+ raw = self._generate(prompt, seed=seed, max_new_tokens=4096)[0]
61
+ return (extract_code(raw.text), raw)
62
+
63
+ def refine(self, problem, current_code, feedback, visible_tests, *, k, seed):
64
+ lines = []
65
+ for (test, result) in zip(visible_tests, feedback.results):
66
+ lines.append(f'Input: {test.input[:1000]!r}\nExpected: {test.expected[:500]!r}\nObserved: {result.actual[:500]!r}\nStatus: {result.status}\nError: {result.stderr[:500]}')
67
+ prompt = f'Revise the following Python script to solve the problem. Read from standard input and print to standard output. Use the observed test feedback to fix the program. Return a complete runnable script in one ```python block.\n\nProblem:\n{problem}\n\nCurrent script:\n```python\n{current_code}\n```\n\nVisible test feedback:\n' + '\n\n'.join(lines)
68
+ raws = self._generate(prompt, n=k, seed=seed, max_new_tokens=4096)
69
+ return tuple(((extract_code(raw.text), raw) for raw in raws))
code_repair/codecontests/src/cure_wm.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ import os, resource, shutil, signal, subprocess, sys, tempfile, time
3
+ from pathlib import Path
4
+ from dataclasses import dataclass
5
+
6
+ @dataclass(frozen=True)
7
+ class TestCase:
8
+ input: str
9
+ expected: str
10
+ test_id: str
11
+
12
+ @dataclass(frozen=True)
13
+ class TestResult:
14
+ test_id: str
15
+ status: str
16
+ actual: str
17
+ expected: str
18
+ stderr: str
19
+ seconds: float
20
+
21
+ @dataclass(frozen=True)
22
+ class Execution:
23
+ results: tuple[TestResult, ...]
24
+ wall_seconds: float
25
+
26
+ @property
27
+ def all_pass(self) -> bool:
28
+ return bool(self.results) and all((r.status == 'AC' for r in self.results))
29
+
30
+ @property
31
+ def pass_fraction(self) -> float:
32
+ return sum((r.status == 'AC' for r in self.results)) / len(self.results) if self.results else 0.0
33
+
34
+ @dataclass(frozen=True)
35
+ class Candidate:
36
+ candidate_id: str
37
+ code: str
38
+
39
+ def _limits():
40
+ if sys.platform != 'linux':
41
+ return
42
+ resource.setrlimit(resource.RLIMIT_CPU, (10, 11))
43
+ resource.setrlimit(resource.RLIMIT_AS, (1024 ** 3, 1024 ** 3))
44
+ resource.setrlimit(resource.RLIMIT_FSIZE, (1024 ** 2, 1024 ** 2))
45
+ resource.setrlimit(resource.RLIMIT_NOFILE, (64, 64))
46
+
47
+ def _run_one(script: Path, test: TestCase, timeout: float, sandbox: str) -> TestResult:
48
+ started = time.monotonic()
49
+ if sandbox == 'required':
50
+ if not shutil.which('runuser') or not shutil.which('unshare'):
51
+ raise RuntimeError('Required runuser/unshare sandbox is unavailable')
52
+ interpreter = os.environ.get('RSI_SANDBOX_PYTHON', '/usr/bin/python3')
53
+ if not os.path.isfile(interpreter) or not os.access(interpreter, os.X_OK):
54
+ raise RuntimeError(f'Sandbox Python interpreter is unavailable: {interpreter}')
55
+ cmd = [shutil.which('runuser'), '-u', 'nobody', '--', shutil.which('unshare'), '-Urn', '--', interpreter, '-I', str(script)]
56
+ elif sandbox == 'local_test':
57
+ cmd = [sys.executable, '-I', str(script)]
58
+ else:
59
+ raise ValueError(f'unknown sandbox: {sandbox}')
60
+ env = {'PATH': '/usr/bin:/bin', 'PYTHONIOENCODING': 'utf-8', 'PYTHONDONTWRITEBYTECODE': '1'}
61
+ proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, start_new_session=True, preexec_fn=_limits, env=env)
62
+ try:
63
+ stdout, stderr = proc.communicate(test.input, timeout=timeout)
64
+ except subprocess.TimeoutExpired:
65
+ os.killpg(proc.pid, signal.SIGKILL)
66
+ proc.communicate()
67
+ return TestResult(test.test_id, 'TLE', '', test.expected, 'timeout', time.monotonic() - started)
68
+ elapsed = time.monotonic() - started
69
+ if proc.returncode:
70
+ return TestResult(test.test_id, 'RE', stdout[-1024:], test.expected, stderr[-2048:], elapsed)
71
+ status = 'AC' if stdout.strip() == test.expected.strip() else 'WA'
72
+ return TestResult(test.test_id, status, stdout[-1024:], test.expected, stderr[-2048:], elapsed)
73
+
74
+ def execute(code: str, tests: tuple[TestCase, ...], *, timeout: float=3.0, sandbox: str='required') -> Execution:
75
+ started = time.monotonic()
76
+ if not tests:
77
+ raise ValueError('Cannot execute an empty test suite')
78
+ if not code.strip():
79
+ results = tuple((TestResult(t.test_id, 'CE', '', t.expected, 'Empty candidate program', 0.0) for t in tests))
80
+ return Execution(results, time.monotonic() - started)
81
+ try:
82
+ compile(code, 'candidate.py', 'exec')
83
+ except SyntaxError as exc:
84
+ msg = f'{type(exc).__name__}: {exc.msg} (line {exc.lineno})'
85
+ results = tuple((TestResult(t.test_id, 'CE', '', t.expected, msg, 0.0) for t in tests))
86
+ return Execution(results, time.monotonic() - started)
87
+ with tempfile.TemporaryDirectory(prefix='cure_wm_') as tmp:
88
+ tmp_dir = Path(tmp)
89
+ tmp_dir.chmod(493)
90
+ script = tmp_dir / 'candidate.py'
91
+ script.write_text(code, encoding='utf-8')
92
+ script.chmod(420)
93
+ results = tuple((_run_one(script, test, timeout, sandbox) for test in tests))
94
+ return Execution(results, time.monotonic() - started)
code_repair/codecontests/src/fixtures.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from cure_wm import Execution, TestResult
2
+
3
+ def execution_from_dict(payload):
4
+ return Execution(tuple((TestResult(**r) for r in payload['results'])), payload['wall_seconds'])
code_repair/codecontests/src/public_context.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import json
2
+
3
+ def feedback_text(feedback):
4
+ return json.dumps([{'test_id': r['test_id'], 'status': r['status'], 'actual': r['actual'][:1024], 'stderr': r['stderr'][:2048], 'seconds': round(r['seconds'], 4)} for r in feedback['results']], ensure_ascii=False)
code_repair/codecontests/src/ranking.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+ import math
3
+ import json
4
+ from dataclasses import asdict
5
+ from public_context import feedback_text
6
+ def choose(predictions):
7
+ if len(predictions) != 5:
8
+ raise ValueError('Expected four candidates and one current program')
9
+ utility = [row['utility'] for row in predictions]
10
+ if not all((math.isfinite(v) and 0 <= v <= 1.25 for v in utility)):
11
+ raise ValueError('Invalid utility')
12
+ best = max(range(4), key=lambda i: utility[i])
13
+ return best if utility[best] > utility[4] else 4
14
+
15
+ class Predictor:
16
+
17
+ def __init__(self, checkpoint, backbone):
18
+ from semantic_world import SemanticExecutionWorld
19
+ self.model = SemanticExecutionWorld.load(checkpoint, backbone, device='cuda').eval()
20
+ self.identity = self.model.identity
21
+
22
+ def predict(self, problem, code, feedback, tests, candidates):
23
+ public = [asdict(test) for test in tests if test.test_id.startswith('public_')]
24
+ observed = asdict(feedback)
25
+ observed['results'] = [row for row in observed['results'] if row['test_id'].startswith('public_')]
26
+ contexts = [f'Whole-training-suite execution forecast. Only public observations are supplied.\nProblem:\n{problem}\nCurrent program:\n{code}\nTrusted previous public execution:\n{feedback_text(observed)}\nCandidate action:\n{candidate.code}\nOfficial public test suite:\n' + json.dumps(public, ensure_ascii=False) for candidate in candidates]
27
+ values = self.model.score_suite(contexts)
28
+ return [dict(candidate_id=c.candidate_id, utility=float(values['utility'][i]), full_suite_pass_probability=float(values['full_suite_pass_probability'][i]), predicted_pass_fraction=float(values['predicted_pass_fraction'][i])) for (i, c) in enumerate(candidates)]
29
+
30
+ def state_key(code, feedback, step):
31
+ outcomes = [{k: getattr(row, k) for k in ('test_id', 'status', 'actual', 'expected', 'stderr')} for row in feedback.results]
32
+ return hashlib.sha256(json.dumps(dict(code=code, feedback=outcomes, step=step), sort_keys=True).encode()).hexdigest()
code_repair/codecontests/src/seed.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import hashlib
2
+
3
+ def stable_seed(*parts):
4
+ payload = ':'.join((str(part) for part in parts))
5
+ return int.from_bytes(hashlib.sha256(payload.encode()).digest()[:4], 'little')
code_repair/codecontests/src/semantic_world.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import hashlib
3
+ import json
4
+ import math
5
+ from collections import defaultdict
6
+ from pathlib import Path
7
+ import torch
8
+ from torch import nn
9
+ from torch.nn import functional as F
10
+ from world import D
11
+ REVISION = 'world-update-v3-routed-suite-listwise-20261006-r2'
12
+ PUBLIC = 'per_public_test'
13
+ GLOBAL = 'whole_training_suite'
14
+
15
+ class SemanticExecutionWorld(nn.Module):
16
+
17
+ def __init__(self, public_world):
18
+ super().__init__()
19
+ if public_world.mode != 'opf':
20
+ raise ValueError('Extension requires the native OPF world')
21
+ self.public_world = public_world
22
+ self.suite_readout = copy.deepcopy(public_world.readout)
23
+ old = self.suite_readout[-1]
24
+ final = nn.Linear(old.in_features, 7, device=old.weight.device, dtype=old.weight.dtype)
25
+ with torch.no_grad():
26
+ final.weight[:6].copy_(old.weight)
27
+ final.bias[:6].copy_(old.bias)
28
+ final.weight[6].zero_()
29
+ final.bias[6].zero_()
30
+ self.suite_readout[-1] = final
31
+
32
+ @torch.no_grad()
33
+ def score_suite(self, contexts):
34
+ self.eval()
35
+ encoded = self.public_world.encode(contexts)
36
+ (latent, _) = self.public_world.predict_latent(encoded)
37
+ output = self.suite_readout(latent)
38
+ probabilities = F.softmax(output[:, :5], dim=-1)
39
+ partial = torch.sigmoid(output[:, 6])
40
+ return dict(scope=GLOBAL, full_suite_pass_probability=probabilities[:, 0], predicted_pass_fraction=partial, utility=probabilities[:, 0] + 0.25 * partial, failure_status_probabilities=probabilities, predicted_mean_normalized_seconds=F.softplus(output[:, 5]), calibration_verified=False, semantic_correctness_guaranteed=False)
41
+
42
+ @torch.no_grad()
43
+ def score_public(self, contexts):
44
+ return self.public_world.score(contexts)
45
+
46
+ @classmethod
47
+ def load(cls, path, base_path, device='cpu'):
48
+ from artifacts import checkpoint_manifest
49
+ from world import ExecutionWorld
50
+ (manifest, identity) = checkpoint_manifest(path)
51
+ if manifest['mode'] != 'semantic_opf':
52
+ raise ValueError('Unexpected model architecture')
53
+ world = ExecutionWorld.load(Path(path) / 'public_world', base_path, device=device)
54
+ if manifest['arithmetic_precision'] == 'float32':
55
+ world.float()
56
+ elif manifest['arithmetic_precision'] != 'native_bfloat16_backbone_float32_domain':
57
+ raise ValueError('Unknown model precision')
58
+ model = cls(world)
59
+ state = torch.load(Path(path) / 'suite_readout.pt', map_location=device, weights_only=True)
60
+ model.suite_readout.load_state_dict(state, strict=True)
61
+ model.identity = identity
62
+ return model.to(device).requires_grad_(False).eval()
code_repair/codecontests/src/world.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy, sys
2
+ from pathlib import Path
3
+ import torch
4
+ from torch import nn
5
+ from torch.nn import functional as F
6
+ CORE = Path(__file__).resolve().parents[1] / 'vendor/jepa-anything-core/src'
7
+ sys.path.insert(0, str(CORE))
8
+ from jepa_anything_core import OrthogonalFactorProjection, UnconstrainedMultiHeadPredictor, MLPPredictor
9
+ (D, K, R) = (256, 4, 64)
10
+
11
+ class Overlength(ValueError):
12
+ pass
13
+
14
+ class DomainEncoder(nn.Module):
15
+
16
+ def __init__(self, base_path, max_length=16384):
17
+ super().__init__()
18
+ from transformers import AutoModel, AutoTokenizer
19
+ from peft import LoraConfig, get_peft_model, TaskType
20
+ self.tokenizer = AutoTokenizer.from_pretrained(base_path, local_files_only=True)
21
+ self.tokenizer.pad_token = self.tokenizer.eos_token
22
+ self.tokenizer.padding_side = 'right'
23
+ self.max_length = max_length
24
+ base = AutoModel.from_pretrained(base_path, dtype=torch.bfloat16, local_files_only=True, attn_implementation='sdpa')
25
+ config = LoraConfig(task_type=TaskType.FEATURE_EXTRACTION, r=16, lora_alpha=32, lora_dropout=0.0, target_modules=['q_proj', 'k_proj', 'v_proj', 'o_proj'], inference_mode=True)
26
+ self.backbone = get_peft_model(base, config)
27
+ self.backbone.config.use_cache = False
28
+ self.projection = nn.Sequential(nn.Linear(base.config.hidden_size, D), nn.LayerNorm(D))
29
+
30
+ def forward(self, texts):
31
+ batch = self.tokenizer(texts, padding=True, truncation=False, return_tensors='pt')
32
+ if batch['input_ids'].shape[-1] > self.max_length:
33
+ raise Overlength('encoder input exceeds explicit limit')
34
+ device = next(self.backbone.parameters()).device
35
+ batch = {k: v.to(device) for (k, v) in batch.items()}
36
+ outputs = self.backbone(**batch, return_dict=True, use_cache=False).last_hidden_state
37
+ mask = batch['attention_mask'].unsqueeze(-1)
38
+ pooled = (outputs.float() * mask).sum(1) / mask.sum(1).clamp_min(1)
39
+ return self.projection(pooled)
40
+
41
+ class ExecutionWorld(nn.Module):
42
+
43
+ def __init__(self, encoder, mode='opf'):
44
+ super().__init__()
45
+ self.mode = mode
46
+ self.online = encoder
47
+ if mode == 'opf':
48
+ self.opf = OrthogonalFactorProjection(D, K, R)
49
+ self.predictor = UnconstrainedMultiHeadPredictor(D, D, K, R, 512)
50
+ elif mode == 'multi':
51
+ self.opf = None
52
+ self.predictor = UnconstrainedMultiHeadPredictor(D, D, K, R, 640)
53
+ elif mode in ('standard', 'ce'):
54
+ self.opf = None
55
+ self.predictor = MLPPredictor(D, D, 640)
56
+ else:
57
+ raise ValueError(mode)
58
+ self.log_temperature = nn.Parameter(torch.zeros(()))
59
+ self.readout = nn.Sequential(nn.LayerNorm(D), nn.Linear(D, 64), nn.GELU(), nn.Linear(64, 6))
60
+
61
+ def predict_latent(self, context):
62
+ p = self.predictor(context)
63
+ if self.mode == 'opf':
64
+ return (self.opf.compose(p), p)
65
+ if self.mode == 'multi':
66
+ return (p.flatten(-2), p)
67
+ return (p, p.reshape(-1, K, R))
68
+
69
+ def encode(self, texts, microbatch=1):
70
+ encoder = self.online
71
+ rows = []
72
+ for i in range(0, len(texts), microbatch):
73
+ rows.append(encoder(texts[i:i + microbatch]))
74
+ return torch.cat(rows, dim=0)
75
+
76
+ @torch.no_grad()
77
+ def score(self, contexts):
78
+ self.eval()
79
+ c = self.encode(contexts)
80
+ (z, _) = self.predict_latent(c)
81
+ p = F.softmax(self.readout(z)[:, :5] / self.log_temperature.exp().clamp(0.2, 5.0), -1)
82
+ return p
83
+
84
+ @torch.no_grad()
85
+ def details(self, contexts):
86
+ self.eval()
87
+ z = self.encode(contexts)
88
+ (latent, _) = self.predict_latent(z)
89
+ out = self.readout(latent)
90
+ return (F.softmax(out[:, :5] / self.log_temperature.exp().clamp(0.2, 5.0), -1), F.softplus(out[:, 5]))
91
+
92
+ @classmethod
93
+ def load(cls, path, base_path, device='cuda'):
94
+ from artifacts import checkpoint_manifest
95
+ from peft.utils.save_and_load import load_peft_weights, set_peft_model_state_dict
96
+ (metadata, identity) = checkpoint_manifest(path)
97
+ path = Path(path)
98
+ encoder = DomainEncoder(base_path, max_length=metadata.get('encoder_max_length', 8192))
99
+ model = cls(encoder, metadata['mode'])
100
+ result = set_peft_model_state_dict(model.online.backbone, load_peft_weights(str(path / 'online_lora'), device='cpu'), adapter_name='default')
101
+ if result.unexpected_keys:
102
+ raise RuntimeError('Unexpected adapter keys: ' + str(result.unexpected_keys))
103
+ state = torch.load(path / 'domain.pt', map_location='cpu', weights_only=True)
104
+ result = model.load_state_dict(state, strict=False)
105
+ missing = [k for k in result.missing_keys if not k.startswith('online.backbone.') and k != 'log_temperature']
106
+ if result.unexpected_keys or missing:
107
+ raise RuntimeError('Model state mismatch: ' + str((result.unexpected_keys, missing)))
108
+ model.identity = identity
109
+ model.checkpoint_path = str(path)
110
+ return model.to(device).requires_grad_(False).eval()
code_repair/codecontests/vendor/jepa-anything-core/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 [yyyy] [name of copyright owner]
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.
202
+
code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from .opf import OrthogonalFactorProjection
2
+ from .baselines import MLPPredictor, UnconstrainedMultiHeadPredictor
code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/baselines.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Standard JEPA and capacity-matched unconstrained multi-head baselines."""
2
+ from __future__ import annotations
3
+ import copy
4
+ import math
5
+ from dataclasses import asdict, dataclass
6
+ import torch
7
+ from torch import Tensor, nn
8
+ from .opf import validate_factorization
9
+
10
+ def _make_trunk(input_dim: int, hidden_dim: int, depth: int) -> tuple[nn.Module, int]:
11
+ if input_dim <= 0 or hidden_dim <= 0:
12
+ raise ValueError('input_dim and hidden_dim must be positive')
13
+ if depth <= 0:
14
+ raise ValueError('depth must be positive')
15
+ if depth == 1:
16
+ return (nn.Identity(), input_dim)
17
+ layers: list[nn.Module] = [nn.Linear(input_dim, hidden_dim), nn.GELU()]
18
+ for _ in range(depth - 2):
19
+ layers.extend((nn.Linear(hidden_dim, hidden_dim), nn.GELU()))
20
+ return (nn.Sequential(*layers), hidden_dim)
21
+
22
+ class MLPPredictor(nn.Module):
23
+ """Shared-trunk MLP predictor used by the standard JEPA baseline."""
24
+
25
+ def __init__(self, input_dim: int, output_dim: int, hidden_dim: int, *, depth: int=2) -> None:
26
+ super().__init__()
27
+ if output_dim <= 0:
28
+ raise ValueError('output_dim must be positive')
29
+ (self.trunk, trunk_dim) = _make_trunk(input_dim, hidden_dim, depth)
30
+ self.output = nn.Linear(trunk_dim, output_dim)
31
+ self.input_dim = input_dim
32
+ self.output_dim = output_dim
33
+
34
+ def forward(self, context_state: Tensor) -> Tensor:
35
+ """Predict a complete target state from a context state."""
36
+ if context_state.shape[-1] != self.input_dim:
37
+ raise ValueError(f'context_state must end in dimension {self.input_dim}')
38
+ return self.output(self.trunk(context_state))
39
+
40
+ class UnconstrainedMultiHeadPredictor(nn.Module):
41
+ """Shared-trunk predictor with ``K`` independent, unconstrained output heads.
42
+
43
+ No orthogonal basis, cross-head constraint, or semantic factor label is
44
+ imposed. With identical dimensions, its parameter count exactly matches
45
+ :class:`MLPPredictor`: splitting one ``d``-wide output layer into ``K``
46
+ ``r``-wide layers changes grouping, not capacity.
47
+ """
48
+
49
+ def __init__(self, input_dim: int, state_dim: int, num_heads: int, head_dim: int, hidden_dim: int, *, depth: int=2) -> None:
50
+ super().__init__()
51
+ validate_factorization(state_dim, num_heads, head_dim)
52
+ (self.trunk, trunk_dim) = _make_trunk(input_dim, hidden_dim, depth)
53
+ self.heads = nn.ModuleList((nn.Linear(trunk_dim, head_dim) for _ in range(num_heads)))
54
+ self.input_dim = input_dim
55
+ self.state_dim = state_dim
56
+ self.num_heads = num_heads
57
+ self.head_dim = head_dim
58
+
59
+ def forward(self, context_state: Tensor) -> Tensor:
60
+ """Return unconstrained head outputs with trailing shape ``(K, r)``."""
61
+ if context_state.shape[-1] != self.input_dim:
62
+ raise ValueError(f'context_state must end in dimension {self.input_dim}')
63
+ hidden = self.trunk(context_state)
64
+ return torch.stack([head(hidden) for head in self.heads], dim=-2)
65
+
66
+ def flatten_output(self, head_predictions: Tensor) -> Tensor:
67
+ """Flatten ``(..., K, r)`` head predictions to ``(..., d)``."""
68
+ if head_predictions.shape[-2:] != (self.num_heads, self.head_dim):
69
+ raise ValueError(f'head_predictions must end in ({self.num_heads}, {self.head_dim})')
70
+ return head_predictions.flatten(start_dim=-2)
code_repair/codecontests/vendor/jepa-anything-core/src/jepa_anything_core/opf.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Inference-only OPF geometry."""
2
+ from __future__ import annotations
3
+ import torch
4
+ from torch import Tensor, nn
5
+
6
+ def validate_factorization(state_dim: int, num_factors: int, factor_dim: int) -> None:
7
+ dimensions = {'state_dim': state_dim, 'num_factors': num_factors, 'factor_dim': factor_dim}
8
+ invalid_types = [name for (name, value) in dimensions.items() if isinstance(value, bool) or not isinstance(value, int)]
9
+ if invalid_types:
10
+ raise TypeError(f"dimensions must be integers; invalid: {', '.join(invalid_types)}")
11
+ invalid = [name for (name, value) in dimensions.items() if value <= 0]
12
+ if invalid:
13
+ raise ValueError(f"dimensions must be positive; invalid: {', '.join(invalid)}")
14
+ if num_factors * factor_dim != state_dim:
15
+ raise ValueError(f'complete OPF state requires num_factors * factor_dim == state_dim ({num_factors} * {factor_dim} != {state_dim})')
16
+
17
+ def _validate_basis_shape(basis: Tensor) -> tuple[int, int, int]:
18
+ if basis.ndim != 3:
19
+ raise ValueError(f'basis must have shape (K, r, d), got {tuple(basis.shape)}')
20
+ (num_factors, factor_dim, state_dim) = basis.shape
21
+ validate_factorization(state_dim, num_factors, factor_dim)
22
+ if not basis.is_floating_point():
23
+ raise TypeError('basis must be floating point')
24
+ return (num_factors, factor_dim, state_dim)
25
+
26
+ def _validate_same_device_dtype(value: Tensor, basis: Tensor, name: str) -> None:
27
+ if value.device != basis.device:
28
+ raise ValueError(f'{name} and basis must be on the same device')
29
+ if value.dtype != basis.dtype:
30
+ raise ValueError(f'{name} and basis must have the same dtype')
31
+
32
+ def decompose_state(state: Tensor, basis: Tensor) -> Tensor:
33
+ (_, _, state_dim) = _validate_basis_shape(basis)
34
+ if state.ndim < 1 or state.shape[-1] != state_dim:
35
+ raise ValueError(f'state must end in dimension {state_dim}, got {tuple(state.shape)}')
36
+ _validate_same_device_dtype(state, basis, 'state')
37
+ return torch.einsum('...d,krd->...kr', state, basis)
38
+
39
+ def compose_state(factors: Tensor, basis: Tensor) -> Tensor:
40
+ (num_factors, factor_dim, state_dim) = _validate_basis_shape(basis)
41
+ if factors.ndim < 2 or factors.shape[-2:] != (num_factors, factor_dim):
42
+ raise ValueError(f'factors must end in ({num_factors}, {factor_dim}), got {tuple(factors.shape)}')
43
+ _validate_same_device_dtype(factors, basis, 'factors')
44
+ flat = basis.reshape(state_dim, state_dim)
45
+ work = flat.float() if flat.dtype in (torch.float16, torch.bfloat16) else flat
46
+ synthesis = torch.linalg.pinv(work).to(dtype=basis.dtype)
47
+ return torch.einsum('...a,da->...d', factors.flatten(start_dim=-2), synthesis)
48
+
49
+ class OrthogonalFactorProjection(nn.Module):
50
+ """Frozen OPF analysis basis and checkpoint-compatible latent synthesis."""
51
+ def __init__(self, state_dim, num_factors, factor_dim=None):
52
+ super().__init__()
53
+ factor_dim = state_dim // num_factors if factor_dim is None else factor_dim
54
+ validate_factorization(state_dim, num_factors, factor_dim)
55
+ self.state_dim, self.num_factors, self.factor_dim = state_dim, num_factors, factor_dim
56
+ self.raw_basis = nn.Parameter(torch.eye(state_dim).reshape(num_factors, factor_dim, state_dim), requires_grad=False)
57
+ def analysis_basis(self):
58
+ return self.raw_basis
59
+ def compose(self, factors):
60
+ return compose_state(factors, self.raw_basis)
61
+ def decompose(self, state):
62
+ return decompose_state(state, self.raw_basis)
63
+ def forward(self, state):
64
+ return self.decompose(state)
code_repair/infer.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse, json, os, sys
2
+ from pathlib import Path
3
+
4
+ ROOT = Path(__file__).resolve().parent
5
+ BASE_MODELS = Path(os.environ.get('RSI_BASE_MODELS_DIR', str(Path.home() / '.cache/rsi_anything/base_models'))).expanduser()
6
+
7
+ def main():
8
+ p = argparse.ArgumentParser(description='Frozen RSI code generation and repair using public tests')
9
+ p.add_argument('--protocol', choices=['codecontests','transfer'], required=True)
10
+ p.add_argument('--input', type=Path, required=True)
11
+ p.add_argument('--output', type=Path, required=True)
12
+ p.add_argument('--seed', type=int, default=0)
13
+ p.add_argument('--rank-only', action='store_true', help='Rank four supplied candidates and the current program')
14
+ args=p.parse_args()
15
+ if args.output.exists(): raise FileExistsError(args.output)
16
+ sys.path.insert(0,str(ROOT/args.protocol/'src'))
17
+ import torch
18
+ torch.set_num_threads(4)
19
+ torch.set_grad_enabled(False)
20
+ rows=[json.loads(x) for x in args.input.read_text().splitlines() if x.strip()]
21
+ args.output.parent.mkdir(parents=True,exist_ok=True)
22
+ if args.protocol=='transfer':
23
+ from models import Coder,World
24
+ from runner import eval_one
25
+ world=World(ROOT/'checkpoints/transfer_final')
26
+ coder=None if args.rank_only else Coder()
27
+ def infer(row):
28
+ if not args.rank_only: return eval_one(row,coder,'updated',args.seed,world,world.identity)
29
+ if len(row['candidates'])!=4: raise ValueError('Supply four candidate programs')
30
+ codes=row['candidates']+[row['current_code']]
31
+ scores=world.score(row,row['current_code'],row['feedback'],codes)
32
+ i=max(range(4),key=lambda k:scores[k]);i=i if scores[i]>scores[4] else 4
33
+ return dict(task_id=row['task_id'],selected_index=i,final_code=codes[i],scores=scores,world_identity=world.identity)
34
+ else:
35
+ from ranking import Predictor,choose,state_key
36
+ from coder import FrozenCoder
37
+ from cure_wm import Candidate,TestCase,execute
38
+ from fixtures import execution_from_dict
39
+ from seed import stable_seed
40
+ from dataclasses import asdict
41
+ world=Predictor(ROOT/'checkpoints/codecontests_final',BASE_MODELS/'Qwen2.5-Coder-3B-Instruct')
42
+ coder=None if args.rank_only else FrozenCoder(BASE_MODELS/'ReasonFlux-Coder-7B')
43
+ def infer(row):
44
+ tests=tuple(TestCase(**t) for t in row['public_tests'])
45
+ if any(not t.test_id.startswith('public_') for t in tests): raise ValueError('Only public tests are accepted')
46
+ code=row.get('current_code')
47
+ if code is None: code=coder.initial(row['problem'],stable_seed(row['task_id'],args.seed,'initial'))[0]
48
+ feedback=execution_from_dict(row['feedback']) if 'feedback' in row else execute(code,tests,timeout=row.get('timeout',3))
49
+ trace=[]
50
+ for step in range(1 if args.rank_only else 3):
51
+ if not args.rank_only and feedback.all_pass: break
52
+ programs=row['candidates'] if args.rank_only else [c for c,_ in coder.refine(row['problem'],code,feedback,tests,k=4,seed=stable_seed(row['task_id'],args.seed,step,state_key(code,feedback,step),'repair'))]
53
+ if len(programs)!=4: raise ValueError('Supply four candidate programs')
54
+ candidates=tuple(Candidate(f't{step}_k{i}',c) for i,c in enumerate(programs))+(Candidate('keep_current',code),)
55
+ predictions=world.predict(row['problem'],code,feedback,tests,candidates);choice=choose(predictions)
56
+ code=candidates[choice].code
57
+ trace.append(dict(step=step,selected_index=choice,predictions=predictions))
58
+ if not args.rank_only: feedback=execute(code,tests,timeout=row.get('timeout',3))
59
+ return dict(task_id=row['task_id'],final_code=code,trace=trace,world_identity=world.identity)
60
+ with args.output.open('x') as f:
61
+ for row in rows:
62
+ result=infer(row);result.update(hidden_tests_accessed=False)
63
+ f.write(json.dumps(result,ensure_ascii=False)+'\n');f.flush()
64
+ if __name__=='__main__': main()
code_repair/requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ torch==2.6.0
2
+ transformers==5.2.0
3
+ peft==0.18.1
4
+ accelerate==1.15.0
5
+ safetensors==0.8.0
6
+ numpy==2.5.3
7
+ huggingface-hub==1.33.0
8
+ tokenizers==0.22.1
code_repair/transfer/src/artifacts.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib,json
2
+ from pathlib import Path
3
+ def hash_object(value):
4
+ return hashlib.sha256(json.dumps(value,sort_keys=True,ensure_ascii=False,separators=(',',':')).encode()).hexdigest()
5
+ def checkpoint_manifest(path):
6
+ path=Path(path).resolve()
7
+ metadata=json.loads((path/'inference.json').read_text())
8
+ for name,expected in metadata['files'].items():
9
+ p=(path/name).resolve()
10
+ if path not in p.parents or not p.is_file() or hashlib.sha256(p.read_bytes()).hexdigest()!=expected:
11
+ raise RuntimeError('Model file checksum mismatch: '+name)
12
+ return metadata,metadata.get('model_identity',hash_object(metadata))
code_repair/transfer/src/coder.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import time
3
+ from dataclasses import dataclass
4
+ from cure_wm import TestCase
5
+ CODE_FENCE = re.compile('```(?:python|py)?\\s*\\n(.*?)```', re.I | re.S)
6
+ TEST_INPUT = re.compile('\\*\\*Test Input:\\*\\*\\s*```[^\\n]*\\n(.*?)```', re.I | re.S)
7
+ TEST_OUTPUT = re.compile('\\*\\*Test Output:\\*\\*\\s*```[^\\n]*\\n(.*?)```', re.I | re.S)
8
+
9
+ def extract_code(text):
10
+ matches = CODE_FENCE.findall(text)
11
+ if matches:
12
+ return matches[-1].strip() + '\n'
13
+ tail = text.split('</think>')[-1].strip()
14
+ lines = tail.splitlines()
15
+ for (i, line) in enumerate(lines):
16
+ if line.startswith(('import ', 'from ', 'def ', 'class ', 'if __name__', 'n =', 'n=', 'a =', 'a=', 's =', 's=')):
17
+ return '\n'.join(lines[i:]).strip() + '\n'
18
+ return ''
19
+
20
+ @dataclass(frozen=True)
21
+ class Generation:
22
+ text: str
23
+ input_tokens: int
24
+ output_tokens: int
25
+ seconds: float
26
+
27
+ class FrozenCoder:
28
+
29
+ def __init__(self, model_path):
30
+ import torch
31
+ from transformers import AutoModelForCausalLM, AutoTokenizer
32
+ self.torch = torch
33
+ self.tokenizer = AutoTokenizer.from_pretrained(model_path, local_files_only=True)
34
+ self.model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map='cuda:0', local_files_only=True).eval()
35
+
36
+ def _generate(self, user_prompt, *, n=1, seed=0, max_new_tokens=2048):
37
+ torch = self.torch
38
+ prompt = self.tokenizer.apply_chat_template([{'role': 'system', 'content': 'You are a helpful assistant for solving Python coding problems.'}, {'role': 'user', 'content': user_prompt}], tokenize=False, add_generation_prompt=True)
39
+ tokens = self.tokenizer(prompt, return_tensors='pt', truncation=False).to('cuda:0')
40
+ input_length = tokens['input_ids'].shape[1]
41
+ if input_length + max_new_tokens > 20000:
42
+ raise ValueError(f'Prompt too long: {input_length} tokens')
43
+ torch.manual_seed(seed)
44
+ started = time.monotonic()
45
+ with torch.inference_mode():
46
+ outputs = self.model.generate(**tokens, do_sample=True, temperature=0.8, top_p=0.95, max_new_tokens=max_new_tokens, num_return_sequences=n, pad_token_id=self.tokenizer.eos_token_id)
47
+ elapsed = time.monotonic() - started
48
+ generations = []
49
+ for seq in outputs:
50
+ continuation = seq[input_length:].tolist()
51
+ if self.tokenizer.eos_token_id in continuation:
52
+ output_tokens = continuation.index(self.tokenizer.eos_token_id) + 1
53
+ else:
54
+ output_tokens = len(continuation)
55
+ generations.append(Generation(self.tokenizer.decode(continuation[:output_tokens], skip_special_tokens=True), input_length, output_tokens, elapsed / n))
56
+ return tuple(generations)
57
+
58
+ def initial(self, problem, seed):
59
+ prompt = f'Think first, then write a complete Python script for the problem below. Read from standard input and print the answer to standard output. Put the final runnable script in one ```python block.\n\nProblem:\n{problem}'
60
+ raw = self._generate(prompt, seed=seed, max_new_tokens=4096)[0]
61
+ return (extract_code(raw.text), raw)
62
+
63
+ def refine(self, problem, current_code, feedback, visible_tests, *, k, seed):
64
+ lines = []
65
+ for (test, result) in zip(visible_tests, feedback.results):
66
+ lines.append(f'Input: {test.input[:1000]!r}\nExpected: {test.expected[:500]!r}\nObserved: {result.actual[:500]!r}\nStatus: {result.status}\nError: {result.stderr[:500]}')
67
+ prompt = f'Revise the following Python script to solve the problem. Read from standard input and print to standard output. Use the observed test feedback to fix the program. Return a complete runnable script in one ```python block.\n\nProblem:\n{problem}\n\nCurrent script:\n```python\n{current_code}\n```\n\nVisible test feedback:\n' + '\n\n'.join(lines)
68
+ raws = self._generate(prompt, n=k, seed=seed, max_new_tokens=4096)
69
+ return tuple(((extract_code(raw.text), raw) for raw in raws))
code_repair/transfer/src/common.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fcntl,hashlib,json,os,sys,time,uuid
2
+ if hasattr(sys,'set_int_max_str_digits'):sys.set_int_max_str_digits(0)
3
+ from pathlib import Path
4
+ ROOT=Path(os.environ.get('TRANSFER_ROOT',str(Path(__file__).resolve().parents[1])))
5
+ BASE=ROOT.parent
6
+
7
+ BASE_MODELS=Path(os.environ.get('RSI_BASE_MODELS_DIR', str(Path.home() / '.cache/rsi_anything/base_models'))).expanduser()
8
+ STATUS=['AC','WA','RE','TLE','CE']
9
+
10
+ def read(p):return json.loads(Path(p).read_text())
11
+ def lines(p):return [json.loads(x) for x in Path(p).open() if x.strip()]
12
+ def identity(x):return hashlib.sha256(json.dumps(x,sort_keys=True,ensure_ascii=False).encode()).hexdigest()
13
+ def seed(*parts):return int(identity(parts)[:8],16)%2147483647
14
+ def sha(p):
15
+ h=hashlib.sha256()
16
+ with Path(p).open('rb') as f:
17
+ for b in iter(lambda:f.read(2**20),b''):h.update(b)
18
+ return h.hexdigest()
19
+ def atomic(p,value):
20
+ p=Path(p);p.parent.mkdir(parents=True,exist_ok=True)
21
+ tmp=p.with_name(p.name+'.'+str(os.getpid())+'.'+uuid.uuid4().hex+'.tmp');tmp.write_text(json.dumps(value,ensure_ascii=False));tmp.replace(p)
22
+ def write_lines(p,rows):
23
+ p=Path(p);p.parent.mkdir(parents=True,exist_ok=True)
24
+ p.write_text(''.join(json.dumps(x,ensure_ascii=False)+'\n' for x in rows))
25
+ def cached(namespace,key,fn):
26
+ p=Path(os.environ.get('RSI_CODE_CACHE',str(Path.home()/'.cache/rsi_anything/code')))/namespace/(identity(key)+'.json');p.parent.mkdir(parents=True,exist_ok=True)
27
+ with p.with_suffix('.lock').open('a') as lock:
28
+ fcntl.flock(lock,fcntl.LOCK_EX)
29
+ if p.exists():
30
+ item=read(p);assert item['key']==key;return item['value']
31
+ value=fn();atomic(p,{'key':key,'value':value});return value
32
+
33
+ def summary(feedback):
34
+ results=feedback['results']
35
+ return dict(all_pass=bool(results) and all(x['status']=='AC' for x in results),pass_fraction=sum(x['status']=='AC' for x in results)/max(1,len(results)))
36
+ def format_feedback(feedback):
37
+ return json.dumps([{k:r[k] for k in ('test_id','status','actual','stderr')} for r in feedback['results']],ensure_ascii=False)
38
+ def context(task,current,feedback,candidate):
39
+ return ('Whole-training-suite execution forecast. Only public observations are supplied.\n'
40
+ f"Problem:\n{task['problem']}\nCurrent program:\n{current}\n"
41
+ f"Trusted previous public execution:\n{format_feedback(feedback)}\nCandidate action:\n{candidate}\nOfficial public test suite:\n"
42
+ +json.dumps(task['public_tests'],ensure_ascii=False))
code_repair/transfer/src/cure_wm.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ import os, resource, shutil, signal, subprocess, sys, tempfile, time
3
+ from pathlib import Path
4
+ from dataclasses import dataclass
5
+
6
+ @dataclass(frozen=True)
7
+ class TestCase:
8
+ input: str
9
+ expected: str
10
+ test_id: str
11
+
12
+ @dataclass(frozen=True)
13
+ class TestResult:
14
+ test_id: str
15
+ status: str
16
+ actual: str
17
+ expected: str
18
+ stderr: str
19
+ seconds: float
20
+
21
+ @dataclass(frozen=True)
22
+ class Execution:
23
+ results: tuple[TestResult, ...]
24
+ wall_seconds: float
25
+
26
+ @property
27
+ def all_pass(self) -> bool:
28
+ return bool(self.results) and all((r.status == 'AC' for r in self.results))
29
+
30
+ @property
31
+ def pass_fraction(self) -> float:
32
+ return sum((r.status == 'AC' for r in self.results)) / len(self.results) if self.results else 0.0
33
+
34
+ @dataclass(frozen=True)
35
+ class Candidate:
36
+ candidate_id: str
37
+ code: str
38
+
39
+ def _limits():
40
+ if sys.platform != 'linux':
41
+ return
42
+ resource.setrlimit(resource.RLIMIT_CPU, (10, 11))
43
+ resource.setrlimit(resource.RLIMIT_AS, (1024 ** 3, 1024 ** 3))
44
+ resource.setrlimit(resource.RLIMIT_FSIZE, (1024 ** 2, 1024 ** 2))
45
+ resource.setrlimit(resource.RLIMIT_NOFILE, (64, 64))
46
+
47
+ def _run_one(script: Path, test: TestCase, timeout: float, sandbox: str) -> TestResult:
48
+ started = time.monotonic()
49
+ if sandbox == 'required':
50
+ if not shutil.which('runuser') or not shutil.which('unshare'):
51
+ raise RuntimeError('Required runuser/unshare sandbox is unavailable')
52
+ cmd = [shutil.which('runuser'), '-u', 'nobody', '--', shutil.which('unshare'), '-Urn', '--', sys.executable, '-I', str(script)]
53
+ elif sandbox == 'local_test':
54
+ cmd = [sys.executable, '-I', str(script)]
55
+ else:
56
+ raise ValueError(f'unknown sandbox: {sandbox}')
57
+ env = {'PATH': '/usr/bin:/bin', 'PYTHONIOENCODING': 'utf-8', 'PYTHONDONTWRITEBYTECODE': '1'}
58
+ proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, start_new_session=True, preexec_fn=_limits, env=env)
59
+ try:
60
+ stdout, stderr = proc.communicate(test.input, timeout=timeout)
61
+ except subprocess.TimeoutExpired:
62
+ os.killpg(proc.pid, signal.SIGKILL)
63
+ proc.communicate()
64
+ return TestResult(test.test_id, 'TLE', '', test.expected, 'timeout', time.monotonic() - started)
65
+ elapsed = time.monotonic() - started
66
+ if proc.returncode:
67
+ return TestResult(test.test_id, 'RE', stdout[-1024:], test.expected, stderr[-2048:], elapsed)
68
+ status = 'AC' if stdout.strip() == test.expected.strip() else 'WA'
69
+ return TestResult(test.test_id, status, stdout[-1024:], test.expected, stderr[-2048:], elapsed)
70
+
71
+ def execute(code: str, tests: tuple[TestCase, ...], *, timeout: float=3.0, sandbox: str='required') -> Execution:
72
+ started = time.monotonic()
73
+ if not tests:
74
+ raise ValueError('Cannot execute an empty test suite')
75
+ if not code.strip():
76
+ results = tuple((TestResult(t.test_id, 'CE', '', t.expected, 'Empty candidate program', 0.0) for t in tests))
77
+ return Execution(results, time.monotonic() - started)
78
+ try:
79
+ compile(code, 'candidate.py', 'exec')
80
+ except SyntaxError as exc:
81
+ msg = f'{type(exc).__name__}: {exc.msg} (line {exc.lineno})'
82
+ results = tuple((TestResult(t.test_id, 'CE', '', t.expected, msg, 0.0) for t in tests))
83
+ return Execution(results, time.monotonic() - started)
84
+ with tempfile.TemporaryDirectory(prefix='cure_wm_') as tmp:
85
+ tmp_dir = Path(tmp)
86
+ tmp_dir.chmod(493)
87
+ script = tmp_dir / 'candidate.py'
88
+ script.write_text(code, encoding='utf-8')
89
+ script.chmod(420)
90
+ results = tuple((_run_one(script, test, timeout, sandbox) for test in tests))
91
+ return Execution(results, time.monotonic() - started)
code_repair/transfer/src/executor.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,os,signal,subprocess,tempfile,time
2
+ from pathlib import Path
3
+ from common import ROOT,cached,sha
4
+ SOURCE=Path(__file__).parent
5
+
6
+ def execute_uncached(task,code,tests):
7
+ if not tests:return dict(results=[],wall_seconds=0.,total_tests=0)
8
+ timeout=int(task['timeout']);budget=(timeout+1)*len(tests)+20
9
+ io={'inputs':[t['input'] for t in tests],'outputs':[t['expected'] for t in tests]}
10
+ if task['fn_name']:io['fn_name']=task['fn_name']
11
+ request=dict(dataset=task['dataset'],input_output=io,timeout=timeout,code=code)
12
+ start=time.monotonic()
13
+ with tempfile.TemporaryDirectory(prefix='rsi_official_judge_') as td:
14
+ root=Path(td);root.chmod(0o755);(root/'judge_child.py').write_bytes((SOURCE/'judge_child.py').read_bytes())
15
+ cmd=['unshare','-mnpf','--kill-child=KILL','--','/usr/bin/python3','-I',str(SOURCE/'sandbox_launch.py'),td,str(budget),str(ROOT/'vendor')]
16
+ proc=subprocess.Popen(cmd,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,start_new_session=True)
17
+ try:out,err=proc.communicate(json.dumps(request).encode(),timeout=budget+10)
18
+ except subprocess.TimeoutExpired:
19
+ os.killpg(proc.pid,signal.SIGKILL);out,err=proc.communicate(timeout=30)
20
+ value=dict(results=[-1] if task['dataset']=='apps' else [-3],metadata={'error':'global timeout'},seconds=budget,log='global timeout')
21
+ else:
22
+ if proc.returncode or not out:
23
+ if b'RSI_JUDGE_READY\n' not in err:raise RuntimeError(f'Judge infrastructure failed (exit {proc.returncode}): '+err.decode(errors='replace')[-2000:])
24
+ timed_out=proc.returncode in (-signal.SIGXCPU,128+signal.SIGXCPU) or (proc.returncode in (-signal.SIGKILL,128+signal.SIGKILL) and time.monotonic()-start>=budget*.9)
25
+ error='Execution process exceeded CPU timeout' if timed_out else f'Execution process exited without a result (exit {proc.returncode})'
26
+ raw_status=-1 if task['dataset']=='apps' else -3 if timed_out else -4
27
+ value=dict(results=[raw_status],metadata={'error':error,'process_exit_code':proc.returncode,'global_abort':True},seconds=time.monotonic()-start,log=error)
28
+ else:
29
+ try:value=json.loads(out)
30
+ except ValueError:raise RuntimeError('Malformed judge response: '+out.decode(errors='replace')[-300:])
31
+ raw=value['results'];meta=value['metadata'];results=[]
32
+ if task['dataset']=='apps' and len(raw)==1 and raw[0] is not True and isinstance(raw[0],int) and raw[0]<0:raw=raw*len(tests)
33
+ for i,x in enumerate(raw):
34
+ if i>=len(tests):raise RuntimeError('Too many official test results')
35
+ if x is True:status='AC'
36
+ elif x is False:status='WA'
37
+ elif task['dataset']=='apps':status='CE' if x==-2 else ('TLE' if 'timeout' in (value['log']+str(meta)).lower() or 'alarm went off' in value['log'] else 'RE')
38
+ else:status={-2:'WA',-3:'TLE',-4:'RE'}.get(x,'RE')
39
+ t=tests[i];actual=str(meta.get('output',''))[:1024] if i==len(raw)-1 else ''
40
+ results.append(dict(test_id=t['test_id'],status=status,actual=actual,expected=str(t['expected']),stderr=(str(meta.get('error_message',meta.get('error','')))+' '+value['log'])[-2048:] if status!='AC' else '',seconds=round(value['seconds']/max(1,len(raw)),4)))
41
+ return dict(results=results,wall_seconds=time.monotonic()-start,total_tests=len(tests),official_results=value['results'],official_metadata=meta)
42
+
43
+ def execute(task,code,tests):
44
+ key=dict(dataset=task['dataset'],fn_name=task['fn_name'],code=code,tests=tests,timeout=task['timeout'],runner_sha256=sha(SOURCE/'judge_child.py'),wrapper_sha256=sha(SOURCE/'executor.py'),checker_sha256=sha(ROOT/'vendor'/task['dataset']/'testing_util.py'))
45
+ return cached('execution',key,lambda:execute_uncached(task,code,tests))
code_repair/transfer/src/fixtures.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from cure_wm import Execution, TestResult
2
+
3
+ def execution_from_dict(payload):
4
+ return Execution(tuple((TestResult(**r) for r in payload['results'])), payload['wall_seconds'])
code_repair/transfer/src/judge_child.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import contextlib,importlib.util,io,json,sys,time,traceback,os,signal
2
+ sys.path[:0]=['/evaluator/apps']
3
+ sys.modules['IPython']=None # pyext's optional interactive integration is not part of judging.
4
+ sys.set_int_max_str_digits(0)
5
+ request=json.load(sys.stdin)
6
+ kind=request['dataset']
7
+ emergency_write,emergency_exit=os.write,os._exit
8
+ result_fd=os.dup(1)
9
+ with open('/dev/null','wb') as quiet_stdout:os.dup2(quiet_stdout.fileno(),1)
10
+ def emit_response(response):
11
+ payload=json.dumps(response,default=lambda x:x.item() if hasattr(x,'item') else str(x)).encode()
12
+ while payload:payload=payload[emergency_write(result_fd,payload):]
13
+ spec=importlib.util.spec_from_file_location('official_checker','/evaluator/'+kind+'/testing_util.py')
14
+ checker=importlib.util.module_from_spec(spec);spec.loader.exec_module(checker)
15
+ def cpu_limit_exceeded(signum,frame):
16
+ response=dict(results=[-1] if kind=='apps' else [-3],metadata={'error':'Global CPU timeout','global_abort':True},seconds=time.monotonic()-start,log='Global CPU timeout')
17
+ emit_response(response);emergency_exit(0)
18
+ signal.signal(signal.SIGXCPU,cpu_limit_exceeded)
19
+ sys.__stderr__.write('RSI_JUDGE_READY\n');sys.__stderr__.flush()
20
+ class Capture(io.StringIO):
21
+ def fileno(self):return 2
22
+ start=time.monotonic();capture=Capture();metadata={}
23
+ try:
24
+ with contextlib.redirect_stdout(capture),contextlib.redirect_stderr(capture):
25
+ if kind=='apps':
26
+ raw=checker.run_test(problem={'input_output':request['input_output']},test=request['code'],debug=False)
27
+ else:
28
+ raw,metadata=checker.run_test({'input_output':json.dumps(request['input_output'])},test=request['code'],debug=False,timeout=request['timeout'])
29
+ if raw is None:raw=[-2] if kind=='apps' else [-4]
30
+ result=[bool(x) if isinstance(x,bool) or type(x).__name__=='bool_' else int(x) for x in raw]
31
+ response=dict(results=result,metadata=metadata,seconds=time.monotonic()-start,log=capture.getvalue()[-2048:])
32
+ except BaseException as e:
33
+ response=dict(results=[-2] if kind=='apps' else [-4],metadata={'error':repr(e),'error_message':'Exception from official checker'},seconds=time.monotonic()-start,log=capture.getvalue()[-2048:])
34
+ emit_response(response);emergency_exit(0)
code_repair/transfer/src/models.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc, json, math, time
2
+ from common import ROOT, BASE, BASE_MODELS, cached, context, seed, identity, format_feedback, read, sha
3
+ from coder import FrozenCoder, extract_code
4
+
5
+ class Coder(FrozenCoder):
6
+
7
+ def __init__(self):
8
+ super().__init__(BASE_MODELS / 'ReasonFlux-Coder-7B')
9
+
10
+ def _generate(self, prompt, **kwargs):
11
+ ids = self.tokenizer.encode(prompt, add_special_tokens=False)
12
+ if len(ids) > 15000:
13
+ prompt = self.tokenizer.decode(ids[:5000]) + '\n[Context shortened to fit token budget]\n' + self.tokenizer.decode(ids[-10000:])
14
+ return super()._generate(prompt, **kwargs)
15
+
16
+ def proposal(self, task, run_seed, current=None, feedback=None, round_id=0):
17
+ n = 1 if current is None else 4
18
+ boundary = 'Implement the required callable named ' + task['fn_name'] + ' as a method of class Solution. Preserve the provided signature.\nStarter code:\n' + task['starter_code'] if task['fn_name'] else 'Write a complete Python script that reads standard input and prints to standard output.'
19
+ prompt = 'Solve the following programming task. ' + boundary + '\nReturn the complete solution in one ```python code block.\nProblem:\n' + task['problem']
20
+ if current is not None:
21
+ prompt += '\nCurrent implementation:\n```python\n' + current + '\n```\nObserved public test feedback:\n' + format_feedback(feedback) + '\nPublic examples:\n' + json.dumps(task['public_tests'], ensure_ascii=False) + '\nRevise the implementation using this feedback.'
22
+ key = dict(task=task['task_id'], prompt_sha=identity(prompt), fn_name=task['fn_name'], seed=run_seed, current=current, feedback=json.loads(format_feedback(feedback)) if feedback is not None else None, round=round_id, n=n, sampler='ReasonFlux-7B-temperature0.8-top_p0.95-max4096-v1')
23
+
24
+ def generate():
25
+ rows = self._generate(prompt, n=n, seed=seed(task['task_id'], run_seed, round_id, identity(current), 'initial' if current is None else 'repair'), max_new_tokens=4096)
26
+ return [dict(code=extract_code(r.text), text=r.text, input_tokens=r.input_tokens, output_tokens=r.output_tokens, seconds=r.seconds) for r in rows]
27
+ return cached('generation', key, generate)
28
+
29
+ class World:
30
+
31
+ def __init__(self, path):
32
+ from semantic_world import SemanticExecutionWorld
33
+ self.model = SemanticExecutionWorld.load(path, BASE_MODELS / 'Qwen2.5-Coder-3B-Instruct', device='cuda').eval()
34
+ self.identity = self.model.identity
35
+
36
+ def score(self, task, current, feedback, codes):
37
+ texts = [context(task, current, feedback, c) for c in codes]
38
+ tok = self.model.public_world.online.tokenizer
39
+ trimmed = []
40
+ for text in texts:
41
+ ids = tok.encode(text, add_special_tokens=False)
42
+ trimmed.append(text if len(ids) <= 16000 else tok.decode(ids[:4000]) + '\n[Context shortened]\n' + tok.decode(ids[-12000:]))
43
+ out = self.model.score_suite(trimmed)
44
+ values = out['utility'].detach().float().cpu().tolist()
45
+ if any((r['status'] != 'AC' for r in feedback['results'])):
46
+ for (i, code) in enumerate(codes):
47
+ if code == current:
48
+ values[i] = 0.25 * float(out['predicted_pass_fraction'][i])
49
+ assert all((math.isfinite(x) and 0 <= x <= 1.25 for x in values))
50
+ return values
code_repair/transfer/src/public_context.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import json
2
+
3
+ def feedback_text(feedback):
4
+ return json.dumps([{'test_id': r['test_id'], 'status': r['status'], 'actual': r['actual'][:1024], 'stderr': r['stderr'][:2048], 'seconds': round(r['seconds'], 4)} for r in feedback['results']], ensure_ascii=False)
code_repair/transfer/src/runner.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ from common import summary
3
+ from executor import execute
4
+ def public_execute(task, code):
5
+ return execute(task, code, task['public_tests'])
6
+
7
+ def eval_one(task, coder, method, run_seed, predictor, checkpoint_id):
8
+ initial = coder.proposal(task, run_seed)[0]
9
+ code = initial['code']
10
+ feedback = public_execute(task, code)
11
+ trace = []
12
+ for round_id in range(3):
13
+ if summary(feedback)['all_pass']:
14
+ break
15
+ proposed = coder.proposal(task, run_seed, code, feedback, round_id)
16
+ codes = [x['code'] for x in proposed] + [code]
17
+ if method == 'random':
18
+ scores = None
19
+ choice = random.Random(seed(task['task_id'], run_seed, round_id, 'random-choice')).randrange(4)
20
+ else:
21
+ scores = predictor.score(task, code, feedback, codes)
22
+ choice = max(range(4), key=lambda i: scores[i])
23
+ choice = choice if scores[choice] > scores[4] else 4
24
+ before = code
25
+ before_feedback = feedback
26
+ code = codes[choice]
27
+ feedback = public_execute(task, code)
28
+ trace.append(dict(round=round_id, current_code=before, feedback=before_feedback, candidates=proposed, scores=scores, selected_index=choice, visible=feedback))
29
+ return dict(task_id=task['task_id'], dataset=task['dataset'], seed=run_seed, method=method, world_identity=checkpoint_id, initial_code=initial['code'], final_code=code, trace=trace, final_public=feedback, hidden_tests_accessed=False, time=time.time())
code_repair/transfer/src/sandbox_launch.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os,sys,subprocess,resource
2
+ from pathlib import Path
3
+ root=Path(sys.argv[1]);budget=int(sys.argv[2]);vendor=Path(sys.argv[3])
4
+ subprocess.run(['mount','--make-rprivate','/'],check=True)
5
+ for name in ['usr','lib','lib64','bin']:
6
+ source=Path('/')/name
7
+ if source.is_symlink():(root/name).symlink_to(os.readlink(source))
8
+ elif source.exists():
9
+ (root/name).mkdir();subprocess.run(['mount','--bind',str(source),str(root/name)],check=True);subprocess.run(['mount','-o','remount,bind,ro',str(root/name)],check=True)
10
+ for name,source in [('evaluator',str(vendor))]:
11
+ (root/name).mkdir();subprocess.run(['mount','--bind',source,str(root/name)],check=True);subprocess.run(['mount','-o','remount,bind,ro',str(root/name)],check=True)
12
+ (root/'etc').mkdir();(root/'dev').mkdir();(root/'tmp').mkdir();(root/'tmp').chmod(0o777)
13
+ for name in ['null','zero','urandom','random']:
14
+ (root/'dev'/name).touch();subprocess.run(['mount','--bind','/dev/'+name,str(root/'dev'/name)],check=True)
15
+ for name in ['ld.so.cache','ld.so.conf']:
16
+ p=Path('/etc')/name
17
+ if p.exists():(root/'etc'/name).write_bytes(p.read_bytes())
18
+ os.chroot(root);os.chdir('/tmp');os.setgroups([]);os.setgid(65534);os.setuid(65534)
19
+ resource.setrlimit(resource.RLIMIT_CPU,(budget,budget+1));resource.setrlimit(resource.RLIMIT_AS,(6*1024**3,6*1024**3));resource.setrlimit(resource.RLIMIT_FSIZE,(8*1024**2,8*1024**2));resource.setrlimit(resource.RLIMIT_NOFILE,(64,64));resource.setrlimit(resource.RLIMIT_NPROC,(256,256))
20
+ env={'PATH':'/usr/bin:/bin','PYTHONIOENCODING':'utf-8','PYTHONDONTWRITEBYTECODE':'1','PYTHONHASHSEED':'0','OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','MKL_NUM_THREADS':'1'}
21
+ os.execve('/usr/bin/python3',['python3','-I','/judge_child.py'],env)