letify 1.1.1__py3-none-win_amd64.whl

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 (88) hide show
  1. letify/__init__.py +107 -0
  2. letify/cli.py +619 -0
  3. letify/config/__init__.py +166 -0
  4. letify/config/inventory.py +153 -0
  5. letify/config/login.py +1105 -0
  6. letify/config/schema.py +52 -0
  7. letify/config/secrets.py +96 -0
  8. letify/config/writer.py +195 -0
  9. letify/declare/__init__.py +15 -0
  10. letify/declare/cache.py +49 -0
  11. letify/declare/env.py +114 -0
  12. letify/declare/function.py +262 -0
  13. letify/declare/instance.py +192 -0
  14. letify/errors.py +135 -0
  15. letify/install.py +606 -0
  16. letify/launcher.py +604 -0
  17. letify/protocol/__init__.py +51 -0
  18. letify/protocol/codec.py +263 -0
  19. letify/protocol/driver.py +101 -0
  20. letify/protocol/handle.py +47 -0
  21. letify/protocol/wire.py +636 -0
  22. letify/protocol/worker.py +2038 -0
  23. letify/providers/__init__.py +59 -0
  24. letify/providers/base.py +554 -0
  25. letify/providers/colab.py +382 -0
  26. letify/providers/colab_files.py +278 -0
  27. letify/providers/elice.py +1092 -0
  28. letify/providers/kaggle.py +904 -0
  29. letify/providers/kaggle_adapter.py +181 -0
  30. letify/providers/local.py +174 -0
  31. letify/providers/modal.py +816 -0
  32. letify/providers/modal_adapter.py +296 -0
  33. letify/providers/naming.py +47 -0
  34. letify/providers/shell.py +459 -0
  35. letify/providers/tunnel.py +25 -0
  36. letify/providers/usage.py +174 -0
  37. letify/remoting/__init__.py +28 -0
  38. letify/remoting/capability.py +50 -0
  39. letify/remoting/device/__init__.py +52 -0
  40. letify/remoting/device/client.py +1126 -0
  41. letify/remoting/device/cuda.py +866 -0
  42. letify/remoting/device/executor.py +598 -0
  43. letify/remoting/device/frames.py +175 -0
  44. letify/remoting/device/guard.py +54 -0
  45. letify/remoting/device/tensor.py +630 -0
  46. letify/remoting/device/trace.py +236 -0
  47. letify/remoting/device/value.py +251 -0
  48. letify/remoting/lib/letify-agent.exe +0 -0
  49. letify/remoting/lib/nvcuda.dll +0 -0
  50. letify/remoting/loader.py +96 -0
  51. letify/remoting/probe.py +145 -0
  52. letify/render.py +385 -0
  53. letify/runtime/__init__.py +25 -0
  54. letify/runtime/bootstrap.py +296 -0
  55. letify/runtime/channel.py +982 -0
  56. letify/runtime/lease.py +70 -0
  57. letify/runtime/pool.py +284 -0
  58. letify/runtime/session.py +656 -0
  59. letify/runtime/telemetry.py +343 -0
  60. letify/store/__init__.py +25 -0
  61. letify/store/backends/__init__.py +58 -0
  62. letify/store/backends/filesystem.py +70 -0
  63. letify/store/backends/google_auth.py +139 -0
  64. letify/store/backends/layout.py +27 -0
  65. letify/store/backends/objects.py +345 -0
  66. letify/store/cas.py +186 -0
  67. letify/store/pathdata.py +871 -0
  68. letify/store/sendorder.py +385 -0
  69. letify/store/volume.py +293 -0
  70. letify/stubs.py +196 -0
  71. letify/tools.py +189 -0
  72. letify/transport/__init__.py +9 -0
  73. letify/transport/agent.py +109 -0
  74. letify/transport/announce.py +34 -0
  75. letify/transport/link.py +193 -0
  76. letify/transport/nat.py +481 -0
  77. letify/transport/pipeline.py +426 -0
  78. letify/transport/probe.py +86 -0
  79. letify/transport/rendezvous.py +157 -0
  80. letify/transport/setup.py +165 -0
  81. letify/transport/sshopts.py +97 -0
  82. letify/transport/strategies.py +357 -0
  83. letify-1.1.1.dist-info/METADATA +549 -0
  84. letify-1.1.1.dist-info/RECORD +88 -0
  85. letify-1.1.1.dist-info/WHEEL +5 -0
  86. letify-1.1.1.dist-info/entry_points.txt +2 -0
  87. letify-1.1.1.dist-info/licenses/LICENSE +201 -0
  88. letify_providers.py +12 -0
