peal.sparse_dictionaries.interfaces.SparseDictionaryConfig¶
- class peal.sparse_dictionaries.interfaces.SparseDictionaryConfig[source]¶
Bases:
BaseModelCommon configuration fields of every sparse dictionary.
Concrete dictionaries subclass this and override
sparse_dictionaries_typeso thatget_sparse_dictionarycan resolve the class from a yaml file.- Parameters:
n_components (
intorNone) – Number of dictionary components (columns of the component matrix). Some dictionaries set this themselves after fitting.dict_size (
intorNone) – Size of the learned dictionary for SAE-style dictionaries; treated as a synonym ofn_componentsby several implementations.sparse_dictionaries_type (
str) – Registry key of the concrete dictionary class.category (
str) – Fixed to"sparse_dictionaries"; used when resolving default paths.base_path (
strorNone) – Where fitted weights, plots and logs of this dictionary live.name (
strorNone) – Where fitted weights, plots and logs of this dictionary live.run_name (
strorNone) – Where fitted weights, plots and logs of this dictionary live.weights_path (
strorNone) – Explicit path of the fitted weights; overridesbase_path/name.act_size (
int) – Dimensionality of the encoder activations the dictionary is fitted on.visualizations_per_component (
int) – How many top-activating samples to render per component.weights_name (
str) – File name of the weights insidebase_path.batch_size (
int) – Batch size used when the dictionary itself iterates over data.component_strings (
listorNone) – Optional human-readable names for the components.data (
DataConfig,dict,strorNone) – The data the dictionary is fitted on (config object, dict or yaml path).fitted_on_encoder (
strorNone) – Identity of the encoder whose activations the dictionary was fitted on; see the attribute docstring below.
Methods
Attributes
Which encoder's activations this dictionary was fitted on, stamped at fit time.
- data: DataConfig | dict | str | None = None¶
- fitted_on_encoder: str | None = None¶
Which encoder’s activations this dictionary was fitted on, stamped at fit time. Consumers that edit in the generator’s z_sem space (DiDAE) must refuse a dictionary fitted somewhere else: an OpenCLIP dictionary and a diffusion autoencoder’s z_sem are both 768-d, so nothing about the shapes catches the mismatch and the edits would simply be meaningless.