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.ActivationCache
andLazyLayerCache
Speech features
encoding.features.speech_model
: speech encodersCaching via
encoding.utils.SpeechActivationCache
andSpeechLazyLayerCache
Returns (features, times) tuples for downsampling
FIR expansion
encoding.features.FIR_expander.FIR
:make_delayed
to 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
)