Embedder models uses the model type configuration.
The model type configuration accepts attributes model-id, url or path,
and multiple of these can be specified as a single config value, where one is used depending on the deployment environment:
If a model-id is specified and the application is deployed on Vespa Cloud, the model-id is used.
Otherwise, if a url is specified, it is used
Otherwise, path is used.
When using path, the model files must be supplied in the
Vespa application package.
Huggingface Embedder
An embedder using any Huggingface tokenizer,
including multilingual tokenizers,
to produce tokens which is then input to a supplied transformer model in ONNX model format.
The Huggingface embedder is configured in services.xml,
within the container tag:
Use to point to the tokenizer.json Huggingface tokenizer configuration file.
Also supports language, which is only relevant if one wants to tokenize differently based on the document language.
Use "unknown" for a model to be used for any language (i.e. by default).
Low level ONNX execution model. Valid values are parallel or sequential.
Only relevant for inference on CPU.
See ONNX runtime documentation on threading.
string
sequential
onnx-interop-threads
One
Low level ONNX setting.Only relevant for inference on CPU.
numeric
1
onnx-intraop-threads
One
Low level ONNX setting. Only relevant for inference on CPU.
A native Java implementation of SentencePiece.
SentencePiece breaks text into chunks independent of spaces,
which is robust to misspellings and works with CJK languages.
Prefer the Huggingface tokenizer embedder over this
for better compatibility with Huggingface models.
This is suitable to use in conjunction with custom components,
or the resulting tensor can be used in ranking.
A native Java implementation of
WordPiece,
which is commonly used with BERT models.
Prefer the Huggingface tokenizer embedder
over this for better compatibility with Huggingface models.
This is suitable to use in conjunction with custom components,
or the resulting tensor can be used in ranking.
classMyComponent{@InjectpublicMyComponent(ComponentRegistry<Embedder>embedders){// embedders contains all the embedders configured in your services.xml}}
See a concrete example of using an embedder in a custom searcher in
LLMSearcher.
<containerversion="1.0"><componentid="myEmbedder"class="com.example.MyEmbedder"bundle="the name in artifactId in pom.xml"><configname='com.example.my-embedder'><modelmodel-id="minilm-l6-v2"/><vocabpath="files/vocab.txt"/><myValue>foo</myValue></config></component></container>