Class OnnxTextEmbedderProvider
java.lang.Object
opennlp.dl.vectors.OnnxTextEmbedderProvider
- All Implemented Interfaces:
opennlp.tools.embeddings.TextEmbedderProvider, opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
public final class OnnxTextEmbedderProvider
extends Object
implements opennlp.tools.embeddings.TextEmbedderProvider
Provides a
SentenceVectorsDL under the name "onnx". It supports a spec whose
location is a local file named *.onnx, in any letter case, and whose only options are
"vocabulary", "lowerCase", "pooling",
"normalize", "maxLength" and "padding". The option
values are checked by create(ProviderSpec), which also initializes the ONNX Runtime.- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe option that lower-cases the text,trueby default orfalse.static final StringThe option that sets the maximum number of tokens per input, at least2, 512 by default.static final StringThe name of this provider.static final StringThe option that scales vectors to unit length,trueby default orfalse.static final StringThe option that selects thePaddingStrategy:autoby default,exact_length,longestormax_length, in any letter case.static final Stringstatic final StringThe required option that names the vocabulary file, resolved against the directory of the model if it is relative. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.util.ext.Provider
priority
-
Field Details
-
NAME
-
VOCABULARY_OPTION
The required option that names the vocabulary file, resolved against the directory of the model if it is relative.- See Also:
-
LOWER_CASE_OPTION
The option that lower-cases the text,trueby default orfalse.- See Also:
-
POOLING_OPTION
-
NORMALIZE_OPTION
The option that scales vectors to unit length,trueby default orfalse.- See Also:
-
MAX_LENGTH_OPTION
-
PADDING_OPTION
The option that selects thePaddingStrategy:autoby default,exact_length,longestormax_length, in any letter case.- See Also:
-
-
Constructor Details
-
OnnxTextEmbedderProvider
public OnnxTextEmbedderProvider()
-
-
Method Details
-
name
- Specified by:
namein interfaceopennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
-
isAvailable
public boolean isAvailable()Checks that the ONNX Runtime classes are present without initializing the runtime.- Specified by:
isAvailablein interfaceopennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
-
supports
public boolean supports(opennlp.tools.util.ext.ProviderSpec spec) - Specified by:
supportsin interfaceopennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
-
create
public opennlp.tools.embeddings.TextEmbedder create(opennlp.tools.util.ext.ProviderSpec spec) throws IOException - Specified by:
createin interfaceopennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>- Throws:
IOException
-