cwtrain 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cwtrain-0.1.0/.gitignore +6 -0
- cwtrain-0.1.0/LICENSE +202 -0
- cwtrain-0.1.0/PKG-INFO +435 -0
- cwtrain-0.1.0/README.md +399 -0
- cwtrain-0.1.0/cwtrain/__init__.py +49 -0
- cwtrain-0.1.0/cwtrain/cli.py +441 -0
- cwtrain-0.1.0/cwtrain/errors.py +167 -0
- cwtrain-0.1.0/cwtrain/hotload/__init__.py +85 -0
- cwtrain-0.1.0/cwtrain/hotload/delta.py +270 -0
- cwtrain-0.1.0/cwtrain/hotload/errors.py +104 -0
- cwtrain-0.1.0/cwtrain/hotload/mirror.py +763 -0
- cwtrain-0.1.0/cwtrain/hotload/runner.py +506 -0
- cwtrain-0.1.0/cwtrain/hotload/snapshot.py +547 -0
- cwtrain-0.1.0/cwtrain/infra/__init__.py +73 -0
- cwtrain-0.1.0/cwtrain/infra/client.py +385 -0
- cwtrain-0.1.0/cwtrain/infra/lifecycle.py +210 -0
- cwtrain-0.1.0/cwtrain/infra/models.py +449 -0
- cwtrain-0.1.0/cwtrain/infra/storage.py +129 -0
- cwtrain-0.1.0/cwtrain/integrations/__init__.py +28 -0
- cwtrain-0.1.0/cwtrain/integrations/_env.py +107 -0
- cwtrain-0.1.0/cwtrain/integrations/launch.py +391 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/__init__.py +43 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/generation.py +284 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/gym.py +218 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/gym_model.py +158 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/weight_sync.py +412 -0
- cwtrain-0.1.0/cwtrain/integrations/nemo_rl/worker.py +416 -0
- cwtrain-0.1.0/cwtrain/integrations/preflight.py +88 -0
- cwtrain-0.1.0/cwtrain/integrations/rollout.py +630 -0
- cwtrain-0.1.0/cwtrain/integrations/slime.py +711 -0
- cwtrain-0.1.0/e2e/README.md +139 -0
- cwtrain-0.1.0/e2e/__init__.py +4 -0
- cwtrain-0.1.0/e2e/hotload.py +172 -0
- cwtrain-0.1.0/e2e/storage.py +146 -0
- cwtrain-0.1.0/pyproject.toml +81 -0
- cwtrain-0.1.0/tests/__init__.py +3 -0
- cwtrain-0.1.0/tests/conftest.py +466 -0
- cwtrain-0.1.0/tests/test_cli.py +610 -0
- cwtrain-0.1.0/tests/test_client.py +389 -0
- cwtrain-0.1.0/tests/test_delta.py +139 -0
- cwtrain-0.1.0/tests/test_e2e_lifecycle.py +410 -0
- cwtrain-0.1.0/tests/test_launch.py +326 -0
- cwtrain-0.1.0/tests/test_lifecycle.py +173 -0
- cwtrain-0.1.0/tests/test_mirror.py +736 -0
- cwtrain-0.1.0/tests/test_models.py +121 -0
- cwtrain-0.1.0/tests/test_nemo_gym.py +226 -0
- cwtrain-0.1.0/tests/test_nemo_gym_model.py +80 -0
- cwtrain-0.1.0/tests/test_nemo_rl.py +1246 -0
- cwtrain-0.1.0/tests/test_preflight.py +275 -0
- cwtrain-0.1.0/tests/test_rollout.py +667 -0
- cwtrain-0.1.0/tests/test_runner.py +493 -0
- cwtrain-0.1.0/tests/test_s3_endpoint.py +144 -0
- cwtrain-0.1.0/tests/test_s3_region.py +85 -0
- cwtrain-0.1.0/tests/test_slime_hook.py +898 -0
- cwtrain-0.1.0/tests/test_snapshot.py +522 -0
- cwtrain-0.1.0/tests/test_version.py +57 -0
- cwtrain-0.1.0/uv.lock +896 -0
cwtrain-0.1.0/.gitignore
ADDED
cwtrain-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
cwtrain-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cwtrain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Train against CoreWeave Dedicated Inference: deployments, checkpoint hot-load and rollouts for RL training loops
|
|
5
|
+
Project-URL: Homepage, https://github.com/coreweave/inference-cookbook
|
|
6
|
+
Project-URL: Repository, https://github.com/coreweave/inference-cookbook
|
|
7
|
+
Project-URL: Documentation, https://docs.coreweave.com/products/inference/rl-rollouts
|
|
8
|
+
Project-URL: Issues, https://github.com/coreweave/inference-cookbook/issues
|
|
9
|
+
Author: CoreWeave Applied Training
|
|
10
|
+
Author-email: Fuyuan Bie <fbie@coreweave.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: checkpoint,coreweave,dedicated-inference,grpo,hot-load,inference,llm,reinforcement-learning,rl,rollouts,vllm
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Requires-Dist: boto3>=1.34
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: zstandard>=0.21
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
32
|
+
Provides-Extra: nemo-rl
|
|
33
|
+
Requires-Dist: safetensors>=0.4; extra == 'nemo-rl'
|
|
34
|
+
Requires-Dist: torch>=2.4; extra == 'nemo-rl'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# cwtrain
|
|
38
|
+
|
|
39
|
+
`cwtrain` is the Python library and CLI for training against
|
|
40
|
+
[CoreWeave Dedicated Inference](https://docs.coreweave.com/products/inference/dedicated). In this
|
|
41
|
+
setup, the training loop gets its rollouts from a Dedicated Inference deployment, not from its own
|
|
42
|
+
inference engines. The library covers each part of the loop:
|
|
43
|
+
|
|
44
|
+
- **The deployment** (`cwtrain.infra`, `cwtrain deployment ...`): create the deployment that a run
|
|
45
|
+
samples from, wait until it serves, find the rollout URL, and delete it at the end.
|
|
46
|
+
- **Weight updates** (`cwtrain.hotload`, `cwtrain hotload ...`): after each training step, publish
|
|
47
|
+
the trainer's weights to the running deployment as a full checkpoint or a compressed delta. Then
|
|
48
|
+
wait until every replica serves them. This uses checkpoint hot-load from
|
|
49
|
+
[RL Rollouts](https://docs.coreweave.com/products/inference/rl-rollouts), so no redeploy is
|
|
50
|
+
needed.
|
|
51
|
+
- **Rollouts and frameworks** (`cwtrain.integrations`): a rollout sampler for the deployment's
|
|
52
|
+
OpenAI-compatible endpoint, the post-write hook for slime and miles, and the generation backend
|
|
53
|
+
and weight synchronizer for NeMo-RL.
|
|
54
|
+
|
|
55
|
+
The [NeMo Gym evaluation recipe](https://github.com/coreweave/inference-cookbook/blob/main/recipes/evaluation/nemo-gym/README.md)
|
|
56
|
+
uses the library without hot-load. `InferenceClient` and `cwtrain.infra.lifecycle` create and
|
|
57
|
+
clean up a temporary deployment. `RolloutConfig` holds the endpoint credentials and concurrency.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
Until `cwtrain` is on PyPI, install it from the repository:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install "cwtrain @ git+https://github.com/coreweave/inference-cookbook#subdirectory=libs/cwtrain"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For the NeMo-RL integration, install the `nemo-rl` extra instead. It adds torch and safetensors:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install "cwtrain[nemo-rl] @ git+https://github.com/coreweave/inference-cookbook#subdirectory=libs/cwtrain"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Both commands also install the `cwtrain` CLI. Then point it at your account and bucket:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export COREWEAVE_API_TOKEN=... # CoreWeave API token with the Inference Admin role
|
|
77
|
+
export AWS_ACCESS_KEY_ID=... # CoreWeave AI Object Storage credentials
|
|
78
|
+
export AWS_SECRET_ACCESS_KEY=...
|
|
79
|
+
export AWS_REGION=<bucket zone> # the bucket's CoreWeave Availability Zone, e.g. US-EAST-04A
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
When `COREWEAVE_API_TOKEN` is not set, `cwtrain` reads the token from `CW_API_TOKEN`, the variable
|
|
83
|
+
that the CoreWeave documentation exports.
|
|
84
|
+
|
|
85
|
+
## Prerequisites
|
|
86
|
+
|
|
87
|
+
RL Rollouts is in preview and is enabled per organization. To turn it on, contact CoreWeave
|
|
88
|
+
support and give your organization ID. Until it is on, creating a deployment with a `hotLoad`
|
|
89
|
+
section fails with `hot-load is not enabled for this organization`.
|
|
90
|
+
|
|
91
|
+
Create a new deployment with hot-load enabled. You can set hot-load only when you create a
|
|
92
|
+
deployment; you cannot add it to an existing one. The deployment needs:
|
|
93
|
+
|
|
94
|
+
- engine `dynamo-vllm`;
|
|
95
|
+
- a `hotLoad` section naming the snapshot `bucket`, an optional `pathPrefix`, and
|
|
96
|
+
`transitionMode: TRANSITION_MODE_ASYNC`;
|
|
97
|
+
- all of its gateways in one zone.
|
|
98
|
+
|
|
99
|
+
Your organization must own the bucket, and the bucket must have the bucket policy from the
|
|
100
|
+
Dedicated Inference docs
|
|
101
|
+
([Grant inference access to your bucket](https://docs.coreweave.com/products/inference/models#grant-inference-access-to-your-bucket)).
|
|
102
|
+
The policy gives the canonical inference service account `s3:ListBucket` and `s3:GetObject`. Add
|
|
103
|
+
a statement that lets your trainer's user write under the deployment's `pathPrefix`. The trainer
|
|
104
|
+
reads, writes with `s3:PutObject` (multipart for large files) and aborts its failed uploads. It
|
|
105
|
+
never deletes objects or changes the policy, so grant neither. The bucket can be empty when you
|
|
106
|
+
create the deployment, because the service validates snapshots at each hot-load request.
|
|
107
|
+
|
|
108
|
+
With the trainer's storage credentials, `cwtrain hotload check --deployment <id>` checks those
|
|
109
|
+
permissions before you train. It lists the prefix, reads a key and starts a multipart upload that
|
|
110
|
+
it aborts, so it leaves nothing behind. Trainer Jobs can run `python -m
|
|
111
|
+
cwtrain.integrations.preflight`, which does the same with the hooks' environment.
|
|
112
|
+
|
|
113
|
+
## Quick start
|
|
114
|
+
|
|
115
|
+
### Create the deployment
|
|
116
|
+
|
|
117
|
+
Put the `CreateDeploymentRequest` body in a file, such as the miles recipe's
|
|
118
|
+
[`deployment.example.json`](https://github.com/coreweave/inference-cookbook/blob/main/recipes/training/miles/deployment.example.json)
|
|
119
|
+
with its placeholders filled in, and create the deployment:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
cwtrain deployment parameters --gateway <gateway id> # versions, instance types, engine options
|
|
123
|
+
cwtrain deployment create --file deployment.json --wait
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`create` prints the deployment as JSON, with its `id` and its `rollout_base_url` for rollouts.
|
|
127
|
+
With `--wait`, it returns when the deployment is READY. This takes minutes, and longer for large
|
|
128
|
+
models.
|
|
129
|
+
|
|
130
|
+
### Publish weights
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from cwtrain import HotLoader, InferenceClient
|
|
134
|
+
|
|
135
|
+
loader = HotLoader(InferenceClient(), deployment_id="<deployment-uuid>")
|
|
136
|
+
|
|
137
|
+
# After saving a HuggingFace checkpoint for the current step:
|
|
138
|
+
hot_load = loader.publish("/ckpt/step_000100", identity="step_000100")
|
|
139
|
+
print(hot_load.state.name) # COMPLETED
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`publish` validates the directory and uploads it to the deployment's bucket and prefix. Then it
|
|
143
|
+
creates the hot-load and blocks until every replica serves the new weights. To get the pending
|
|
144
|
+
hot-load back at once, pass `wait=False` and call `loader.wait(hot_load.id)` later. To receive a
|
|
145
|
+
`ProgressEvent` on every poll, pass `on_progress=`.
|
|
146
|
+
|
|
147
|
+
### Manage the deployment from Python
|
|
148
|
+
|
|
149
|
+
The CLI's deployment commands use `cwtrain.infra`. A launcher can do the same:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
import json
|
|
153
|
+
|
|
154
|
+
from cwtrain.infra import InferenceClient, lifecycle
|
|
155
|
+
|
|
156
|
+
with open("deployment.json") as f:
|
|
157
|
+
spec = json.load(f)
|
|
158
|
+
with InferenceClient() as client:
|
|
159
|
+
deployment = client.create_deployment(spec)
|
|
160
|
+
try:
|
|
161
|
+
deployment = lifecycle.wait_for_deployment(client, deployment.id)
|
|
162
|
+
base_url = lifecycle.rollout_base_url(lifecycle.endpoints(client, deployment)[0])
|
|
163
|
+
... # train, with rollouts sent to base_url
|
|
164
|
+
finally:
|
|
165
|
+
lifecycle.delete_deployment(client, deployment.id) # it holds GPUs until deleted
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### CLI
|
|
169
|
+
|
|
170
|
+
The same tasks from the shell:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cwtrain deployment create --file deployment.json --wait # prints its id and rollout_base_url
|
|
174
|
+
cwtrain hotload publish --deployment <uuid> --checkpoint /ckpt/step_000100 --identity step_000100
|
|
175
|
+
# a delta already in the bucket under <pathPrefix>/step_000110/
|
|
176
|
+
cwtrain hotload trigger --deployment <uuid> --identity step_000110 --previous-identity step_000100
|
|
177
|
+
cwtrain hotload status <hot-load uuid>
|
|
178
|
+
cwtrain hotload list --deployment <uuid>
|
|
179
|
+
cwtrain hotload check --deployment <uuid> # the trainer's access to the snapshot prefix
|
|
180
|
+
cwtrain deployment delete <uuid> --wait
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The commands come in two groups, `cwtrain deployment` and `cwtrain hotload`:
|
|
184
|
+
|
|
185
|
+
| Command | What it does | Options (defaults) |
|
|
186
|
+
| --- | --- | --- |
|
|
187
|
+
| `deployment create` | Create a deployment from a `CreateDeploymentRequest` JSON body, such as a recipe's `deployment.run.json`, and print it with its gateways' `endpoints` and the `rollout_base_url` rollouts go to. A file that still holds a `<placeholder>` outside the free-form `runtime.engineConfig` and `runtime.engineEnv` is refused, and the request carries a client-chosen ID, so a retry cannot create a second deployment | `--file` (required; `-` reads stdin), `--wait` (until READY), `--timeout` (3600 s) |
|
|
188
|
+
| `deployment get <deployment id>` | Show a deployment, its hot-load settings, its endpoints and its `rollout_base_url` | |
|
|
189
|
+
| `deployment delete <deployment id>` | Delete a deployment | `--wait` (until it is gone), `--timeout` (600 s), `--ignore-not-found` |
|
|
190
|
+
| `deployment parameters` | List the runtime versions, instance types and engine options your organization can use | `--gateway` (repeatable: only what those gateways' zones offer) |
|
|
191
|
+
| `hotload inspect <dir>` | Validate a local checkpoint directory and print its type, files and size, and for a delta its predecessor; works offline, without credentials | `--previous-identity` |
|
|
192
|
+
| `hotload publish` | Upload a checkpoint, create the hot-load and wait for it | `--deployment`, `--checkpoint`, `--identity` (required); `--previous-identity`, `--reset-prompt-cache`, `--no-wait`, `--timeout` (1800 s), `--workers` (8 parallel uploads) |
|
|
193
|
+
| `hotload trigger` | Create the hot-load for a snapshot already in the bucket, and wait for it | `--deployment`, `--identity` (required); `--previous-identity`, `--reset-prompt-cache`, `--no-wait`, `--timeout` (1800 s) |
|
|
194
|
+
| `hotload wait <hot-load id>` | Block until a hot-load is completed, failed or canceled | `--timeout` (1800 s) |
|
|
195
|
+
| `hotload status <hot-load id>` | Show a hot-load and every replica's state | |
|
|
196
|
+
| `hotload list` | List hot-loads, newest first | `--deployment`, `--limit` (20) |
|
|
197
|
+
| `hotload check` | Check that the storage credentials can list, read and write the deployment's snapshot prefix, as a trainer does. It leaves nothing behind and names the S3 permission a refused call needs | `--deployment` (required) |
|
|
198
|
+
|
|
199
|
+
`--previous-identity` names the identity that a delta applies to. `trigger` needs it for a delta.
|
|
200
|
+
Without it, `publish` and `inspect` derive it from the delta's `base_version`, as described in
|
|
201
|
+
[Deltas](#deltas). `--reset-prompt-cache` requests the `PROMPT_CACHE_POLICY_RESET_ALL` policy, which
|
|
202
|
+
discards the KV cache computed with the earlier weights. Without it, the hot-load uses the API's
|
|
203
|
+
default, `PROMPT_CACHE_POLICY_PRESERVE`. `--no-wait` returns when the service accepts the
|
|
204
|
+
hot-load. Use `wait` to follow it later.
|
|
205
|
+
|
|
206
|
+
Put global options before the group, for example `cwtrain --verbose hotload list`:
|
|
207
|
+
|
|
208
|
+
- `--base-url`: the API origin. The default is `https://api.coreweave.com`.
|
|
209
|
+
- `--token`: the API token. The default is `$COREWEAVE_API_TOKEN`, else `$CW_API_TOKEN`.
|
|
210
|
+
- `--verbose`: debug logs, and tracebacks for operational failures.
|
|
211
|
+
|
|
212
|
+
CLI results are JSON on stdout. Logs and errors go to stderr. Exit codes are `0` for success,
|
|
213
|
+
`1` for operational failures (including failed hot-loads), and `2` for invalid arguments.
|
|
214
|
+
`--timeout` must be finite and greater than zero; `--workers` and `--limit` must be positive
|
|
215
|
+
integers.
|
|
216
|
+
|
|
217
|
+
## Hot-load
|
|
218
|
+
|
|
219
|
+
### What to expect
|
|
220
|
+
|
|
221
|
+
A hot-load completes when every replica serves the new weights. On large models this takes
|
|
222
|
+
minutes. By default, `publish` and the framework integrations wait for it. The first delta after a
|
|
223
|
+
full snapshot takes longer to load than the deltas that follow it. Every full snapshot uploads and
|
|
224
|
+
installs the whole model.
|
|
225
|
+
|
|
226
|
+
### Deltas
|
|
227
|
+
|
|
228
|
+
`cwtrain` detects a delta directory automatically. The identity that the delta applies to must be
|
|
229
|
+
the identity of a *completed* hot-load on the same deployment. Pass it as `previous_identity=`
|
|
230
|
+
(the CLI's `--previous-identity`). Without it, `publish` and `inspect_snapshot` take the delta's
|
|
231
|
+
numeric `base_version` and name it `weight_v{N:06d}`, which is how slime and miles name their
|
|
232
|
+
versions. For all other identities, such as `step_000100` above, always pass it.
|
|
233
|
+
|
|
234
|
+
Chains have limits. The API accepts at most 128 deltas after a full snapshot. Past that, it
|
|
235
|
+
returns `resolved snapshot chain is too long`. But a replica that starts with no peer to copy the
|
|
236
|
+
weights from replays the chain from object storage, and it handles at most 63 deltas. Publish a
|
|
237
|
+
full checkpoint at least every 64 versions. By default, the slime/miles hook and the NeMo-RL
|
|
238
|
+
synchronizer do this every 20 versions.
|
|
239
|
+
|
|
240
|
+
### Identities are immutable
|
|
241
|
+
|
|
242
|
+
Objects under an identity are never replaced. `upload_snapshot` (and so `publish` and
|
|
243
|
+
`HotLoader.upload`) writes the SHA-256 of every object into its metadata. When an identity already
|
|
244
|
+
has objects, each one must match the local file before anything is written. A matching partial
|
|
245
|
+
upload is completed, so a retry of an interrupted upload is safe and cheap. These cases raise
|
|
246
|
+
`SnapshotConflictError` and write nothing: different content, an object that cannot be verified,
|
|
247
|
+
or an object that is not part of the snapshot. To publish different weights, use a new identity.
|
|
248
|
+
|
|
249
|
+
### Rollback
|
|
250
|
+
|
|
251
|
+
The API has no rollback operation. `loader.rollback("step_000090")` gives one on the client side.
|
|
252
|
+
It creates a new hot-load for an identity from an earlier completed hot-load. It reuses that
|
|
253
|
+
snapshot type, so the chain resolves the same way. The objects must still be in the bucket.
|
|
254
|
+
|
|
255
|
+
### Concurrency
|
|
256
|
+
|
|
257
|
+
Only one hot-load can be active per deployment. By default, `HotLoader.trigger` and `publish` wait
|
|
258
|
+
for an active hot-load to finish. `InferenceClient.create_hot_load` raises
|
|
259
|
+
`HotLoadInProgressError` instead. Every create request has a client-generated `hot_load_id`. A
|
|
260
|
+
retry after a network failure returns the existing hot-load and does not start a second one.
|
|
261
|
+
|
|
262
|
+
## Snapshot layout
|
|
263
|
+
|
|
264
|
+
Every snapshot lives under `s3://<bucket>/<pathPrefix>/<identity>/`. An identity names one
|
|
265
|
+
version, such as `step_000100`: 1 to 128 characters forming a single path segment (no `/`, and
|
|
266
|
+
not `.` or `..`). The name `initial` is reserved for the deployment's base weights.
|
|
267
|
+
|
|
268
|
+
| Type | Contents |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| Full | A HuggingFace safetensors checkpoint: `config.json`, `model.safetensors.index.json`, `*.safetensors` shards |
|
|
271
|
+
| Delta (API type `INCREMENTAL`) | A zstd-compressed XOR delta with Adler-32 checksums against the previous snapshot: `model.safetensors.index.json` plus `*.safetensors` shards. slime writes this layout with `--update-weight-mode delta --update-weight-transport disk --update-weight-delta-encoding xor --update-weight-delta-checksum adler32`, and miles with `--update-weight-transfer-mode disk-delta --update-weight-delta-encoding xor --update-weight-delta-checksum adler32`. These flags select the format; each recipe lists the full set its framework needs, including slime's `--update-weight-standalone-publish` from the recipe's patch. |
|
|
272
|
+
|
|
273
|
+
`inspect_snapshot` checks the layout before the upload. It tells the two types apart by the
|
|
274
|
+
`delta_encoding` key in the index file's `metadata`. It checks that:
|
|
275
|
+
|
|
276
|
+
- the required files are there;
|
|
277
|
+
- the index is well formed;
|
|
278
|
+
- every shard in the index is a `*.safetensors` file directly inside the directory (subdirectories
|
|
279
|
+
are not uploaded);
|
|
280
|
+
- a delta uses the one encoding, compression and checksum combination that the API accepts.
|
|
281
|
+
|
|
282
|
+
It does not read tensor contents, decode deltas, or verify checksums. So a snapshot that passes
|
|
283
|
+
can still be refused by the engine, whose checks are described below. A delta that changes no
|
|
284
|
+
tensors has no shards and cannot be uploaded. The framework integrations skip such versions.
|
|
285
|
+
|
|
286
|
+
### What lands in the bucket
|
|
287
|
+
|
|
288
|
+
A run that publishes a full snapshot and then one delta leaves this under the deployment's prefix.
|
|
289
|
+
`_manifests/` holds optional per-version checksum records (see `HotLoader.upload_manifest`).
|
|
290
|
+
|
|
291
|
+
```text
|
|
292
|
+
s3://my-bucket/rl/qwen3-4b/
|
|
293
|
+
├── step_000100/ full snapshot
|
|
294
|
+
│ ├── config.json
|
|
295
|
+
│ ├── generation_config.json
|
|
296
|
+
│ ├── model.safetensors.index.json
|
|
297
|
+
│ ├── model-00001-of-00002.safetensors
|
|
298
|
+
│ ├── model-00002-of-00002.safetensors
|
|
299
|
+
│ └── tokenizer.json, tokenizer_config.json, ...
|
|
300
|
+
├── step_000101/ delta against step_000100
|
|
301
|
+
│ ├── model.safetensors.index.json
|
|
302
|
+
│ └── model-00000-of-00001.safetensors
|
|
303
|
+
└── _manifests/
|
|
304
|
+
└── step_000101.json
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Full snapshot.** An ordinary HuggingFace checkpoint. It can have per-tensor checksums, as the
|
|
308
|
+
snapshots from `WeightMirror.write_full_snapshot` do. Then the index says so, and every shard header
|
|
309
|
+
lists the Adler-32 of each tensor's bytes. The engine verifies each tensor on install:
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"metadata": {"total_size": 8044936192, "checksum_format": "adler32"},
|
|
314
|
+
"weight_map": {
|
|
315
|
+
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
|
316
|
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"__metadata__": {
|
|
324
|
+
"format": "pt",
|
|
325
|
+
"model.embed_tokens.weight": "45971a16",
|
|
326
|
+
"model.layers.0.mlp.down_proj.weight": "df031f77"
|
|
327
|
+
},
|
|
328
|
+
"model.embed_tokens.weight": {"dtype": "BF16", "shape": [151936, 2560], "data_offsets": [0, 777912320]},
|
|
329
|
+
"model.layers.0.mlp.down_proj.weight": {"dtype": "BF16", "shape": [2560, 9728], "data_offsets": [777912320, 827719680]}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Delta.** Only the tensors that changed. Each one is a standalone zstd frame of the XOR of its new
|
|
334
|
+
and old bytes, so the header records opaque `U8` blobs of the compressed length. The header's
|
|
335
|
+
`__metadata__` holds the Adler-32 of each tensor's *new* bytes. The engine checks these after it
|
|
336
|
+
applies the delta, so a wrong base or a corrupt blob fails the hot-load. slime and miles number
|
|
337
|
+
versions with their own counters (`000001`). As the platform requires, `upload_snapshot` changes
|
|
338
|
+
`version` and `base_version` in the uploaded index to the snapshot identities. It does not change
|
|
339
|
+
the shards:
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"metadata": {
|
|
344
|
+
"version": "step_000101",
|
|
345
|
+
"base_version": "step_000100",
|
|
346
|
+
"delta_encoding": "xor",
|
|
347
|
+
"compression_format": "zstd",
|
|
348
|
+
"checksum_format": "adler32"
|
|
349
|
+
},
|
|
350
|
+
"weight_map": {
|
|
351
|
+
"model.layers.0.mlp.down_proj.weight": "model-00000-of-00001.safetensors"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"__metadata__": {"model.layers.0.mlp.down_proj.weight": "db401f66"},
|
|
359
|
+
"model.layers.0.mlp.down_proj.weight": {"dtype": "U8", "shape": [1704248], "data_offsets": [0, 1704248]}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
The checksums, sizes and offsets above are examples. A tensor that is not in a delta's
|
|
364
|
+
`weight_map` is unchanged. The delta format is slime's disk-delta convention on top of plain
|
|
365
|
+
safetensors. Its reference is slime's
|
|
366
|
+
[delta weight sync documentation](https://github.com/THUDM/slime/blob/main/docs/en/advanced/delta-weight-sync.md).
|
|
367
|
+
|
|
368
|
+
## Layers
|
|
369
|
+
|
|
370
|
+
| Layer | Use it when |
|
|
371
|
+
| --- | --- |
|
|
372
|
+
| `cwtrain.infra.InferenceClient` | You want the raw API, one call per method. Gateways: `create_gateway`, `get_gateway`, `list_gateways`, `delete_gateway`, `get_gateway_parameters`. Deployments: `create_deployment`, `get_deployment`, `list_deployments`, `delete_deployment`, `get_deployment_parameters`. Hot-loads: `create_hot_load`, `get_hot_load`, `list_hot_loads`, `list_hot_load_replicas`, `cancel_hot_load`. They return typed `Gateway`, `Deployment` and `HotLoad` objects, each with the wire object in `raw`. Every create carries a client-chosen ID, so a retry returns what an earlier attempt created rather than creating a second resource. |
|
|
373
|
+
| `cwtrain.infra.lifecycle` | You manage the deployment from code: `wait_for_gateway` and `wait_for_deployment` block until READY, `delete_gateway` and `delete_deployment` until it is gone, and `endpoints` and `rollout_base_url` give the URL rollouts go to. |
|
|
374
|
+
| `inspect_snapshot` / `upload_snapshot` | You manage uploads yourself, for example from a post-write hook that already has the checkpoint path. |
|
|
375
|
+
| `HotLoader` | You want one call per training step. |
|
|
376
|
+
|
|
377
|
+
API errors map to the API's status codes and are in `cwtrain.errors` (`NotFoundError`,
|
|
378
|
+
`AlreadyExistsError`, `FailedPreconditionError`, `HotLoadInProgressError`, ...). Every error that
|
|
379
|
+
the library raises derives from `cwtrain.errors.CWTrainError`.
|
|
380
|
+
|
|
381
|
+
## Integrations
|
|
382
|
+
|
|
383
|
+
| Framework | Entry point | Recipe |
|
|
384
|
+
| --- | --- | --- |
|
|
385
|
+
| miles | `--custom-update-weight-post-write-path cwtrain.integrations.slime.hook` plus the recipe's rollout function | [`recipes/training/miles/`](https://github.com/coreweave/inference-cookbook/blob/main/recipes/training/miles/README.md) |
|
|
386
|
+
| slime | same hook, `--update-weight-standalone-publish` (patch in the recipe) plus the recipe's rollout function | [`recipes/training/slime/`](https://github.com/coreweave/inference-cookbook/blob/main/recipes/training/slime/README.md) |
|
|
387
|
+
| NeMo-RL | `policy.generation.backend: coreweave` (`cwtrain.integrations.nemo_rl.CoreWeaveGeneration`), `HotLoadWeightSynchronizer` attached to it, `CoreWeaveDTensorPolicyWorker` as `worker_extension_cls_fqn`; the recipe's patches register the backend and the optional NeMo Gym rollouts | [`recipes/training/nemo-rl/`](https://github.com/coreweave/inference-cookbook/blob/main/recipes/training/nemo-rl/README.md) |
|
|
388
|
+
|
|
389
|
+
`cwtrain.integrations.slime.hook` publishes each `weight_vNNNNNN` directory that the trainer
|
|
390
|
+
writes. In delta mode, it does the following:
|
|
391
|
+
|
|
392
|
+
1. It publishes `--hf-checkpoint` as the full chain root.
|
|
393
|
+
2. It publishes every delta as an incremental snapshot chained to the previous version.
|
|
394
|
+
3. Every `CWTRAIN_HOTLOAD_FULL_EVERY`-th version (default 20), it publishes a full snapshot that it
|
|
395
|
+
rebuilds from a local mirror (`cwtrain.hotload.WeightMirror`).
|
|
396
|
+
|
|
397
|
+
You configure the hook with `CWTRAIN_HOTLOAD_*` environment variables. It blocks rank 0 until the
|
|
398
|
+
hot-load completes. The platform reports completion only when every replica serves the new
|
|
399
|
+
weights.
|
|
400
|
+
|
|
401
|
+
`cwtrain.integrations.rollout` is the rollout sampler that every recipe uses, for all frameworks.
|
|
402
|
+
It sends one `/v1/completions` request per GRPO group to the deployment's gateway or in-cluster
|
|
403
|
+
frontend. It retries failed requests. Where the endpoint supports them, it uses token-id prompts
|
|
404
|
+
and exact response token IDs. `RolloutConfig` reads its settings (endpoint, model, API key and
|
|
405
|
+
concurrency) from `CWTRAIN_ROLLOUT_*` environment variables.
|
|
406
|
+
|
|
407
|
+
`cwtrain.hotload.delta` has two functions that the NeMo-RL synchronizer uses to publish.
|
|
408
|
+
`write_delta` turns two full HF checkpoints into the zstd XOR delta format that slime and miles
|
|
409
|
+
write. `write_full_snapshot` copies a checkpoint into a checksummed full snapshot. Install the
|
|
410
|
+
`nemo-rl` extra for torch and safetensors.
|
|
411
|
+
|
|
412
|
+
## Configuration
|
|
413
|
+
|
|
414
|
+
| Setting | Source | Default |
|
|
415
|
+
| --- | --- | --- |
|
|
416
|
+
| API token | `InferenceClient(token=...)`, the CLI's `--token`, `COREWEAVE_API_TOKEN`, or `CW_API_TOKEN` (the name the CoreWeave documentation uses) | required |
|
|
417
|
+
| API origin | `InferenceClient(base_url=...)`, the CLI's `--base-url`, or `COREWEAVE_API_URL` for the slime/miles hook and the NeMo-RL synchronizer | `https://api.coreweave.com` |
|
|
418
|
+
| Object storage endpoint | `s3_client(endpoint_url=...)`, then `CW_S3_ENDPOINT`, then the AWS configuration (`AWS_ENDPOINT_URL_S3`, `AWS_ENDPOINT_URL`, or the profile's `endpoint_url` or `services` section), even an AWS endpoint; `ignore_configured_endpoint_urls` turns the AWS configuration's endpoints off | `https://cwobject.com`; inside a CoreWeave cluster `http://cwlota.com` caches reads but does not speed up uploads |
|
|
419
|
+
| Object storage credentials | standard boto3 chain | |
|
|
420
|
+
| Object storage region: the bucket's CoreWeave Availability Zone | `s3_client(region_name=...)`, `AWS_REGION`, `AWS_DEFAULT_REGION`, or the profile's `region` | required |
|
|
421
|
+
| Hot-load integrations | `CWTRAIN_HOTLOAD_*`: deployment, run ID, waiting, timeout, full-snapshot interval, mirror and prompt-cache policy; the full list is in the docstring of `cwtrain.integrations.slime` | see the docstring |
|
|
422
|
+
| Rollout sampler | `CWTRAIN_ROLLOUT_*`: endpoint, model, API key or key file, concurrency, timeouts and retries, log-probs and token ids; the full list is in the docstring of `cwtrain.integrations.rollout` | see the docstring |
|
|
423
|
+
|
|
424
|
+
## Test servers
|
|
425
|
+
|
|
426
|
+
`InferenceClient` accepts extra request headers (`headers=`) and a TLS verification override
|
|
427
|
+
(`verify=`). The slime/miles hook and the NeMo-RL synchronizer read them from
|
|
428
|
+
`CWTRAIN_API_HEADERS` (a JSON object) and `CWTRAIN_API_INSECURE` (`1`, `true`, `yes` or `on`).
|
|
429
|
+
These settings are for tests against servers other than the CoreWeave API. The CoreWeave API needs
|
|
430
|
+
only the Bearer token, so leave both unset when you use it.
|
|
431
|
+
|
|
432
|
+
## Contributing
|
|
433
|
+
|
|
434
|
+
[CONTRIBUTING.md](https://github.com/coreweave/inference-cookbook/blob/main/CONTRIBUTING.md)
|
|
435
|
+
describes how to run the library's checks, how to publish releases, and the live hot-load test.
|