layerpool 0.1.0__tar.gz → 0.1.1__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 (32) hide show
  1. {layerpool-0.1.0 → layerpool-0.1.1}/PKG-INFO +2 -2
  2. {layerpool-0.1.0 → layerpool-0.1.1}/README.md +1 -1
  3. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/__init__.py +1 -1
  4. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/net.py +17 -3
  5. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/tunnel.py +13 -0
  6. {layerpool-0.1.0 → layerpool-0.1.1}/.gitignore +0 -0
  7. {layerpool-0.1.0 → layerpool-0.1.1}/LICENSE +0 -0
  8. {layerpool-0.1.0 → layerpool-0.1.1}/pyproject.toml +0 -0
  9. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/__main__.py +0 -0
  10. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/api.py +0 -0
  11. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/backends/__init__.py +0 -0
  12. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/backends/common.py +0 -0
  13. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/backends/mlx_backend.py +0 -0
  14. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/blocks.py +0 -0
  15. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/cli.py +0 -0
  16. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/codec.py +0 -0
  17. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/control.py +0 -0
  18. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/driver.py +0 -0
  19. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/export.py +0 -0
  20. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/fetch.py +0 -0
  21. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/hf.py +0 -0
  22. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/job.py +0 -0
  23. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/losses.py +0 -0
  24. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/planner.py +0 -0
  25. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/pool.py +0 -0
  26. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/selfcheck.py +0 -0
  27. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/telemetry.py +0 -0
  28. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/trainers.py +0 -0
  29. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/ui/app.js +0 -0
  30. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/ui/index.html +0 -0
  31. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/ui/style.css +0 -0
  32. {layerpool-0.1.0 → layerpool-0.1.1}/src/layerpool/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: layerpool
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Train one model on all of your devices: layers split across GPUs, Apple Silicon and CPUs, with your own training code.
5
5
  Project-URL: Homepage, https://github.com/abdallah-swe/layerpool
6
6
  Project-URL: Repository, https://github.com/abdallah-swe/layerpool
@@ -52,7 +52,7 @@ Description-Content-Type: text/markdown
52
52
 
53
53
  One model, split by layers across all your machines. Their memory is pooled, and they train it as one.
54
54
 
