diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-03-07 13:58:20 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-03-07 13:58:20 +0000 |
commit | b9995e437a32e28b31d49c18eb653d1b2f08a5f0 (patch) | |
tree | 920ffb48bc8e399cd767951c46c4ddeed4a20aa5 /model-evaluation | |
parent | 4b115c633d46d9b79a55f898129da072bac866c4 (diff) |
use RankProfilesConfigImporter directly, with a configured MockFileAcquirer
Diffstat (limited to 'model-evaluation')
-rw-r--r-- | model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java index 3cc01ac2414..3f9b86e67e4 100644 --- a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java +++ b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.models.evaluation; +import ai.vespa.modelintegration.evaluator.OnnxRuntime; import com.yahoo.config.subscription.ConfigGetter; import com.yahoo.filedistribution.fileacquirer.MockFileAcquirer; import com.yahoo.path.Path; @@ -9,6 +10,9 @@ import com.yahoo.vespa.config.search.RankProfilesConfig; import com.yahoo.vespa.config.search.core.OnnxModelsConfig; import com.yahoo.vespa.config.search.core.RankingConstantsConfig; import com.yahoo.vespa.config.search.core.RankingExpressionsConfig; + +import java.io.File; +import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; @@ -36,8 +40,19 @@ public class ModelTester { RankingExpressionsConfig expressionsConfig = ConfigGetter.getConfig(RankingExpressionsConfig.class, fileConfigId(path, "ranking-expressions.cfg")); OnnxModelsConfig onnxModelsConfig = ConfigGetter.getConfig(OnnxModelsConfig.class, fileConfigId(path, "onnx-models.cfg")); + Map<String, File> fileMap = new HashMap<>(); + for (var cfgEntry : onnxModelsConfig.model()) { + fileMap.put(cfgEntry.fileref().value(), new File(path + cfgEntry.fileref().value())); + } + for (var cfgEntry : constantsConfig.constant()) { + fileMap.put(cfgEntry.fileref().value(), new File(path + cfgEntry.fileref().value())); + } + for (var cfgEntry : expressionsConfig.expression()) { + fileMap.put(cfgEntry.fileref().value(), new File(path + cfgEntry.fileref().value())); + } + var fileAcquirer = MockFileAcquirer.returnFiles(fileMap); - return new RankProfilesConfigImporterWithMockedConstants(Path.fromString(path), MockFileAcquirer.returnFile(null)) + return new RankProfilesConfigImporter(fileAcquirer, new OnnxRuntime()) .importFrom(config, constantsConfig, expressionsConfig, onnxModelsConfig); } |