Skip to content

mlvbench.infrastructure

Infrastructure utilities.

resolve_layers(all_layers, layers_spec)

Resolve a layer specification string to a list of layer names.

Intended for experiment scripts that expose a --layers command line argument. The resolved list can be passed directly to ProbeTrainer.fit.

Parameters:

Name Type Description Default
all_layers list[str]

The full list of layer names from the model (model.layer_names).

required
layers_spec str | None

A specification of a list of layers, provided as a comma-separated string. Each value may be a non-negative index (e.g. 0), a negative index (e.g. -1), or a layer name (e.g. block.12). If None, all layers are returned.

required

Returns:

Type Description
list[str]

A deduplicated list of resolved layer names.

save_metadata(output_path, parameters)

Save the metadata for an experiment run.

save_model_info(output_path, model)

Save model info for an experiment run.