Features
Text and speech feature extractors share a factory-driven API and disk caches.
Text features
encoding.features.language_model: LM activationsencoding.features.embeddings: pooling and projection utilitiesencoding.features.factory.FeatureExtractorFactory: creation + cachingMulti-layer caching via
encoding.utils.ActivationCacheandLazyLayerCache
Speech features
encoding.features.speech_model: speech encodersCaching via
encoding.utils.SpeechActivationCacheandSpeechLazyLayerCacheReturns (features, times) tuples for downsampling
FIR expansion
encoding.features.FIR_expander.FIR:make_delayedto build lagged design matrices
Example
from encoding.features.factory import FeatureExtractorFactory
extractor = FeatureExtractorFactory.create_language_model(
model_name="gpt2", context_type="fullcontext", last_token=True
)