Skip to content

Evaluation API

egolearn.evaluation.checkpoint.evaluate_checkpoint(checkpoint, *, benchmarks, model_config=None, device='cpu', seed=0, imports=(), record_json='auto', trusted_snapshot=False)

Load a trained model and evaluate it independently of its training data.

Without a checkpoint the model is built from model_config alone, for models whose weights EgoLearn does not train (a generative client of a served VLM).

egolearn.evaluation.checkpoint.load_model(checkpoint, *, model_config=None, device='cpu', imports=(), trusted_snapshot=False)

Reconstruct an EgoLearn checkpoint's model in eval mode.

Existing files need an explicit model config. New pipeline-built checkpoints carry their resolved construction config. Training state is never restored. Snapshots require trusted_snapshot=True; see SECURITY.md.

egolearn.evaluation.evaluator.evaluate(model, *, benchmarks, device=None, seed=0, imports=(), record_json='auto')

Evaluate a model with an automatic run record; None disables recording.

Modes, gradient flags and RNGs are preserved. Automatic records use distinct directories under runs/eval/records; an explicit file must not exist yet.

egolearn.evaluation.evaluator.EvaluationResult dataclass

JSON-serializable metrics and provenance from one model evaluation.

checkpoint = None class-attribute instance-attribute

code_revision = field(default_factory=code_revision) class-attribute instance-attribute

configs instance-attribute

device instance-attribute

failed_benchmark = None class-attribute instance-attribute

metadata instance-attribute

model_config = None class-attribute instance-attribute

package_version = __version__ class-attribute instance-attribute

results instance-attribute

schema_version = 2 class-attribute instance-attribute

seed instance-attribute

status = 'complete' class-attribute instance-attribute

versions instance-attribute

save_json(path)

to_dict()

egolearn.evaluation.evaluator.EvaluationError

Bases: RuntimeError

A failed benchmark with completed results and the original error as cause.

benchmark = benchmark instance-attribute

partial_result = partial_result instance-attribute

egolearn.evaluation.benchmark.Benchmark

An evaluation protocol over a model, with explicit dataset preparation.

Constructors should validate configuration without enumerating datasets. prepare may cache dataset metadata; learned classifiers/features must be recomputed for each model. run must leave model weights unchanged. Version the protocol when scoring or preprocessing semantics change.

name = 'benchmark' class-attribute instance-attribute

requires_capabilities = () class-attribute instance-attribute

version = '1' class-attribute instance-attribute

configuration()

Describe configured instances; config-driven calls also record defaults.

metadata()

Dataset sizes, split identity, or other protocol-specific provenance.

prepare()

Load/validate data before execution; repeated calls should be cheap.

run(model, ctx)

egolearn.evaluation.probe.Probe

Bases: Benchmark

A benchmark suitable for scheduling inside the training loop.

Existing probes also run through the standalone evaluator. Benchmarks that do not inherit Probe cannot be attached to a training pipeline.

name = 'probe' class-attribute instance-attribute

requires_capabilities = () class-attribute instance-attribute

version = '1' class-attribute instance-attribute

configuration()

Describe configured instances; config-driven calls also record defaults.

metadata()

Dataset sizes, split identity, or other protocol-specific provenance.

prepare()

Load/validate data before execution; repeated calls should be cheap.

run(model, ctx)