launchhelm 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.
Files changed (72) hide show
  1. launchhelm-0.1.0/.gitignore +12 -0
  2. launchhelm-0.1.0/CHANGELOG.md +54 -0
  3. launchhelm-0.1.0/LICENSE +201 -0
  4. launchhelm-0.1.0/PKG-INFO +193 -0
  5. launchhelm-0.1.0/README.md +156 -0
  6. launchhelm-0.1.0/benchmarks/README.md +44 -0
  7. launchhelm-0.1.0/benchmarks/__init__.py +5 -0
  8. launchhelm-0.1.0/benchmarks/pilot_workload.py +478 -0
  9. launchhelm-0.1.0/benchmarks/runtime.py +307 -0
  10. launchhelm-0.1.0/benchmarks/training_overhead.py +387 -0
  11. launchhelm-0.1.0/examples/__init__.py +1 -0
  12. launchhelm-0.1.0/examples/artifact_upload.py +25 -0
  13. launchhelm-0.1.0/examples/change_learning_rate.py +37 -0
  14. launchhelm-0.1.0/examples/experiment.py +72 -0
  15. launchhelm-0.1.0/examples/hf_trainer.py +54 -0
  16. launchhelm-0.1.0/examples/lightning_trainer.py +50 -0
  17. launchhelm-0.1.0/examples/log_run.py +16 -0
  18. launchhelm-0.1.0/examples/placeholder_trainer.py +170 -0
  19. launchhelm-0.1.0/examples/query_points.py +33 -0
  20. launchhelm-0.1.0/examples/rich_values.py +89 -0
  21. launchhelm-0.1.0/examples/system_metrics.py +24 -0
  22. launchhelm-0.1.0/examples/torch_checkpoint.py +55 -0
  23. launchhelm-0.1.0/examples/torch_ddp.py +53 -0
  24. launchhelm-0.1.0/examples/torch_quickstart.py +38 -0
  25. launchhelm-0.1.0/pyproject.toml +230 -0
  26. launchhelm-0.1.0/src/launchhelm/__init__.py +35 -0
  27. launchhelm-0.1.0/src/launchhelm/_version.py +5 -0
  28. launchhelm-0.1.0/src/launchhelm/client.py +1660 -0
  29. launchhelm-0.1.0/src/launchhelm/commands.py +231 -0
  30. launchhelm-0.1.0/src/launchhelm/env.py +70 -0
  31. launchhelm-0.1.0/src/launchhelm/errors.py +62 -0
  32. launchhelm-0.1.0/src/launchhelm/models.py +6546 -0
  33. launchhelm-0.1.0/src/launchhelm/py.typed +0 -0
  34. launchhelm-0.1.0/src/launchhelm/rich.py +807 -0
  35. launchhelm-0.1.0/src/launchhelm/runtime.py +1348 -0
  36. launchhelm-0.1.0/src/launchhelm/session.py +2824 -0
  37. launchhelm-0.1.0/src/launchhelm/store.py +893 -0
  38. launchhelm-0.1.0/src/launchhelm/system.py +213 -0
  39. launchhelm-0.1.0/src/launchhelm/torch/__init__.py +41 -0
  40. launchhelm-0.1.0/src/launchhelm/torch/_checkpoint.py +181 -0
  41. launchhelm-0.1.0/src/launchhelm/torch/_controls.py +306 -0
  42. launchhelm-0.1.0/src/launchhelm/torch/_dist.py +210 -0
  43. launchhelm-0.1.0/src/launchhelm/torch/_trainer.py +1167 -0
  44. launchhelm-0.1.0/src/launchhelm/torch/hf.py +172 -0
  45. launchhelm-0.1.0/src/launchhelm/torch/lightning.py +179 -0
  46. launchhelm-0.1.0/src/launchhelm/transport.py +197 -0
  47. launchhelm-0.1.0/src/launchhelm/values.py +325 -0
  48. launchhelm-0.1.0/tests/__init__.py +1 -0
  49. launchhelm-0.1.0/tests/exercise_query.py +97 -0
  50. launchhelm-0.1.0/tests/exercise_resume.py +60 -0
  51. launchhelm-0.1.0/tests/exercise_runtime.py +76 -0
  52. launchhelm-0.1.0/tests/exercise_torch_ddp.py +174 -0
  53. launchhelm-0.1.0/tests/fakes.py +432 -0
  54. launchhelm-0.1.0/tests/test_client.py +927 -0
  55. launchhelm-0.1.0/tests/test_commands.py +143 -0
  56. launchhelm-0.1.0/tests/test_contracts.py +122 -0
  57. launchhelm-0.1.0/tests/test_env.py +30 -0
  58. launchhelm-0.1.0/tests/test_examples.py +218 -0
  59. launchhelm-0.1.0/tests/test_pilot_workload.py +255 -0
  60. launchhelm-0.1.0/tests/test_placeholder_trainer.py +46 -0
  61. launchhelm-0.1.0/tests/test_query_models.py +138 -0
  62. launchhelm-0.1.0/tests/test_rich.py +624 -0
  63. launchhelm-0.1.0/tests/test_runtime.py +764 -0
  64. launchhelm-0.1.0/tests/test_semantic_roundtrip.py +21 -0
  65. launchhelm-0.1.0/tests/test_serialization.py +201 -0
  66. launchhelm-0.1.0/tests/test_session.py +2224 -0
  67. launchhelm-0.1.0/tests/test_store.py +309 -0
  68. launchhelm-0.1.0/tests/test_threading.py +189 -0
  69. launchhelm-0.1.0/tests/test_torch.py +1224 -0
  70. launchhelm-0.1.0/tests/test_torch_extras.py +199 -0
  71. launchhelm-0.1.0/tests/test_training_overhead.py +162 -0
  72. launchhelm-0.1.0/tests/test_transport.py +104 -0
