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

Functions

dict[str, Any] _read_meta (Path sae_path)
int|None _layer_from_filename (Path path)
list[Path] user_sae_dirs_for_model (str model_id, *, bool embedding=False)
Path resolve_user_sae_path (str model_id, str name, int|None layer=None, *, bool|None embedding=None)
tuple[Path, str, int] resolve_path_sae (str|Path path, *, str|None model_id=None, int|None layer=None)
list[dict[str, Any]] list_user_saes (str|None model_id=None)
dict[str, Any]|None load_active_binding ()
dict[str, Any] save_active_binding (*, str model_id, int layer, str|Path path, str|None name=None, bool embedding=False)
None clear_active_binding ()
Path|None get_active_user_sae_path (str model_id, int layer)
dict[str, Any] activate_user_sae (*, str model_id, int layer, Path path, str|None name=None)

Variables

str USER_SAE_ROOT = Path.home() / ".aquin" / "sae" / "user"
str ACTIVE_SAE_PATH = Path.home() / ".aquin" / "active_user_sae.json"

Function Documentation

◆ _layer_from_filename()

int | None _layer_from_filename ( Path path)
protected

Definition at line 28 of file user_sae.py.

Referenced by list_user_saes(), resolve_path_sae(), and resolve_user_sae_path().

◆ _read_meta()

dict[str, Any] _read_meta ( Path sae_path)
protected

Definition at line 18 of file user_sae.py.

Referenced by list_user_saes(), and resolve_path_sae().

◆ activate_user_sae()

dict[str, Any] activate_user_sae ( * ,
str model_id,
int layer,
Path path,
str | None name = None )
Register active user SAE and warm the in-process cache.

Definition at line 257 of file user_sae.py.

References save_active_binding().

◆ clear_active_binding()

None clear_active_binding ( )

Definition at line 223 of file user_sae.py.

◆ get_active_user_sae_path()

Path | None get_active_user_sae_path ( str model_id,
int layer )
Return active user SAE path when it matches model + layer.

Definition at line 228 of file user_sae.py.

References load_active_binding().

◆ list_user_saes()

list[dict[str, Any]] list_user_saes ( str | None model_id = None)
Scan ~/.aquin/sae/user for trained SAE checkpoints.

Definition at line 149 of file user_sae.py.

References _layer_from_filename(), and _read_meta().

Referenced by resolve_user_sae_path().

◆ load_active_binding()

dict[str, Any] | None load_active_binding ( )

Definition at line 192 of file user_sae.py.

Referenced by get_active_user_sae_path().

◆ resolve_path_sae()

tuple[Path, str, int] resolve_path_sae ( str | Path path,
* ,
str | None model_id = None,
int | None layer = None )
Resolve explicit .pt path; infer model + layer from meta or args.

Definition at line 107 of file user_sae.py.

References _layer_from_filename(), and _read_meta().

◆ resolve_user_sae_path()

Path resolve_user_sae_path ( str model_id,
str name,
int | None layer = None,
* ,
bool | None embedding = None )
Resolve ~/.aquin/sae/user/<model>/<name>/sae_layer{L}.pt

Definition at line 47 of file user_sae.py.

References _layer_from_filename(), list_user_saes(), and user_sae_dirs_for_model().

◆ save_active_binding()

dict[str, Any] save_active_binding ( * ,
str model_id,
int layer,
str | Path path,
str | None name = None,
bool embedding = False )

Definition at line 202 of file user_sae.py.

Referenced by activate_user_sae().

◆ user_sae_dirs_for_model()

list[Path] user_sae_dirs_for_model ( str model_id,
* ,
bool embedding = False )

Definition at line 38 of file user_sae.py.

Referenced by resolve_user_sae_path().

Variable Documentation

◆ ACTIVE_SAE_PATH

str aquin.compute.user_sae.ACTIVE_SAE_PATH = Path.home() / ".aquin" / "active_user_sae.json"

Definition at line 15 of file user_sae.py.

◆ USER_SAE_ROOT

str aquin.compute.user_sae.USER_SAE_ROOT = Path.home() / ".aquin" / "sae" / "user"

Definition at line 14 of file user_sae.py.