dumpsterpanda 0.2.3__tar.gz → 0.2.4__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.
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/PKG-INFO +1 -1
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/pyproject.toml +1 -1
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/__init__.py +1 -1
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/config.py +2 -1
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/loader.py +17 -1
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/LICENSE +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/README.md +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/__init__.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/app.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/config.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/hardware.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/info.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/names.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/plan.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/cli/trace.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/__init__.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/blocks.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/checkpoint.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/coordinator.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/depth.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/early.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/formats.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/hardware.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/hooks.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/measure.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/order_file.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/planner.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/report.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/stage.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/offload/trace.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/paths.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/__init__.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/load.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/server.py +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/app.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/bars.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/data.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/files.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/index.html +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/memory.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/memorychart.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/package.json +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/panels.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/style.css +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/svg.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/timeline.js +0 -0
- {dumpsterpanda-0.2.3 → dumpsterpanda-0.2.4}/src/trash_panda/ui/static/usage.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""trash-panda: run models bigger than your GPU by streaming weights across GPU, RAM and disk."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.2.
|
|
3
|
+
__version__ = "0.2.4"
|
|
4
4
|
|
|
5
5
|
# The offload API is imported lazily so that `import trash_panda` works even where torch is not installed yet.
|
|
6
6
|
_OFFLOAD_NAMES = (
|
|
@@ -52,7 +52,8 @@ class Defaults:
|
|
|
52
52
|
find_blocks_min_blocks: int = 2 # ... and have at least this many blocks
|
|
53
53
|
|
|
54
54
|
# diagnostics
|
|
55
|
-
|
|
55
|
+
faulthandler: bool = True # turn faulthandler on when a model loads: a crash in native code then prints where (nothing is printed otherwise)
|
|
56
|
+
profile: bool = False # print where the prefetching spent its time
|
|
56
57
|
trace: bool = False # record the run in a trace file (docs/design/trace-format.md), in TRASH_PANDA_TRACE_DIR
|
|
57
58
|
|
|
58
59
|
|
|
@@ -12,6 +12,7 @@ Each tensor is read lazily from the checkpoint and placed according to its tier:
|
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
+
import faulthandler
|
|
15
16
|
import threading
|
|
16
17
|
import time
|
|
17
18
|
from collections import defaultdict
|
|
@@ -137,6 +138,20 @@ def _to_meta(model: nn.Module, name: str) -> None:
|
|
|
137
138
|
owner._parameters[leaf] = nn.Parameter(torch.empty_like(p, device="meta"), requires_grad=False)
|
|
138
139
|
|
|
139
140
|
|
|
141
|
+
def _enable_faulthandler() -> None:
|
|
142
|
+
"""Turn faulthandler on, so that a crash in native code (an access violation, a segmentation fault) prints the Python
|
|
143
|
+
traceback of every thread: where the process was when it died. Nothing is printed unless it crashes. It stays as it is
|
|
144
|
+
when it is on already (the user's own setting, `-X faulthandler`, PYTHONFAULTHANDLER=1), when TRASH_PANDA_FAULTHANDLER
|
|
145
|
+
turns it off, and when stderr has no file descriptor to write to (a notebook). A process that the system ends, as when
|
|
146
|
+
memory runs out, leaves no trace here: nothing runs in it then."""
|
|
147
|
+
if not config.current().faulthandler or faulthandler.is_enabled():
|
|
148
|
+
return
|
|
149
|
+
try:
|
|
150
|
+
faulthandler.enable(all_threads=True)
|
|
151
|
+
except (AttributeError, OSError, ValueError, RuntimeError):
|
|
152
|
+
pass
|
|
153
|
+
|
|
154
|
+
|
|
140
155
|
def stream_load(
|
|
141
156
|
model: nn.Module,
|
|
142
157
|
path,
|
|
@@ -174,7 +189,8 @@ def stream_load(
|
|
|
174
189
|
Returns a LoadReport (print it) and remembers the settings on the model for install_offload().
|
|
175
190
|
"""
|
|
176
191
|
began_all = time.perf_counter()
|
|
177
|
-
|
|
192
|
+
_enable_faulthandler()
|
|
193
|
+
tr = _trace.loading_model() # the trace of the model that this thread is loading, if one is recorded
|
|
178
194
|
device = device or ("cuda" if torch.cuda.is_available() else "cpu")
|
|
179
195
|
if plan is not None:
|
|
180
196
|
cdt, sdt = plan.compute_dtype, plan.storage_dtype
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|