AQIT 0.1.0
Loading...
Searching...
No Matches
aquin.compute.vram_guard Namespace Reference

Functions

tuple[float, float]|None accelerator_vram_gib ()
tuple[float, float]|None cuda_vram_gib ()
None log_accelerator_vram (Callable[[str], None]|None log=None)
None log_cuda_vram (Callable[[str], None]|None log=None)
None release_inspection_models ()
None cleanup_heavy_job_vram ()
None restore_session_model (str|None model_id)
str oom_message (*, str job, str model_id)
str cuda_oom_message (*, str job, str model_id)
None raise_if_cuda_oom (BaseException exc, *, str job, str model_id)
str backend_summary ()

Function Documentation

◆ accelerator_vram_gib()

tuple[float, float] | None accelerator_vram_gib ( )
Free/total GiB for the active accelerator (CUDA/ROCm only; MPS has no public API).

Definition at line 21 of file vram_guard.py.

Referenced by cuda_vram_gib(), log_accelerator_vram(), and oom_message().

◆ backend_summary()

str backend_summary ( )

Definition at line 114 of file vram_guard.py.

◆ cleanup_heavy_job_vram()

None cleanup_heavy_job_vram ( )
Drop any models loaded during a heavy job (simulate TL cache, HF weights).

Definition at line 66 of file vram_guard.py.

References release_inspection_models().

◆ cuda_oom_message()

str cuda_oom_message ( * ,
str job,
str model_id )

Definition at line 104 of file vram_guard.py.

References oom_message().

◆ cuda_vram_gib()

tuple[float, float] | None cuda_vram_gib ( )
Backward-compatible alias.

Definition at line 31 of file vram_guard.py.

References accelerator_vram_gib().

◆ log_accelerator_vram()

None log_accelerator_vram ( Callable[[str], None] | None log = None)

Definition at line 36 of file vram_guard.py.

References accelerator_vram_gib().

Referenced by log_cuda_vram().

◆ log_cuda_vram()

None log_cuda_vram ( Callable[[str], None] | None log = None)

Definition at line 53 of file vram_guard.py.

References log_accelerator_vram().

◆ oom_message()

str oom_message ( * ,
str job,
str model_id )

Definition at line 87 of file vram_guard.py.

References accelerator_vram_gib().

Referenced by cuda_oom_message(), and raise_if_cuda_oom().

◆ raise_if_cuda_oom()

None raise_if_cuda_oom ( BaseException exc,
* ,
str job,
str model_id )

Definition at line 108 of file vram_guard.py.

References oom_message().

◆ release_inspection_models()

None release_inspection_models ( )
Unload HookedTransformer / embedding caches so simulate can own the GPU.

Definition at line 57 of file vram_guard.py.

Referenced by cleanup_heavy_job_vram().

◆ restore_session_model()

None restore_session_model ( str | None model_id)

Definition at line 71 of file vram_guard.py.