aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-04-30 14:44:51 +0200
committerGitHub <noreply@github.com>2023-04-30 14:44:51 +0200
commit8806fa5aca73fdf3cfe8bb8c8294827bdc8685ba (patch)
tree0d6a79775a43fd1065fb6b48f0d7bb92d9073230
parent7edb75eeee6e14684d31ec23bcab342de6378605 (diff)
parent00b862bb9ae6f12ab9eb4f65f3c798f00922fecd (diff)
Merge pull request #26919 from vespa-engine/bratseth/ignore-pathv8.159.53
Ignore path on hosted when model-id is set
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java2
2 files changed, 7 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
index 0e52e56d653..ff261d2b83a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
@@ -51,11 +51,15 @@ public class ModelIdResolver {
/** Expands a model config value into regular config values. */
private static void transformModelValue(Element value, boolean hosted) {
if ( ! value.hasAttribute("model-id")) return;
- if (hosted)
+
+ if (hosted) {
value.setAttribute("url", modelIdToUrl(value.getTagName(), value.getAttribute("model-id")));
- else if ( ! value.hasAttribute("url") && ! value.hasAttribute("path"))
+ value.removeAttribute("path");
+ }
+ else if ( ! value.hasAttribute("url") && ! value.hasAttribute("path")) {
throw new IllegalArgumentException(value.getTagName() + " is configured with only a 'model-id'. " +
"Add a 'path' or 'url' to deploy this outside Vespa Cloud");
+ }
}
private static String modelIdToUrl(String valueName, String modelId) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java
index ba22e1c6350..50416d50fe5 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java
@@ -55,7 +55,7 @@ public class EmbedderTestCase {
String input = "<component id='test' class='" + BUNDLED_EMBEDDER_CLASS + "' bundle='model-integration'>" +
" <config name='" + BUNDLED_EMBEDDER_CONFIG + "'>" +
" <transformerModel model-id='minilm-l6-v2' />" +
- " <tokenizerVocab model-id='bert-base-uncased' />" +
+ " <tokenizerVocab model-id='bert-base-uncased' path='ignored.txt'/>" +
" </config>" +
"</component>";
String component = "<component id='test' class='" + BUNDLED_EMBEDDER_CLASS + "' bundle='model-integration'>" +