Extractor#

class ts3.Extractor[source]#

Bases: abc.ABC

A unit-embedding producer, driven by ts3/extract.py.

setup(data_root, device, logger)[source]#

Bind the run’s context. Override to load checkpoints once, not per regime.

Return type:

None

abstract property name: str#

Names the embeddings file, so two runs of one model do not overwrite each other.

property run_seed: int | None#

The seed of the run behind these embeddings, or None when no run produced them.

abstract encode(regime)[source]#

Embeddings and uids for every unit of regime this extractor can represent.

Returns (N, D) and (N,) in matching order. Units the extractor cannot represent may be omitted: the probe join drops anything TS3 does not score, and insists separately that the eval side is complete.

Return type:

tuple[Tensor, ndarray]