in neuron_explainer/models/autoencoder_context.py [0:0]
def warmup(self) -> None:
"""Load all autoencoders into memory."""
for layer_index in self.layer_indices:
self.get_autoencoder(layer_index)
# num_autoencoder_directions is always populated after warmup
n_latents = self.num_autoencoder_directions
if self.omit_dead_latents:
# drop the dead latents to save memory, but keep the same number of directions for all autoencoders
if self._min_n_dead_latents > 0:
print(f"Omitting {self._min_n_dead_latents} dead latents from all autoencoders")
n_latents_to_keep = n_latents - self._min_n_dead_latents
for key, autoencoder in self._cached_autoencoders_by_path.items():
self._cached_autoencoders_by_path[key] = omit_least_active_latents(
autoencoder, n_latents_to_keep=n_latents_to_keep
)