stageload
A small library for loading models stage by stage. It includes a built-in watchdog that monitors macOS swap space and free memory and, before a budget is exceeded, sends signals to a process group to terminate the task.
Timeline (last 90 days)
When using stageload's release(module) to move parameters and buffers to the meta device and running Qwen-Image-2.1 in a stage-by-stage 'load at start, release at end' manner (the 16.3 GB text encoder and the 13.3 GB transformer loaded only one at a time), the peak on the same Mac dropped to 19.0 GB, and swap did not grow in either run.
The stageload supervisor does not require root privileges and only terminates the command and its process group.
The stageload supervisor uses exit code 3 to indicate that the supervisor terminated the command, and 4 to indicate that no startup space was found.
The stageload run command can place jobs into a queue on the same machine, scheduling fairly by lane and owner.
The stageload guard command can wait until kern.memorystatus_level is at least a specified percentage before launching the command, and terminates the command when swap space growth exceeds the budget or free memory falls below the threshold twice in a row
The stageload supervisor and meter read macOS counters (libproc, sysctl), so they can only run on a Mac.
The supervisor first sends SIGTERM to the command's entire process group, then sends SIGKILL five seconds later; sending to the process group rather than a single PID avoids orphan processes.
Each stageload run writes a memory trace for the command and all its child processes, and records one line in ~/.stageload/history.jsonl.
All Facts (8)
The stageload guard command can wait until kern.memorystatus_level is at least a specified percentage before launching the command, and terminates the command when swap space growth exceeds the budget or free memory falls below the threshold twice in a row
50%UnverifiedThe stageload supervisor does not require root privileges and only terminates the command and its process group.
50%UnverifiedThe stageload supervisor uses exit code 3 to indicate that the supervisor terminated the command, and 4 to indicate that no startup space was found.
50%UnverifiedThe stageload run command can place jobs into a queue on the same machine, scheduling fairly by lane and owner.
50%UnverifiedEach stageload run writes a memory trace for the command and all its child processes, and records one line in ~/.stageload/history.jsonl.
50%UnverifiedThe stageload supervisor and meter read macOS counters (libproc, sysctl), so they can only run on a Mac.
50%UnverifiedThe supervisor first sends SIGTERM to the command's entire process group, then sends SIGKILL five seconds later; sending to the process group rather than a single PID avoids orphan processes.
50%UnverifiedWhen using stageload's release(module) to move parameters and buffers to the meta device and running Qwen-Image-2.1 in a stage-by-stage 'load at start, release at end' manner (the 16.3 GB text encoder and the 13.3 GB transformer loaded only one at a time), the peak on the same Mac dropped to 19.0 GB, and swap did not grow in either run.
50%