letify/__init__.py ADDED
@@ -0,0 +1,107 @@
1
+ """letify: declarations that become infrastructure.
2
+
3
+ Declare what a function needs and it runs there:
4
+
5
+ import letify
6
+
7
+ let = letify.Launcher()
8
+ colab = let.providers.colab_a
9
+
10
+ @let.function(device=colab.G4, host=letify.remote)
11
+ def train(lr, bs):
12
+ ...
13
+
14
+ train(lr=1e-4, bs=32)
15
+
16
+ A declaration places two things. ``device`` says where the device is, carrying the provider
17
+ and the account with it. ``host`` says where the host code runs: ``local``, the default,
18
+ keeps Python here and forwards only PyTorch operators, and ``remote`` ships the function to the
19
+ machine that holds the device.
20
+
21
+ A session ends with the call that needed it. ``with let.keep_alive():`` keeps sessions for the
22
+ length of a block, so a run of separate calls does not pay session start each time.
23
+
24
+ Nothing here imports a provider's optional dependency, so ``import letify`` works with
25
+ the base install and a provider whose package is missing reports itself unavailable.
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ from typing import Final
31
+
32
+ from .declare.cache import session_cache
33
+ from .declare.env import Env
34
+ from .declare.function import Function
35
+ from .declare.instance import AnyInstance, Host, Instance
36
+ from .errors import (
37
+ ConfigError,
38
+ EnvironmentFailure,
39
+ InsufficientDevices,
40
+ InterpreterMismatch,
41
+ LetifyError,
42
+ ProtocolError,
43
+ ProviderUnavailable,
44
+ RemoteError,
45
+ RuntimeFailure,
46
+ RuntimeLost,
47
+ SpotPreempted,
48
+ UnknownInstance,
49
+ UnknownProvider,
50
+ UnsupportedMode,
51
+ )
52
+ from .launcher import Launcher, Providers
53
+ from .protocol.handle import Blob, RemoteFile
54
+ from .store.volume import Volume
55
+
56
+ #: Where a declaration's host code runs. Two named values rather than the enum class that holds
57
+ #: them, because a declaration only ever needs one of the two.
58
+ #: ``Final`` so a type checker sees the literal member, which the declaration overloads match on.
59
+ local: Final = Host.local
60
+ remote: Final = Host.remote
61
+
62
+ # The enum class stays importable from letify.declare.instance for letify's own use.
63
+ del Host
64
+
65
+ __version__ = "1.1.1"
66
+
67
+
68
+ def fetch(tensor): # type: ignore[no-untyped-def]
69
+ """Queue a read of ``tensor`` and return an awaitable resolving to its CPU copy.
70
+
71
+ Under ``host="local"`` the read is queued at the call and awaiting it does not block the
72
+ event loop. A tensor not on the runtime resolves to ``tensor.detach().cpu()``.
73
+ """
74
+ from .remoting.device.client import fetch as queue_fetch
75
+
76
+ return queue_fetch(tensor)
77
+
78
+
79
+ __all__ = [
80
+ "AnyInstance",
81
+ "Blob",
82
+ "ConfigError",
83
+ "Env",
84
+ "EnvironmentFailure",
85
+ "Function",
86
+ "Instance",
87
+ "InsufficientDevices",
88
+ "InterpreterMismatch",
89
+ "Launcher",
90
+ "LetifyError",
91
+ "ProtocolError",
92
+ "ProviderUnavailable",
93
+ "Providers",
94
+ "RemoteError",
95
+ "RemoteFile",
96
+ "RuntimeFailure",
97
+ "RuntimeLost",
98
+ "SpotPreempted",
99
+ "UnknownInstance",
100
+ "UnknownProvider",
101
+ "UnsupportedMode",
102
+ "Volume",
103
+ "__version__",
104
+ "local",
105
+ "remote",
106
+ "session_cache",
107
+ ]