summaryrefslogtreecommitdiffstats
path: root/configdefinitions
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2023-06-02 12:10:32 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2023-06-02 12:10:32 +0200
commita67788f2b7786a2cfcb9244d1e72a7fb1815425b (patch)
treefa34be2f0f13ef4ea116dd12853c734de3bc2eca /configdefinitions
parente757e5ff2e6dadbe31389c7dfeb3f52827a1668b (diff)
Introduce services.xml syntax for configuring HuggingFace embedders
Diffstat (limited to 'configdefinitions')
-rw-r--r--configdefinitions/src/main/java/com/yahoo/embedding/huggingface/package-info.java9
-rw-r--r--configdefinitions/src/main/java/com/yahoo/language/huggingface/config/package-info.java9
-rw-r--r--configdefinitions/src/vespa/hugging-face-embedder.def29
-rw-r--r--configdefinitions/src/vespa/language.huggingface.hugging-face-tokenizer.def13
4 files changed, 60 insertions, 0 deletions
diff --git a/configdefinitions/src/main/java/com/yahoo/embedding/huggingface/package-info.java b/configdefinitions/src/main/java/com/yahoo/embedding/huggingface/package-info.java
new file mode 100644
index 00000000000..7bcc994e616
--- /dev/null
+++ b/configdefinitions/src/main/java/com/yahoo/embedding/huggingface/package-info.java
@@ -0,0 +1,9 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+/**
+ * @author bjorncs
+ */
+@ExportPackage
+package com.yahoo.embedding.huggingface;
+
+import com.yahoo.osgi.annotation.ExportPackage; \ No newline at end of file
diff --git a/configdefinitions/src/main/java/com/yahoo/language/huggingface/config/package-info.java b/configdefinitions/src/main/java/com/yahoo/language/huggingface/config/package-info.java
new file mode 100644
index 00000000000..fb9048b5fb4
--- /dev/null
+++ b/configdefinitions/src/main/java/com/yahoo/language/huggingface/config/package-info.java
@@ -0,0 +1,9 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+/**
+ * @author bjorncs
+ */
+@ExportPackage
+package com.yahoo.language.huggingface.config;
+
+import com.yahoo.osgi.annotation.ExportPackage; \ No newline at end of file
diff --git a/configdefinitions/src/vespa/hugging-face-embedder.def b/configdefinitions/src/vespa/hugging-face-embedder.def
new file mode 100644
index 00000000000..36957004e02
--- /dev/null
+++ b/configdefinitions/src/vespa/hugging-face-embedder.def
@@ -0,0 +1,29 @@
+namespace=embedding.huggingface
+
+# Path to tokenizer.json
+tokenizerPath model
+
+# Path to model.onnx
+transformerModel model
+
+# Max length of token sequence model can handle
+transformerMaxTokens int default=512
+
+# Input names
+transformerInputIds string default=input_ids
+transformerAttentionMask string default=attention_mask
+transformerTokenTypeIds string default=token_type_ids
+
+# Output name
+transformerOutput string default=last_hidden_state
+
+
+# Normalize tensors from tokenizer
+normalize bool default=false
+
+# Settings for ONNX model evaluation
+transformerExecutionMode enum { parallel, sequential } default=sequential
+transformerInterOpThreads int default=1
+transformerIntraOpThreads int default=-4
+# GPU device id, -1 for CPU
+transformerGpuDevice int default=0
diff --git a/configdefinitions/src/vespa/language.huggingface.hugging-face-tokenizer.def b/configdefinitions/src/vespa/language.huggingface.hugging-face-tokenizer.def
new file mode 100644
index 00000000000..18b3631e494
--- /dev/null
+++ b/configdefinitions/src/vespa/language.huggingface.hugging-face-tokenizer.def
@@ -0,0 +1,13 @@
+# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+namespace=language.huggingface.config
+
+# The language a model is for, one of the language tags in com.yahoo.language.Language.
+# Use "unknown" for models to be used with any language.
+model[].language string
+# The path to the model relative to the application package root
+model[].path model
+
+addSpecialTokens bool default=true
+maxLength int default=-1
+truncation bool default=false \ No newline at end of file