|
AQIT 0.1.0
|
Classes | |
| class | ModelPhase |
| class | RuntimeSnapshot |
Functions | |
| RuntimeSnapshot | snapshot () |
| None | _set_phase (str phase, *, str|None model_id=None, str|None target_id=None, Literal["llm"]|None kind=None, str|None error=None) |
| None | reset_state () |
| tuple[str, Literal["llm"]] | resolve_kind (str model_id) |
| tuple[str|None, Literal["llm"]|None] | resident_from_cache () |
| RuntimeSnapshot | sync_from_cache () |
| tuple[str, Literal["llm"]] | begin_load (str model_id) |
| None | finish_load (str slug, Literal["llm"] kind) |
| None | fail_load (str model_id, str error) |
| None | begin_unload () |
| None | finish_unload () |
| None | request_load_cancel () |
| bool | is_load_cancelled () |
| None | _emit (ProgressFn|None progress, str message) |
| str | load_weights (str model_id, *, ProgressFn|None progress=None) |
| None | unload_weights (*, ProgressFn|None progress=None, bool clear_active=True) |
| bool | release_foreign_daemon () |
| str|None | vram_line () |
| dict[str, Any] | health_payload (*, bool daemon, int port) |
Variables | |
| ProgressFn = Callable[[str, float], None] | |
| _lock = threading.Lock() | |
| _load_serial = threading.RLock() | |
| str | _phase = "idle" |
| str | _target_id = None |
| str | _resident_id = None |
| Literal | _kind = None |
| str | _error = None |
| float | _started_at = None |
| float | _loaded_at = None |
| str | _load_message = None |
| int | _load_epoch = 0 |
| int | _load_epoch_at_start = 0 |
|
protected |
Definition at line 215 of file model_runtime.py.
References snapshot().
Referenced by load_weights(), and unload_weights().
|
protected |
Definition at line 74 of file model_runtime.py.
Referenced by begin_load(), begin_unload(), fail_load(), finish_load(), and finish_unload().
| tuple[str, Literal["llm"]] begin_load | ( | str | model_id | ) |
Definition at line 166 of file model_runtime.py.
References _set_phase(), and resolve_kind().
Referenced by load_weights().
| None begin_unload | ( | ) |
Definition at line 190 of file model_runtime.py.
References _set_phase(), and snapshot().
Referenced by unload_weights().
| None fail_load | ( | str | model_id, |
| str | error ) |
Definition at line 183 of file model_runtime.py.
References _set_phase().
Referenced by load_weights().
| None finish_load | ( | str | slug, |
| Literal["llm"] | kind ) |
Definition at line 176 of file model_runtime.py.
References _set_phase().
Referenced by load_weights().
| None finish_unload | ( | ) |
Definition at line 195 of file model_runtime.py.
References _set_phase().
Referenced by load_weights(), and unload_weights().
| dict[str, Any] health_payload | ( | * | , |
| bool | daemon, | ||
| int | port ) |
JSON health block for the local engine server.
Definition at line 333 of file model_runtime.py.
References resident_from_cache(), snapshot(), sync_from_cache(), and vram_line().
| bool is_load_cancelled | ( | ) |
True if unload/cancel happened after this load began.
Definition at line 209 of file model_runtime.py.
Referenced by load_weights().
| str load_weights | ( | str | model_id, |
| * | , | ||
| ProgressFn | None | progress = None ) |
Load model_id into this process. Returns resolved slug. Updates lifecycle state. Process-wide serialized : concurrent builds on MPS exhaust unified memory.
Definition at line 224 of file model_runtime.py.
References _emit(), begin_load(), fail_load(), finish_load(), finish_unload(), and is_load_cancelled().
| bool release_foreign_daemon | ( | ) |
Optionally unload a background engine so this process can claim VRAM. Default is **never** : the desktop app keeps a resident model in the daemon. Headless CLI tools that try load_model in a short-lived process used to call model_daemon.unload() here, which looked like the model “randomly disappearing”. Opt-in only: set AQUIN_CLAIM_DAEMON_VRAM=1 when you intentionally want an exclusive in-process load that frees the background engine first.
Definition at line 286 of file model_runtime.py.
| None request_load_cancel | ( | ) |
Mark any in-flight build as cancelled (checked after from_pretrained).
Definition at line 202 of file model_runtime.py.
Referenced by unload_weights().
| None reset_state | ( | ) |
Clear lifecycle markers (tests / daemon shutdown).
Definition at line 107 of file model_runtime.py.
| tuple[str | None, Literal["llm"] | None] resident_from_cache | ( | ) |
What is actually resident in this process's VRAM caches.
Definition at line 131 of file model_runtime.py.
Referenced by health_payload(), and sync_from_cache().
| tuple[str, Literal["llm"]] resolve_kind | ( | str | model_id | ) |
Resolve slug + model family for any supported id.
Definition at line 124 of file model_runtime.py.
Referenced by begin_load().
| RuntimeSnapshot snapshot | ( | ) |
Thread-safe view of the in-process lifecycle state.
Definition at line 57 of file model_runtime.py.
Referenced by _emit(), begin_unload(), health_payload(), and sync_from_cache().
| RuntimeSnapshot sync_from_cache | ( | ) |
Reconcile lifecycle state with actual VRAM caches (health checks).
Definition at line 144 of file model_runtime.py.
References resident_from_cache(), and snapshot().
Referenced by health_payload().
| None unload_weights | ( | * | , |
| ProgressFn | None | progress = None, | ||
| bool | clear_active = True ) |
Drop all resident weights from VRAM in this process.
Definition at line 269 of file model_runtime.py.
References _emit(), begin_unload(), finish_unload(), and request_load_cancel().
| str | None vram_line | ( | ) |
Short VRAM summary for status output.
Definition at line 315 of file model_runtime.py.
Referenced by health_payload().
|
protected |
Definition at line 29 of file model_runtime.py.
|
protected |
Definition at line 28 of file model_runtime.py.
|
protected |
Definition at line 34 of file model_runtime.py.
|
protected |
Definition at line 35 of file model_runtime.py.
|
protected |
Definition at line 32 of file model_runtime.py.
|
protected |
Definition at line 24 of file model_runtime.py.
|
protected |
Definition at line 31 of file model_runtime.py.
|
protected |
Definition at line 22 of file model_runtime.py.
|
protected |
Definition at line 25 of file model_runtime.py.
|
protected |
Definition at line 27 of file model_runtime.py.
|
protected |
Definition at line 30 of file model_runtime.py.
|
protected |
Definition at line 26 of file model_runtime.py.
| aquin.compute.model_runtime.ProgressFn = Callable[[str, float], None] |
Definition at line 20 of file model_runtime.py.