Documentation
¶
Overview ¶
Package evolvingembeddings provides a word embedding model that evolves by dynamically aggregating contextual embeddings over time during inference. See "Pooled Contextualized Embeddings" by Akbik et al., 2019 https://www.aclweb.org/anthology/papers/N/N19/N19-1078/
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Size of the embedding vectors. Size int // The operation used to aggregate new embeddings with pre-existing ones. PoolingOperation PoolingType // The path to DB on the drive DBPath string // Whether to force the deletion of any existing DB to start with an empty embeddings mam. ForceNewDB bool }
Config provides configuration settings for an Evolving Pooled Contextualized Embeddings Model.
type Model ¶
type Model struct { nn.BaseModel Config Storage *kvdb.KeyValueDB Mu sync.Mutex ZeroEmbedding nn.Param `spago:"type:weights"` }
Model implements an Evolving Pooled Contextualized Embeddings model.
func (*Model) Aggregate ¶
func (m *Model) Aggregate(list []*WordVectorPair)
Aggregate performs a pooling operation over the list of WordVectorPair elements.
func (*Model) Close ¶
func (m *Model) Close()
Close closes the DB underlying the model of the embeddings mam.
func (*Model) Count ¶
Count counts how many embeddings are stored in the DB. It invokes log.Fatal in case of reading errors.
type PoolingType ¶
type PoolingType int
PoolingType is the enumeration-like type used to distinguish different types of pooling operations for an Evolving Pooled Contextualized Embeddings Model.
const ( // Max identifies the maximum pooling operation function. Max PoolingType = iota // Min identifies the minimum pooling operation function. Min )
type WordVectorPair ¶
WordVectorPair associates a Vector to a Word.