55
- [![PyPI](https://img.shields.io/pypi/v/layerpool.svg)](https://pypi.org/project/layerpool/) [![Python](https://img.shields.io/pypi/pyversions/layerpool.svg)](https://pypi.org/project/layerpool/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/abdallah-swe/layerpool/blob/main/LICENSE)
55
+ [![PyPI](https://img.shields.io/pypi/v/layerpool.svg?v=1)](https://pypi.org/project/layerpool/) [![Python](https://img.shields.io/pypi/pyversions/layerpool.svg?v=1)](https://pypi.org/project/layerpool/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/abdallah-swe/layerpool/blob/main/LICENSE)
56
56
 
57
57
  </div>
58
58
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  One model, split by layers across all your machines. Their memory is pooled, and they train it as one.
13
13
 
14
- [![PyPI](https://img.shields.io/pypi/v/layerpool.svg)](https://pypi.org/project/layerpool/) [![Python](https://img.shields.io/pypi/pyversions/layerpool.svg)](https://pypi.org/project/layerpool/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/abdallah-swe/layerpool/blob/main/LICENSE)
14
+ [![PyPI](https://img.shields.io/pypi/v/layerpool.svg?v=1)](https://pypi.org/project/layerpool/) [![Python](https://img.shields.io/pypi/pyversions/layerpool.svg?v=1)](https://pypi.org/project/layerpool/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/abdallah-swe/layerpool/blob/main/LICENSE)
15
15
 
16
16
  </div>
17
17
 
@@ -1,6 +1,6 @@
1
1
  import importlib
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
4
4
 
5
5
 
6
6
  def __getattr__(name):
@@ -318,6 +318,7 @@ def lan_ip() -> str:
318
318
  s.close()
319
319
 
320
320
 
321
+ QUICK_TUNNELS = ".trycloudflare.com"
321
322
  _resolved: dict[str, tuple[str, float]] = {}
322
323
 
323
324
 
@@ -336,9 +337,22 @@ def _ask_public_dns(host: str) -> str | None:
336
337
  return None
337
338
 
338
339
 
340
+ def _front_door(host: str) -> str | None:
341
+ """A quick tunnel is served by the same Cloudflare addresses as its parent domain, which find the tunnel by the host name sent
342
+ with TLS, so a tunnel answers there before its own name has spread through DNS."""
343
+ if not host.endswith(QUICK_TUNNELS):
344
+ return None
345
+ parent = QUICK_TUNNELS.lstrip(".")
346
+ try:
347
+ return socket.getaddrinfo(parent, None, socket.AF_INET)[0][4][0]
348
+ except socket.gaierror:
349
+ return _ask_public_dns(parent)
350
+
351
+
339
352
  def resolve(host: str) -> str:
340
- """The address to connect to. A fresh tunnel name is often cached as missing by the local resolver for many
341
- minutes, so when the system cannot find a name, ask public DNS over HTTPS instead."""
353
+ """The address to connect to. A fresh tunnel name is often cached as missing by the local resolver for many minutes, so when
354
+ the system cannot find a name, ask public DNS over HTTPS instead. Public DNS can hold the same miss for about a minute: a quick
355
+ tunnel is then reached through its parent domain."""
342
356
  try:
343
357
  socket.getaddrinfo(host, None)
344
358
  return host
@@ -346,7 +360,7 @@ def resolve(host: str) -> str:
346
360
  cached = _resolved.get(host)
347
361
  if cached and cached[1] > time.time():
348
362
  return cached[0]
349
- ip = _ask_public_dns(host)
363
+ ip = _ask_public_dns(host) or _front_door(host)
350
364
  if ip is None:
351
365
  raise
352
366
  _resolved[host] = (ip, time.time() + 300)
@@ -24,6 +24,7 @@ SHA256 = {
24
24
  "cloudflared-linux-arm64": "3df43aedc9ff291d1735b5cb576cb97e0b157488796db2e32b28aecabb445775",
25
25
  "cloudflared-windows-amd64.exe": "2493dbc168923bb3e59e5e7716f71deced92992eea9acd6e9d74f84ac7751343",
26
26
  }
27
+ SETTLE_S = 3.0
27
28
  CACHE = os.path.join(os.path.expanduser("~"), ".cache", "layerpool")
28
29
 
29
30
 
@@ -117,6 +118,8 @@ class Tunnel:
117
118
  threading.Thread(target=self._read, daemon=True).start()
118
119
  try:
119
120
  self.url = self._wait_url(timeout)
121
+ self._wait_registered(20)
122
+ time.sleep(SETTLE_S)
120
123
  self._wait_reachable(timeout)
121
124
  log(f"tunnel ready at {self.url} after {time.time() - started:.0f}s")
122
125
  return
@@ -144,6 +147,16 @@ class Tunnel:
144
147
  self.close()
145
148
  raise RuntimeError("cloudflared did not give a tunnel address:\n" + "".join(self.lines[-20:]))
146
149
 
150
+ def _wait_registered(self, timeout: float):
151
+ """The address is printed before the tunnel is connected. Asking for it that early makes Cloudflare and DNS servers remember
152
+ for up to a minute that it does not exist, so wait until cloudflared says it is connected (or, if it never says so, for
153
+ `timeout` seconds). Cloudflare's servers learn of it a moment later still: SETTLE_S."""
154
+ deadline = time.time() + timeout
155
+ while time.time() < deadline and self.proc.poll() is None:
156
+ if any("Registered tunnel connection" in line for line in list(self.lines)):
157
+ return
158
+ time.sleep(0.1)
159
+
147
160
  def _wait_reachable(self, timeout: float):
148
161
  deadline = time.time() + timeout
149
162
  while time.time() < deadline:
File without changes
File without changes
File without changes
File without changes