ageas.Unit
- class ageas.Unit(tail: str, unit_type: str, config: dict, accelerator: str = 'cpu')
Bases:
objectSingle classifier model bundled with its configuration and runtime state.
The unit stores everything needed to reproduce, train, and inspect one model: the classifier type, the configuration dictionary, the chosen accelerator, the trained model weights, the trainer object, and the accumulated reports from each Ageas operation.
- Variables:
tail – Short name used to disambiguate units sharing the same type.
type – Model type key (one of
SUPPORTED_TYPES).config – Hyper-parameter dictionary for the classifier and trainer.
accelerator – Current accelerator string (
'cpu'or'cuda').device – GPU device count / index resolved at spike time.
model – Trained classifier instance (
Noneuntil after a sortie).trainer – Trainer object (
Noneuntil after a sortie).report – Per-operation metric records accumulated during selection.
- __init__(tail: str, unit_type: str, config: dict, accelerator: str = 'cpu') None
Initialize a Unit.
- Parameters:
tail – Short tail name used to disambiguate units that share the same model type (e.g.
'unit1','unit2').unit_type – Model type key. Must be one of
SUPPORTED_TYPES.config – Hyper-parameter dictionary forwarded to the underlying classifier and trainer.
accelerator – Initial accelerator hint,
'cpu'or'cuda'. Re-evaluated at sortie time byspike().
- property clf_object: type
Classifier class associated with this unit’s type.
- Returns:
The class (not an instance) registered under
self.typeinSUPPORTED_TYPES.
- property id: str
Public unit ID combining the model type and tail.
- Returns:
"{type}_{tail}"formatted identifier.
- spike(accelerator: str, available_devices: list = None)
Verify that the unit is ready to launch and resolve its accelerator.
Performs three checks in order:
The model type is supported by Ageas.
CPU-only models are pinned to the CPU accelerator.
CUDA models receive a valid device list, or fall back to CPU with a warning.
- Parameters:
accelerator – Requested accelerator (
'cpu'or'cuda').available_devices – Optional list of GPU device indices that the deck has reserved for this unit.
- Returns:
The classifier class to instantiate, or
Noneif the unit cannot be launched (unsupported type, unknown accelerator).