transformer_lens.utilities.library_utils module

Library availability utilities.

Utilities for checking if optional libraries are available without importing them.

transformer_lens.utilities.library_utils.is_library_available(name: str) bool

Checks if a library is installed in the current environment without importing it. Prevents crash or segmentation fault.

Parameters:

name – The name of the library to check (e.g., “wandb”, “transformers”)

Returns:

True if the library is available, False otherwise