Bundle
Sentence embeddings from a pretrained BERT-family encoder exported to ONNX: the text is tokenized with WordPieceTokenizer, run through API.Onnx, and pooled into one vector per text.
A library of its own because it needs both System.NLP and API.Onnx, and the compiler resolves every class a linked library names: an embedder inside onnx.obl would make every ONNX program link nlp too, and one inside nlp.obl would make every NLP program need ONNX Runtime (docs/ML_BERT_DESIGN.md). Compile with -lib models,opencv,cipher,json,onnx,nlp,nlp_onnx.
BertEmbedder->Pooling
How a text's token vectors become one vector.
Items
- CLS — The hidden state of the first token, [CLS].
- MEAN — The mean of the hidden states of the real tokens, padding excluded.
- POOLER — The model's pooler_output: tanh of a dense layer over [CLS], as BERT was pretrained.