@@ -0,0 +1,12 @@
1
+ .coverage
2
+ .coverage.*
3
+ htmlcov/
4
+ .mypy_cache/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .venv/
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.egg-info/
11
+ dist/
12
+ build/
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `launchhelm` Python SDK are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
+ and this project adheres to pre-1.0 semver: minor releases may break the
6
+ public surface until 1.0.0.
7
+
8
+ ## [0.1.0] - 2026-10-05
9
+
10
+ Initial public release.
11
+
12
+ ### Added
13
+
14
+ - `launchhelm.init`/`Run` session API: scalar logging with ordered steps,
15
+ `flush`/`close` durability levels, overflow modes (`drop_new`, `block`,
16
+ `raise`), run metadata, config attachment and resumable runs.
17
+ - Cooperative command runtime: `run.on` safe-point handlers, `run.sync`,
18
+ typed capabilities with schemas, journaled command outcomes (applied,
19
+ rejected, failed, `outcome_unknown` — never silently retried), and
20
+ command tombstones under a bounded journal budget.
21
+ - Local durability: SQLite spool with serialized-payload budgets and
22
+ crash recovery; server-acknowledged flush.
23
+ - Rich values: `Text`/`Image`/`Audio`/`Video`/`Table`/`Histogram` objects
24
+ inside `run.log`, and the run methods `text`, `image`, `audio`, `video`,
25
+ `media`, `upload_media`, `media_url`, `rows`, `log_table`, `histogram`,
26
+ and `histogram_counts`, producing the canonical `rich_text`,
27
+ `rich_media`, `rich_table`, and `rich_histogram` renderers. Native media
28
+ uploads run on a background thread through the run's durable
29
+ content-addressed spool (`media_spool_bytes`, default 256 MiB) before
30
+ the point is admitted; `flush()` waits for admission. Image sources
31
+ include paths, bytes, PIL images, and NumPy/torch arrays encoded to PNG.
32
+ - `Client.read_samples` for bounded renderer reads (`latest`, `at`,
33
+ `spread`, `index` select modes) with a media map of presigned downloads.
34
+ - Artifact capture: content-addressed uploads (multipart for large
35
+ payloads, 64 MiB part cap), digests verified against the server record.
36
+ - Scoped project opening: `project_id`/`LAUNCHHELM_PROJECT` selects the
37
+ project document directly for UI-issued project keys.
38
+ - `launchhelm.torch` adapter: `init`/`watch`/`step`/`log`/`log_reduced`,
39
+ tunables, built-in controls (`lr`, `weight_decay`, `grad_clip`,
40
+ `dropout`, `checkpoint`, `eval`), `clip_grad_norm_`, checkpoint
41
+ save/resume via `load_checkpoint("latest")`, and CPU-gloo verified DDP
42
+ semantics (per-rank participants, rank-0 logging, collective control
43
+ protocol, `DivergedStateError` on partial failure).
44
+ - `launchhelm.system`: periodic host and per-GPU metrics (psutil + NVML),
45
+ safe to run without torch.
46
+ - `launchhelm.torch.hf` and `launchhelm.torch.lightning` callbacks.
47
+ - Optional extras: `launchhelm[torch]`, `[system]`, `[hf]`, `[lightning]`.
48
+ The base package has no torch or numpy import.
49
+ - Typed package: `py.typed` ships with strict-checked source.
50
+
51
+ ### Notes
52
+
53
+ - Requires Python 3.11+. GPU/NCCL and multi-node training paths are not
54
+ yet qualified; FSDP checkpoints are refused with a clear error.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [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.
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: launchhelm
3
+ Version: 0.1.0
4
+ Summary: LaunchHelm client and cooperative workload runtime
5
+ Project-URL: Homepage, https://launchhelm.com
6
+ Project-URL: Documentation, https://launchhelm.com/docs/
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Keywords: cooperative,launchhelm,runtime,telemetry
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: httpx<1,>=0.28.1
22
+ Requires-Dist: jsonschema<5,>=4.25.1
23
+ Requires-Dist: referencing<1,>=0.36.2
24
+ Provides-Extra: hf
25
+ Requires-Dist: accelerate>=1.1; extra == 'hf'
26
+ Requires-Dist: torch>=2.5; extra == 'hf'
27
+ Requires-Dist: transformers>=4.46; extra == 'hf'
28
+ Provides-Extra: lightning
29
+ Requires-Dist: lightning>=2.4; extra == 'lightning'
30
+ Requires-Dist: torch>=2.5; extra == 'lightning'
31
+ Provides-Extra: system
32
+ Requires-Dist: nvidia-ml-py>=12.560; extra == 'system'
33
+ Requires-Dist: psutil>=6.1; extra == 'system'
34
+ Provides-Extra: torch
35
+ Requires-Dist: torch>=2.5; extra == 'torch'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # LaunchHelm
39
+
40
+ Training telemetry and live control for any Python or PyTorch loop — the
41
+ Python SDK for the hosted LaunchHelm service at
42
+ [launchhelm.com](https://launchhelm.com).
43
+
44
+ Requires Python 3.11 or later on macOS, Linux, or Windows.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install launchhelm
50
+ ```
51
+
52
+ | Extra | For |
53
+ | --- | --- |
54
+ | `launchhelm[torch]` | PyTorch adapter: watched trainer, live controls, DDP, checkpoints |
55
+ | `launchhelm[system]` | host metrics (psutil) and per-GPU stats (NVML) |
56
+ | `launchhelm[hf]` | `transformers.Trainer` callback (`launchhelm.torch.hf`) |
57
+ | `launchhelm[lightning]` | PyTorch Lightning callback (`launchhelm.torch.lightning`) |
58
+
59
+ ## Quickstart
60
+
61
+ In Mission Control, open the organization's **Projects** page and choose
62
+ **New project** — it creates the project and a project key in one step. The
63
+ credential is shown once; save it before leaving:
64
+
65
+ ```bash
66
+ export LAUNCHHELM_API_KEY=lh_... # shown once — never commit it
67
+ export LAUNCHHELM_ORGANIZATION=... # organization UUID
68
+ export LAUNCHHELM_PROJECT=... # project UUID
69
+ # export LAUNCHHELM_URL=https://launchhelm.com # optional; this is the default
70
+ ```
71
+
72
+ A `.env` file in the working directory or a parent works too; exported
73
+ shell variables take precedence. Then in the training script:
74
+
75
+ ```python
76
+ import launchhelm
77
+
78
+ with launchhelm.init("quickstart", config={"lr": 3e-4, "batch": 64}) as run:
79
+ for step in range(100):
80
+ loss = train_one_step()
81
+ run.log({"loss": loss}, step=step)
82
+ ```
83
+
84
+ The first argument is the project **name**, which must match the project
85
+ the key belongs to; `LAUNCHHELM_PROJECT` is that project's **UUID**. With
86
+ an organization-wide key, leave `LAUNCHHELM_PROJECT` unset and `init`
87
+ reuses or creates the named project in the organization catalog.
88
+
89
+ ## Rich values
90
+
91
+ Beyond scalars, a stream can carry rendered values — text, media, tables,
92
+ and histograms — via `run.log` with `Text`/`Image`/`Audio`/`Video`/`Table`/
93
+ `Histogram` objects or the matching run methods:
94
+
95
+ ```python
96
+ run.text("notes", "## epoch 4\nloss **0.25**", format="markdown")
97
+ run.image("frames", "confusion.png") # background upload + spool
98
+ run.log_table("sweep", [("lr", "number")], [[3e-4]])
99
+ run.histogram("grad", gradient_samples, bins=64)
100
+
101
+ result = client.read_samples("stream-id", select={"mode": "latest", "limit": 16})
102
+ ```
103
+
104
+ Native media uploads run off the training thread through the run's durable
105
+ spool; `flush()` waits for the artifact to exist before the point is
106
+ admitted. Sample reads return at most one point per axis value — the newest
107
+ write wins — so a text stream keeps one value per step, not an appended log.
108
+
109
+ ## PyTorch
110
+
111
+ `launchhelm.torch` is an optional adapter (`pip install "launchhelm[torch]"`)
112
+ for arbitrary training loops, including DDP. `import launchhelm` itself
113
+ never imports torch.
114
+
115
+ ```python
116
+ import launchhelm.torch as lht
117
+
118
+ tr = lht.init("urm-llm", config={"lr": 3e-4, "batch": 64})
119
+ model, optimizer = build()
120
+ tr.watch(model, optimizer, scheduler=sched)
121
+
122
+ for step in range(steps):
123
+ loss = train_one_step()
124
+ tr.clip_grad_norm_() # current (controllable) max norm
125
+ optimizer.step(); sched.step()
126
+ tr.step(loss=loss, samples=batch_size) # logs + services control; call on every rank
127
+
128
+ tr.save_checkpoint(extra={"epoch": epoch})
129
+ tr.finish()
130
+ ```
131
+
132
+ `tr.step` logs the built-in series (`train/loss`, `optim/lr/group<i>`,
133
+ `optim/grad_norm`, `perf/step_time_s`, `perf/samples_per_s`,
134
+ `perf/tokens_per_s`, `optim/loss_scale` with a watched `GradScaler`,
135
+ `cuda/max_memory_allocated_bytes` on CUDA) and services the `lht` safe
136
+ point: commands issued from the UI apply only inside `step`, never between
137
+ backward and `optimizer.step`. Registered controls: `lr` (scale or
138
+ absolute, scheduler-aware), `weight_decay`, `grad_clip`, `dropout`,
139
+ `checkpoint`, `eval` when `eval_fn` is passed to `watch`, and
140
+ `tr.tunable(name, ...)` for custom typed knobs.
141
+
142
+ Distributed: call `lht.init` on every rank — rank 0 opens the run and every
143
+ rank is a `rank-<r>` participant. `step` is a collective; a control applied
144
+ at a step applies on every rank at that step, keeping DDP replicas
145
+ identical, and a rank that fails the apply raises `DivergedStateError` on
146
+ all ranks after the command is journaled as `outcome_unknown`.
147
+
148
+ `save_checkpoint` writes a `torch.load(weights_only=True)`-safe payload —
149
+ model (DDP-unwrapped), optimizer, scheduler, scaler, step, per-rank RNG
150
+ streams, tunables, control state, `extra` — uploads it, and keeps it so a
151
+ crash-resume finds the latest. `load_checkpoint("latest")` restores
152
+ model/optimizer state identically on every rank plus each rank's own RNG
153
+ stream, and returns `extra`. Honest limits: GPU/NCCL/multi-node operation
154
+ is not yet qualified; FSDP/sharded models are refused with
155
+ `CheckpointError` (configure a full state dict first); NumPy's global RNG
156
+ requires legacy MT19937 state; sampler/data-iterator positions and
157
+ dataloader-worker state are the caller's responsibility — restoring
158
+ weights and global RNG alone does not faithfully reconstruct a shuffled or
159
+ multi-worker data pipeline.
160
+
161
+ System metrics without torch: `launchhelm.system.start(run, interval=15.0)`
162
+ (`launchhelm[system]`) emits CPU, RSS, disk/network rates (psutil) and
163
+ per-GPU stats (NVML) under `system/...` on a daemon thread that never
164
+ blocks logging.
165
+
166
+ Framework callbacks: `launchhelm.torch.hf.LaunchHelmCallback`
167
+ (`launchhelm[hf]` extra) and
168
+ `launchhelm.torch.lightning.LaunchHelmCallback` (`launchhelm[lightning]`
169
+ extra) wire the same init/log/control/checkpoint/finish lifecycle through
170
+ each framework's callback API.
171
+
172
+ ## Delivery guarantees
173
+
174
+ | Call | Guarantee |
175
+ | --- | --- |
176
+ | `run.log(...)` | admitted to volatile memory; acknowledged locally |
177
+ | `run.flush(delivered=False)` | durable in the local SQLite spool — survives process death |
178
+ | `run.flush()` | waits until the server has acknowledged the points (query-visible) |
179
+ | `run.close()` | persists the local queue; does **not** promise server delivery |
180
+
181
+ Memory and spool limits are serialized-payload budgets; SQLite, journal and
182
+ allocator overhead are separate. Command tombstones are retained under a
183
+ separate bounded journal budget; exhaustion fails closed. Unknown effects
184
+ are never automatically re-executed. On Windows the local spool's file
185
+ permissions come from the user profile's ACL rather than POSIX modes.
186
+
187
+ ## Links
188
+
189
+ - Documentation: [launchhelm.com/docs](https://launchhelm.com/docs/) —
190
+ [getting started](https://launchhelm.com/docs/getting-started/),
191
+ [Python guide](https://launchhelm.com/docs/python/),
192
+ [concepts](https://launchhelm.com/docs/concepts/)
193
+ - Changelog: `CHANGELOG.md`, shipped in the source distribution
@@ -0,0 +1,156 @@
1
+ # LaunchHelm
2
+
3
+ Training telemetry and live control for any Python or PyTorch loop — the
4
+ Python SDK for the hosted LaunchHelm service at
5
+ [launchhelm.com](https://launchhelm.com).
6
+
7
+ Requires Python 3.11 or later on macOS, Linux, or Windows.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install launchhelm
13
+ ```
14
+
15
+ | Extra | For |
16
+ | --- | --- |
17
+ | `launchhelm[torch]` | PyTorch adapter: watched trainer, live controls, DDP, checkpoints |
18
+ | `launchhelm[system]` | host metrics (psutil) and per-GPU stats (NVML) |
19
+ | `launchhelm[hf]` | `transformers.Trainer` callback (`launchhelm.torch.hf`) |
20
+ | `launchhelm[lightning]` | PyTorch Lightning callback (`launchhelm.torch.lightning`) |
21
+
22
+ ## Quickstart
23
+
24
+ In Mission Control, open the organization's **Projects** page and choose
25
+ **New project** — it creates the project and a project key in one step. The
26
+ credential is shown once; save it before leaving:
27
+
28
+ ```bash
29
+ export LAUNCHHELM_API_KEY=lh_... # shown once — never commit it
30
+ export LAUNCHHELM_ORGANIZATION=... # organization UUID
31
+ export LAUNCHHELM_PROJECT=... # project UUID
32
+ # export LAUNCHHELM_URL=https://launchhelm.com # optional; this is the default
33
+ ```
34
+
35
+ A `.env` file in the working directory or a parent works too; exported
36
+ shell variables take precedence. Then in the training script:
37
+
38
+ ```python
39
+ import launchhelm
40
+
41
+ with launchhelm.init("quickstart", config={"lr": 3e-4, "batch": 64}) as run:
42
+ for step in range(100):
43
+ loss = train_one_step()
44
+ run.log({"loss": loss}, step=step)
45
+ ```
46
+
47
+ The first argument is the project **name**, which must match the project
48
+ the key belongs to; `LAUNCHHELM_PROJECT` is that project's **UUID**. With
49
+ an organization-wide key, leave `LAUNCHHELM_PROJECT` unset and `init`
50
+ reuses or creates the named project in the organization catalog.
51
+
52
+ ## Rich values
53
+
54
+ Beyond scalars, a stream can carry rendered values — text, media, tables,
55
+ and histograms — via `run.log` with `Text`/`Image`/`Audio`/`Video`/`Table`/
56
+ `Histogram` objects or the matching run methods:
57
+
58
+ ```python
59
+ run.text("notes", "## epoch 4\nloss **0.25**", format="markdown")
60
+ run.image("frames", "confusion.png") # background upload + spool
61
+ run.log_table("sweep", [("lr", "number")], [[3e-4]])
62
+ run.histogram("grad", gradient_samples, bins=64)
63
+
64
+ result = client.read_samples("stream-id", select={"mode": "latest", "limit": 16})
65
+ ```
66
+
67
+ Native media uploads run off the training thread through the run's durable
68
+ spool; `flush()` waits for the artifact to exist before the point is
69
+ admitted. Sample reads return at most one point per axis value — the newest
70
+ write wins — so a text stream keeps one value per step, not an appended log.
71
+
72
+ ## PyTorch
73
+
74
+ `launchhelm.torch` is an optional adapter (`pip install "launchhelm[torch]"`)
75
+ for arbitrary training loops, including DDP. `import launchhelm` itself
76
+ never imports torch.
77
+
78
+ ```python
79
+ import launchhelm.torch as lht
80
+
81
+ tr = lht.init("urm-llm", config={"lr": 3e-4, "batch": 64})
82
+ model, optimizer = build()
83
+ tr.watch(model, optimizer, scheduler=sched)
84
+
85
+ for step in range(steps):
86
+ loss = train_one_step()
87
+ tr.clip_grad_norm_() # current (controllable) max norm
88
+ optimizer.step(); sched.step()
89
+ tr.step(loss=loss, samples=batch_size) # logs + services control; call on every rank
90
+
91
+ tr.save_checkpoint(extra={"epoch": epoch})
92
+ tr.finish()
93
+ ```
94
+
95
+ `tr.step` logs the built-in series (`train/loss`, `optim/lr/group<i>`,
96
+ `optim/grad_norm`, `perf/step_time_s`, `perf/samples_per_s`,
97
+ `perf/tokens_per_s`, `optim/loss_scale` with a watched `GradScaler`,
98
+ `cuda/max_memory_allocated_bytes` on CUDA) and services the `lht` safe
99
+ point: commands issued from the UI apply only inside `step`, never between
100
+ backward and `optimizer.step`. Registered controls: `lr` (scale or
101
+ absolute, scheduler-aware), `weight_decay`, `grad_clip`, `dropout`,
102
+ `checkpoint`, `eval` when `eval_fn` is passed to `watch`, and
103
+ `tr.tunable(name, ...)` for custom typed knobs.
104
+
105
+ Distributed: call `lht.init` on every rank — rank 0 opens the run and every
106
+ rank is a `rank-<r>` participant. `step` is a collective; a control applied
107
+ at a step applies on every rank at that step, keeping DDP replicas
108
+ identical, and a rank that fails the apply raises `DivergedStateError` on
109
+ all ranks after the command is journaled as `outcome_unknown`.
110
+
111
+ `save_checkpoint` writes a `torch.load(weights_only=True)`-safe payload —
112
+ model (DDP-unwrapped), optimizer, scheduler, scaler, step, per-rank RNG
113
+ streams, tunables, control state, `extra` — uploads it, and keeps it so a
114
+ crash-resume finds the latest. `load_checkpoint("latest")` restores
115
+ model/optimizer state identically on every rank plus each rank's own RNG
116
+ stream, and returns `extra`. Honest limits: GPU/NCCL/multi-node operation
117
+ is not yet qualified; FSDP/sharded models are refused with
118
+ `CheckpointError` (configure a full state dict first); NumPy's global RNG
119
+ requires legacy MT19937 state; sampler/data-iterator positions and
120
+ dataloader-worker state are the caller's responsibility — restoring
121
+ weights and global RNG alone does not faithfully reconstruct a shuffled or
122
+ multi-worker data pipeline.
123
+
124
+ System metrics without torch: `launchhelm.system.start(run, interval=15.0)`
125
+ (`launchhelm[system]`) emits CPU, RSS, disk/network rates (psutil) and
126
+ per-GPU stats (NVML) under `system/...` on a daemon thread that never
127
+ blocks logging.
128
+
129
+ Framework callbacks: `launchhelm.torch.hf.LaunchHelmCallback`
130
+ (`launchhelm[hf]` extra) and
131
+ `launchhelm.torch.lightning.LaunchHelmCallback` (`launchhelm[lightning]`
132
+ extra) wire the same init/log/control/checkpoint/finish lifecycle through
133
+ each framework's callback API.
134
+
135
+ ## Delivery guarantees
136
+
137
+ | Call | Guarantee |
138
+ | --- | --- |
139
+ | `run.log(...)` | admitted to volatile memory; acknowledged locally |
140
+ | `run.flush(delivered=False)` | durable in the local SQLite spool — survives process death |
141
+ | `run.flush()` | waits until the server has acknowledged the points (query-visible) |
142
+ | `run.close()` | persists the local queue; does **not** promise server delivery |
143
+
144
+ Memory and spool limits are serialized-payload budgets; SQLite, journal and
145
+ allocator overhead are separate. Command tombstones are retained under a
146
+ separate bounded journal budget; exhaustion fails closed. Unknown effects
147
+ are never automatically re-executed. On Windows the local spool's file
148
+ permissions come from the user profile's ACL rather than POSIX modes.
149
+
150
+ ## Links
151
+
152
+ - Documentation: [launchhelm.com/docs](https://launchhelm.com/docs/) —
153
+ [getting started](https://launchhelm.com/docs/getting-started/),
154
+ [Python guide](https://launchhelm.com/docs/python/),
155
+ [concepts](https://launchhelm.com/docs/concepts/)
156
+ - Changelog: `CHANGELOG.md`, shipped in the source distribution
@@ -0,0 +1,44 @@
1
+ # LaunchHelm Python SDK benchmarks
2
+
3
+ ## Training-overhead benchmark
4
+
5
+ From a repository checkout on macOS, Linux, or Windows, with a live server and a private
6
+ credential env file, run:
7
+
8
+ ```sh
9
+ uv sync --frozen --group frameworks
10
+ uv run --frozen --group frameworks python -m benchmarks.training_overhead \
11
+ --env /path/to/private.env --project quickstart --workload tiny \
12
+ --pairs 12 --out /tmp/launchhelm-overhead-tiny.json
13
+ uv run --frozen --group frameworks python -m benchmarks.training_overhead \
14
+ --env /path/to/private.env --project quickstart --workload small \
15
+ --pairs 12 --out /tmp/launchhelm-overhead-small.json
16
+ ```
17
+
18
+ `--project` is the project name associated with the key, not its UUID. Each
19
+ SDK trial creates and finishes a real run. Trials alternate baseline/SDK order
20
+ and report median and mean-step overhead, a paired bootstrap interval, setup,
21
+ flush and finish times, and per-trial host load and package versions. Every CPU
22
+ metric history must contain its expected steps, the runtime must report zero
23
+ drops, and paired final losses must match. Steps plus warmup cannot exceed
24
+ 10,000, the history limit. The driver refuses to start a trial when one-minute
25
+ host load is 15 or higher; stop unrelated workloads yourself or use an idle
26
+ host. Even below that gate, inspect the recorded load and variability before
27
+ interpreting results. These single-rank CPU measurements are not GPU/DDP,
28
+ public-deployment or capacity guarantees.
29
+
30
+ ## Hosted-pilot workload qualification
31
+
32
+ The maintained cohort harness uses the real SDK init/log/flush/finish path, with independent run/session state per producer. A private JSON manifest contains exactly one entry per producer with `url`, `api_key`, `organization_id`, `project_id` and `project` (the name). Keep this file outside source control with restricted permissions. Accounts are verified through `/v1/me`; shared-account development requires an explicit override and is not 100-user qualification.
33
+
34
+ ```sh
35
+ uv run --frozen python -m benchmarks.pilot_workload \
36
+ --manifest /path/to/private-cohort.json \
37
+ --state-dir /path/to/new-cohort-state \
38
+ --producers 100 --metrics 100 --ticks 1800 --interval 10 \
39
+ --phase synchronized --out /path/to/new-cohort-report.json
40
+ ```
41
+
42
+ The state directory and report must be new. The five-hour default represents 18 million scheduled points plus one warmup point per stream. `--phase staggered` spreads producer ticks evenly across the interval; synchronized mode exercises a 10,000-point burst. Setup and final full-data verification are outside the logging phase. The fixed schedule records lateness instead of hiding backpressure by lowering the offered rate. Reports include admission latency, receipt-attempt counters, a bounded latency histogram, attempted wire bytes, flush cost, drops and exact raw-history verification for every metric. Warmup/overall ingest counters are recorded separately; overall counters include drain and retries. Duplicate rows, missing ticks, wrong values, broken pagination and nonzero drops fail verification. Synthetic values are deterministic and vary by producer/metric/tick; they are not a promise of real workload compression.
43
+
44
+ This is SDK delivery/scheduling evidence, not an automatic capacity certificate, chart-freshness percentile, mixed dashboard/control test, or Oracle allocation proof. It creates and finishes real runs without deleting them. No native artifacts are uploaded. Qualification must run from a separate load-generator host and include server resource/disk measurements and recovery tests. Run `uv run --frozen pytest -q tests/test_pilot_workload.py` for harness correctness checks.
@@ -0,0 +1,5 @@
1
+ """LaunchHelm Python SDK microbenchmarks.
2
+
3
+ These scripts measure local runtime admission and spooling. They do not
4
+ establish capacity or latency targets for a deployed server.
5
+ """