diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-02-11 16:36:03 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-02-11 16:36:03 +0000 |
commit | a12d1bdee9d8cac4764965aa358aae04ad98be66 (patch) | |
tree | 42e7df52b0f442df272ccfba16718ea6b4c12745 /model-evaluation/src | |
parent | 37eaedacf0426fe4b16a00a6f7874b11af809df8 (diff) |
also handle JSON-serialization of constants
Diffstat (limited to 'model-evaluation/src')
-rw-r--r-- | model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java b/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java index 9877dd69e83..e8aae24ca9e 100644 --- a/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java +++ b/model-evaluation/src/main/java/ai/vespa/models/evaluation/RankProfilesConfigImporter.java @@ -232,13 +232,16 @@ public class RankProfilesConfigImporter { protected Tensor readTensorFromFile(String name, TensorType type, FileReference fileReference) { try { File file = fileAcquirer.waitFor(fileReference, 7, TimeUnit.DAYS); - if (file.getName().endsWith(".tbf")) + if (file.getName().endsWith(".tbf")) { return TypedBinaryFormat.decode(Optional.of(type), GrowableByteBuffer.wrap(IOUtils.readFileBytes(file))); - else + } else if (file.getName().endsWith(".json")) { + return com.yahoo.tensor.serialization.JsonFormat.decode(type, IOUtils.readFileBytes(file)); + } else { throw new IllegalArgumentException("Constant files on other formats than .tbf are not supported, got " + file + " for constant " + name); - // TODO: Support json and json.lz4 + } + // TODO: Support json.lz4 } catch (InterruptedException e) { throw new IllegalStateException("Gave up waiting for constant " + name); |