seqme.Cache#
- class seqme.Cache(models=None, init_cache=None)[source]#
Caches model-generated feature representations of sequences.
Allows storing and retrieving representations per model to avoid recomputation, with support for adding models and precomputed values.
- __init__(models=None, init_cache=None)[source]#
Initialize the cache with optional models and precomputed representations.
- __call__(sequences, model_name, stack)[source]#
Return feature representations for the given sequences using the specified model.
Uncached sequences are computed and stored.
- Parameters:
- Return type:
- Returns:
Feature representations in the same order as the input sequences.
Methods
__init__([models, init_cache])Initialize the cache with optional models and precomputed representations.
__call__(sequences, model_name, stack)Return feature representations for the given sequences using the specified model.
add(model_name, element)Add a new model or precomputed representations to the cache.
get()Return a copy of the current cache.
model(model_name, *[, stack])Return a callable interface for a given model name.
remove(model_name)Remove the cache of a model and the model callable if defined.