EvSys

BaseAlgorithm

Template-method base for the SDK's training algorithms. See module docstring.

Subclasses set the name / Config ClassVars (the registry contract) and override :meth:setup + :meth:build_batch (+ optionally :meth:step_metrics).

Attributes

attributenamestr
attributeConfigtype
attributecfg
= self.Config.model_validate(kwargs)
attributesteps_per_epochint

Functions

func__init__(self, **kwargs) -> None
paramself
paramkwargsAny
= {}

Returns

None
funcsetup(self, ctx, backend) -> None

One-time prep before the loop. Must set self._steps_per_epoch. Override in the concrete algorithm.

paramself
paramctxRunContext
parambackendTinkerBackend

Returns

None
funcbuild_batch(self, step_idx) -> TrainingBatch

Produce the batch for step_idx (0-based). Override.

paramself
paramstep_idxint

Returns

evsys_sdk.training.loop.TrainingBatch
funcstep_metrics(self, step_idx, batch, fb_result) -> dict[str, float]

Per-step metrics from the forward-backward result. Default no-op.

paramself
paramstep_idxint
parambatchTrainingBatch
paramfb_resultAny

Returns

dict[str, float]
functrain(self, ctx) -> RunResult
paramself
paramctxRunContext

Returns

evsys_sdk.protocols.RunResult
func_train_async(self, ctx) -> RunResult
paramself
paramctxRunContext

Returns

evsys_sdk.protocols.RunResult
func_check_inputs(self, ctx) -> None

Validate ctx.extras before the backend is allocated. Override to fail fast on missing / empty inputs (e.g. no train_rows). Default no-op.

paramself
paramctxRunContext

Returns

None
func_hyperparams_extra(self) -> dict[str, Any]

Extra fields merged into the logged hyperparams. Override to add algorithm-specific counts (e.g. n_train_rows).

paramself

Returns

dict[str, typing.Any]
func_resolve_total_steps(self) -> int
paramself

Returns

int
func_resolve_save_every(self, total_steps) -> int

Resolve the checkpoint cadence from save_every / save_at_fractions. Identical heuristic across all algos: take the GCD of the requested fraction-marks, but fall back to total/10 if that GCD would pathologically save every other step.

paramself
paramtotal_stepsint

Returns

int

On this page