lowcomm 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.
- lowcomm-0.1.0/LICENSE +202 -0
- lowcomm-0.1.0/PKG-INFO +145 -0
- lowcomm-0.1.0/README.md +127 -0
- lowcomm-0.1.0/pyproject.toml +53 -0
- lowcomm-0.1.0/src/lowcomm/__init__.py +5 -0
- lowcomm-0.1.0/src/lowcomm/cli.py +456 -0
- lowcomm-0.1.0/src/lowcomm/connector/__init__.py +1 -0
- lowcomm-0.1.0/src/lowcomm/connector/agent.py +218 -0
- lowcomm-0.1.0/src/lowcomm/connector/batch.py +73 -0
- lowcomm-0.1.0/src/lowcomm/connector/coordinator.py +261 -0
- lowcomm-0.1.0/src/lowcomm/connector/errors.py +72 -0
- lowcomm-0.1.0/src/lowcomm/connector/http.py +633 -0
- lowcomm-0.1.0/src/lowcomm/connector/probe.py +31 -0
- lowcomm-0.1.0/src/lowcomm/connector/rooms.py +197 -0
- lowcomm-0.1.0/src/lowcomm/connector/tls.py +149 -0
- lowcomm-0.1.0/src/lowcomm/connector/wire.py +95 -0
- lowcomm-0.1.0/src/lowcomm/py.typed +0 -0
- lowcomm-0.1.0/src/lowcomm/training/__init__.py +1 -0
- lowcomm-0.1.0/src/lowcomm/training/data.py +96 -0
- lowcomm-0.1.0/src/lowcomm/training/model.py +114 -0
- lowcomm-0.1.0/src/lowcomm/training/schedule.py +35 -0
- lowcomm-0.1.0/src/lowcomm/training/trainer.py +117 -0
- lowcomm-0.1.0/src/lowcomm/workloads/__init__.py +1 -0
- lowcomm-0.1.0/src/lowcomm/workloads/hf.py +158 -0
- lowcomm-0.1.0/src/lowcomm/workloads/inference.py +110 -0
lowcomm-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.
|
lowcomm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lowcomm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Low-communication (DiLoCo-style) training across heterogeneous, unreliable GPUs.
|
|
5
|
+
Author: Omdeep Borkar
|
|
6
|
+
Author-email: Omdeep Borkar <omdeeborkar@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: torch>=2.5
|
|
10
|
+
Requires-Dist: numpy>=1.26
|
|
11
|
+
Requires-Dist: psutil>=5.9
|
|
12
|
+
Requires-Dist: transformers>=4.56 ; extra == 'inference'
|
|
13
|
+
Requires-Dist: cryptography>=42 ; extra == 'tls'
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Provides-Extra: inference
|
|
16
|
+
Provides-Extra: tls
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# lowcomm
|
|
20
|
+
|
|
21
|
+
## Motivation
|
|
22
|
+
|
|
23
|
+
Millions of GPUs sit fragmented and underused in personal machines,
|
|
24
|
+
universities, labs and clouds, while independent researchers can't afford
|
|
25
|
+
the clusters modern training needs. The long-term vision is to make the
|
|
26
|
+
internet itself a collaborative infrastructure for training AI: scattered,
|
|
27
|
+
heterogeneous machines that come and go, joined into one training run.
|
|
28
|
+
|
|
29
|
+
## What this project is
|
|
30
|
+
|
|
31
|
+
lowcomm is a GPU connector. It joins scattered, unreliable GPU machines
|
|
32
|
+
(behind NAT, different hardware, coming and going) into one pool you can
|
|
33
|
+
submit work to. Low-communication (DiLoCo-style) training is the main
|
|
34
|
+
workload being built on top of it.
|
|
35
|
+
|
|
36
|
+
**Status:** early development. This README lists only what exists and is
|
|
37
|
+
tested (on CPU, localhost):
|
|
38
|
+
|
|
39
|
+
Connector (`lowcomm.connector`):
|
|
40
|
+
- A coordinator that hands out tasks under leases. A lease stays alive only
|
|
41
|
+
while its node names it in heartbeats. When a node dies or goes silent,
|
|
42
|
+
its tasks are retried on another node, up to a configured attempt limit.
|
|
43
|
+
Completing a task is idempotent, and stale results are rejected.
|
|
44
|
+
- Tasks are matched to nodes by workload kind and by numeric capability
|
|
45
|
+
requirements (e.g. minimum VRAM). Capabilities are measured on the node.
|
|
46
|
+
- An HTTP transport. Nodes only make outbound requests. Messages are framed
|
|
47
|
+
as JSON metadata plus a raw payload with a SHA-256 checksum, never pickle.
|
|
48
|
+
Every request needs a room key (see Rooms), unknown keys are rejected, and
|
|
49
|
+
body sizes are limited. The client never follows redirects, so the key
|
|
50
|
+
can't be forwarded elsewhere.
|
|
51
|
+
- Built-in TLS for a coordinator with a public IP (a VPS, or a router port
|
|
52
|
+
forward). `--tls-self-signed` creates a certificate once and room codes
|
|
53
|
+
carry its fingerprint. Nodes accept only that certificate, and check it
|
|
54
|
+
before sending their key. `--tls-cert/--tls-key` take a real certificate.
|
|
55
|
+
- A node agent: heartbeats, and retries with backoff when the coordinator
|
|
56
|
+
is unreachable, including when a proxy or tunnel answers with its own
|
|
57
|
+
error page. It
|
|
58
|
+
re-registers after a coordinator restart and reports workload crashes so
|
|
59
|
+
the task is retried. It stops loudly on errors it can't recover from,
|
|
60
|
+
instead of hanging.
|
|
61
|
+
|
|
62
|
+
Known limits:
|
|
63
|
+
- Tasks live in memory only, so a coordinator restart loses them; rooms
|
|
64
|
+
and keys survive.
|
|
65
|
+
- Keys are sent as bearer tokens, so anyone on the path who can read the
|
|
66
|
+
TLS-terminated traffic (e.g. a tunnel provider) can see them.
|
|
67
|
+
- The client refuses plain HTTP to anything but loopback. TLS comes from a
|
|
68
|
+
tunnel or from the coordinator itself. See
|
|
69
|
+
[docs/connecting.md](docs/connecting.md) for Tailscale, ngrok and VPS
|
|
70
|
+
setups; only the VPS mode has run, on a LAN address.
|
|
71
|
+
|
|
72
|
+
Batch inference (`lowcomm.workloads`):
|
|
73
|
+
- Text generation with any Hugging Face causal LM, chunked into tasks
|
|
74
|
+
across the pool, with results returned in prompt order. Models are cached
|
|
75
|
+
on each node. Uses fp16 on GPU and fp32 on CPU. `trust_remote_code` is
|
|
76
|
+
always off.
|
|
77
|
+
- Each result records the device, tokens generated, generation time and
|
|
78
|
+
model-load time.
|
|
79
|
+
|
|
80
|
+
Rooms (`lowcomm.connector.rooms`):
|
|
81
|
+
- One coordinator hosts isolated **rooms**. Each room has an **owner key**
|
|
82
|
+
(submits work, reads results, can also run nodes) and a **join key** (can
|
|
83
|
+
only run nodes). Only SHA-256 hashes of keys are stored, in a rooms file
|
|
84
|
+
readable only by its owner. Rooms survive a coordinator restart.
|
|
85
|
+
- A **room code** (`lowcomm1:...`) packs the coordinator URL and a key into
|
|
86
|
+
one string.
|
|
87
|
+
- Rooms are created and closed through a separate admin server that only
|
|
88
|
+
listens on loopback. Closing a room revokes its keys immediately, and its
|
|
89
|
+
nodes exit with an error.
|
|
90
|
+
|
|
91
|
+
Command line (`lowcomm`):
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
export LOWCOMM_ADMIN_KEY=$(lowcomm key)
|
|
95
|
+
lowcomm coordinator # rooms on :8000, admin on 127.0.0.1:8001
|
|
96
|
+
# (VPS: --host 0.0.0.0 --port 8443 --tls-self-signed)
|
|
97
|
+
lowcomm room create friends --public-url https://<your-tunnel-or-host>
|
|
98
|
+
# prints an OWNER code and a JOIN code
|
|
99
|
+
LOWCOMM_CODE=<join code> lowcomm node # on each machine; --device cuda:1, mps, cpu
|
|
100
|
+
LOWCOMM_CODE=<owner code> lowcomm infer --model HuggingFaceTB/SmolLM2-135M-Instruct \
|
|
101
|
+
--prompts prompts.txt --output out.jsonl
|
|
102
|
+
lowcomm room list / lowcomm room close <room-id>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Secrets (admin key, room codes) are read from environment variables or
|
|
106
|
+
files, never from command-line arguments.
|
|
107
|
+
|
|
108
|
+
Trust model. Use rooms with people you trust:
|
|
109
|
+
- A **join-key** holder sees every prompt in the room, can return wrong
|
|
110
|
+
results, and can stall the room by taking tasks and dropping them.
|
|
111
|
+
- An **owner-key** holder can make every node download and run any Hugging
|
|
112
|
+
Face model. Nodes load only safetensors weights (never pickle), never run
|
|
113
|
+
code shipped in a model repo, refuse local paths unless allowed, and can
|
|
114
|
+
restrict models with `--allow-model`.
|
|
115
|
+
|
|
116
|
+
Verified so far: Linux, CPU only, all processes on one machine, including a
|
|
117
|
+
run with a real model (SmolLM2-135M-Instruct), both over loopback and over
|
|
118
|
+
pinned TLS on a LAN address. Windows and macOS (including
|
|
119
|
+
Apple GPUs via `--device mps`) are supported in code but have not run yet;
|
|
120
|
+
CI is configured for all three operating systems but has not run.
|
|
121
|
+
GPU and internet runs are untested.
|
|
122
|
+
|
|
123
|
+
Training workload (`lowcomm.training`):
|
|
124
|
+
- A small GPT (decoder-only transformer) in plain torch.
|
|
125
|
+
- A binary token-shard format (validated header, memory-mapped, no pickle)
|
|
126
|
+
and deterministic, disjoint batch windows over a token range.
|
|
127
|
+
- Warmup + cosine learning-rate schedule.
|
|
128
|
+
- An AdamW inner trainer. Its fp16/CUDA path exists but has not been run
|
|
129
|
+
on a GPU yet.
|
|
130
|
+
|
|
131
|
+
There is no distributed training yet.
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
Requires [uv](https://docs.astral.sh/uv/).
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
uv sync
|
|
139
|
+
uv run pytest # on machines with ROS installed: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
|
140
|
+
uv run ruff check . && uv run ruff format --check . && uv run mypy
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
Apache-2.0
|
lowcomm-0.1.0/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# lowcomm
|
|
2
|
+
|
|
3
|
+
## Motivation
|
|
4
|
+
|
|
5
|
+
Millions of GPUs sit fragmented and underused in personal machines,
|
|
6
|
+
universities, labs and clouds, while independent researchers can't afford
|
|
7
|
+
the clusters modern training needs. The long-term vision is to make the
|
|
8
|
+
internet itself a collaborative infrastructure for training AI: scattered,
|
|
9
|
+
heterogeneous machines that come and go, joined into one training run.
|
|
10
|
+
|
|
11
|
+
## What this project is
|
|
12
|
+
|
|
13
|
+
lowcomm is a GPU connector. It joins scattered, unreliable GPU machines
|
|
14
|
+
(behind NAT, different hardware, coming and going) into one pool you can
|
|
15
|
+
submit work to. Low-communication (DiLoCo-style) training is the main
|
|
16
|
+
workload being built on top of it.
|
|
17
|
+
|
|
18
|
+
**Status:** early development. This README lists only what exists and is
|
|
19
|
+
tested (on CPU, localhost):
|
|
20
|
+
|
|
21
|
+
Connector (`lowcomm.connector`):
|
|
22
|
+
- A coordinator that hands out tasks under leases. A lease stays alive only
|
|
23
|
+
while its node names it in heartbeats. When a node dies or goes silent,
|
|
24
|
+
its tasks are retried on another node, up to a configured attempt limit.
|
|
25
|
+
Completing a task is idempotent, and stale results are rejected.
|
|
26
|
+
- Tasks are matched to nodes by workload kind and by numeric capability
|
|
27
|
+
requirements (e.g. minimum VRAM). Capabilities are measured on the node.
|
|
28
|
+
- An HTTP transport. Nodes only make outbound requests. Messages are framed
|
|
29
|
+
as JSON metadata plus a raw payload with a SHA-256 checksum, never pickle.
|
|
30
|
+
Every request needs a room key (see Rooms), unknown keys are rejected, and
|
|
31
|
+
body sizes are limited. The client never follows redirects, so the key
|
|
32
|
+
can't be forwarded elsewhere.
|
|
33
|
+
- Built-in TLS for a coordinator with a public IP (a VPS, or a router port
|
|
34
|
+
forward). `--tls-self-signed` creates a certificate once and room codes
|
|
35
|
+
carry its fingerprint. Nodes accept only that certificate, and check it
|
|
36
|
+
before sending their key. `--tls-cert/--tls-key` take a real certificate.
|
|
37
|
+
- A node agent: heartbeats, and retries with backoff when the coordinator
|
|
38
|
+
is unreachable, including when a proxy or tunnel answers with its own
|
|
39
|
+
error page. It
|
|
40
|
+
re-registers after a coordinator restart and reports workload crashes so
|
|
41
|
+
the task is retried. It stops loudly on errors it can't recover from,
|
|
42
|
+
instead of hanging.
|
|
43
|
+
|
|
44
|
+
Known limits:
|
|
45
|
+
- Tasks live in memory only, so a coordinator restart loses them; rooms
|
|
46
|
+
and keys survive.
|
|
47
|
+
- Keys are sent as bearer tokens, so anyone on the path who can read the
|
|
48
|
+
TLS-terminated traffic (e.g. a tunnel provider) can see them.
|
|
49
|
+
- The client refuses plain HTTP to anything but loopback. TLS comes from a
|
|
50
|
+
tunnel or from the coordinator itself. See
|
|
51
|
+
[docs/connecting.md](docs/connecting.md) for Tailscale, ngrok and VPS
|
|
52
|
+
setups; only the VPS mode has run, on a LAN address.
|
|
53
|
+
|
|
54
|
+
Batch inference (`lowcomm.workloads`):
|
|
55
|
+
- Text generation with any Hugging Face causal LM, chunked into tasks
|
|
56
|
+
across the pool, with results returned in prompt order. Models are cached
|
|
57
|
+
on each node. Uses fp16 on GPU and fp32 on CPU. `trust_remote_code` is
|
|
58
|
+
always off.
|
|
59
|
+
- Each result records the device, tokens generated, generation time and
|
|
60
|
+
model-load time.
|
|
61
|
+
|
|
62
|
+
Rooms (`lowcomm.connector.rooms`):
|
|
63
|
+
- One coordinator hosts isolated **rooms**. Each room has an **owner key**
|
|
64
|
+
(submits work, reads results, can also run nodes) and a **join key** (can
|
|
65
|
+
only run nodes). Only SHA-256 hashes of keys are stored, in a rooms file
|
|
66
|
+
readable only by its owner. Rooms survive a coordinator restart.
|
|
67
|
+
- A **room code** (`lowcomm1:...`) packs the coordinator URL and a key into
|
|
68
|
+
one string.
|
|
69
|
+
- Rooms are created and closed through a separate admin server that only
|
|
70
|
+
listens on loopback. Closing a room revokes its keys immediately, and its
|
|
71
|
+
nodes exit with an error.
|
|
72
|
+
|
|
73
|
+
Command line (`lowcomm`):
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
export LOWCOMM_ADMIN_KEY=$(lowcomm key)
|
|
77
|
+
lowcomm coordinator # rooms on :8000, admin on 127.0.0.1:8001
|
|
78
|
+
# (VPS: --host 0.0.0.0 --port 8443 --tls-self-signed)
|
|
79
|
+
lowcomm room create friends --public-url https://<your-tunnel-or-host>
|
|
80
|
+
# prints an OWNER code and a JOIN code
|
|
81
|
+
LOWCOMM_CODE=<join code> lowcomm node # on each machine; --device cuda:1, mps, cpu
|
|
82
|
+
LOWCOMM_CODE=<owner code> lowcomm infer --model HuggingFaceTB/SmolLM2-135M-Instruct \
|
|
83
|
+
--prompts prompts.txt --output out.jsonl
|
|
84
|
+
lowcomm room list / lowcomm room close <room-id>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Secrets (admin key, room codes) are read from environment variables or
|
|
88
|
+
files, never from command-line arguments.
|
|
89
|
+
|
|
90
|
+
Trust model. Use rooms with people you trust:
|
|
91
|
+
- A **join-key** holder sees every prompt in the room, can return wrong
|
|
92
|
+
results, and can stall the room by taking tasks and dropping them.
|
|
93
|
+
- An **owner-key** holder can make every node download and run any Hugging
|
|
94
|
+
Face model. Nodes load only safetensors weights (never pickle), never run
|
|
95
|
+
code shipped in a model repo, refuse local paths unless allowed, and can
|
|
96
|
+
restrict models with `--allow-model`.
|
|
97
|
+
|
|
98
|
+
Verified so far: Linux, CPU only, all processes on one machine, including a
|
|
99
|
+
run with a real model (SmolLM2-135M-Instruct), both over loopback and over
|
|
100
|
+
pinned TLS on a LAN address. Windows and macOS (including
|
|
101
|
+
Apple GPUs via `--device mps`) are supported in code but have not run yet;
|
|
102
|
+
CI is configured for all three operating systems but has not run.
|
|
103
|
+
GPU and internet runs are untested.
|
|
104
|
+
|
|
105
|
+
Training workload (`lowcomm.training`):
|
|
106
|
+
- A small GPT (decoder-only transformer) in plain torch.
|
|
107
|
+
- A binary token-shard format (validated header, memory-mapped, no pickle)
|
|
108
|
+
and deterministic, disjoint batch windows over a token range.
|
|
109
|
+
- Warmup + cosine learning-rate schedule.
|
|
110
|
+
- An AdamW inner trainer. Its fp16/CUDA path exists but has not been run
|
|
111
|
+
on a GPU yet.
|
|
112
|
+
|
|
113
|
+
There is no distributed training yet.
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
Requires [uv](https://docs.astral.sh/uv/).
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
uv sync
|
|
121
|
+
uv run pytest # on machines with ROS installed: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
|
122
|
+
uv run ruff check . && uv run ruff format --check . && uv run mypy
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
Apache-2.0
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "lowcomm"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Low-communication (DiLoCo-style) training across heterogeneous, unreliable GPUs."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Omdeep Borkar", email = "omdeeborkar@gmail.com" }]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
dependencies = ["torch>=2.5", "numpy>=1.26", "psutil>=5.9"]
|
|
11
|
+
|
|
12
|
+
[project.optional-dependencies]
|
|
13
|
+
inference = ["transformers>=4.56"]
|
|
14
|
+
# Only the coordinator needs it, to generate a self-signed certificate.
|
|
15
|
+
tls = ["cryptography>=42"]
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
lowcomm = "lowcomm.cli:main"
|
|
19
|
+
|
|
20
|
+
[dependency-groups]
|
|
21
|
+
dev = ["pytest>=8", "ruff>=0.8", "mypy>=1.13", "transformers>=4.56", "types-psutil", "cryptography>=42"]
|
|
22
|
+
|
|
23
|
+
# Local dev and CI have no GPU: pin the CPU-only torch build. GPU workers on
|
|
24
|
+
# Kaggle/Colab use their preinstalled CUDA torch and must not `uv sync`.
|
|
25
|
+
[tool.uv.sources]
|
|
26
|
+
# macOS wheels (incl. Apple-GPU support) come from PyPI itself.
|
|
27
|
+
torch = [{ index = "pytorch-cpu", marker = "sys_platform != 'darwin'" }]
|
|
28
|
+
|
|
29
|
+
[[tool.uv.index]]
|
|
30
|
+
name = "pytorch-cpu"
|
|
31
|
+
url = "https://download.pytorch.org/whl/cpu"
|
|
32
|
+
explicit = true
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["uv_build>=0.10.8,<0.11.0"]
|
|
36
|
+
build-backend = "uv_build"
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
addopts = ["-ra", "--strict-markers", "--strict-config"]
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 100
|
|
44
|
+
target-version = "py311"
|
|
45
|
+
|
|
46
|
+
[tool.ruff.lint]
|
|
47
|
+
select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF"]
|
|
48
|
+
|
|
49
|
+
[tool.mypy]
|
|
50
|
+
strict = true
|
|
51
|
+
files = ["src", "tests"]
|
|
52
|
+
# torch and transformers leave some methods (e.g. Tensor.backward) unannotated.
|
|
53
|
+
untyped_calls_exclude = ["torch", "transformers"]
|