diff options
Diffstat (limited to 'config-model/src')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java | 13 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java | 10 |
2 files changed, 8 insertions, 15 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java index 1ba8b470891..e676667ae89 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java @@ -2,11 +2,6 @@ package com.yahoo.vespa.model; import ai.vespa.rankingexpression.importer.configmodelview.MlModelImporter; -import ai.vespa.rankingexpression.importer.lightgbm.LightGBMImporter; -import ai.vespa.rankingexpression.importer.onnx.OnnxImporter; -import ai.vespa.rankingexpression.importer.tensorflow.TensorFlowImporter; -import ai.vespa.rankingexpression.importer.vespa.VespaImporter; -import ai.vespa.rankingexpression.importer.xgboost.XGBoostImporter; import com.yahoo.component.annotation.Inject; import com.yahoo.component.Version; import com.yahoo.component.provider.ComponentRegistry; @@ -61,6 +56,7 @@ public class VespaModelFactory implements ModelFactory { /** Creates a factory for Vespa models for this version of the source */ @Inject public VespaModelFactory(ComponentRegistry<ConfigModelPlugin> pluginRegistry, + ComponentRegistry<MlModelImporter> modelImporters, ComponentRegistry<Validator> additionalValidators, Zone zone) { this.version = new Version(VespaVersion.major, VespaVersion.minor, VespaVersion.micro); @@ -71,12 +67,7 @@ public class VespaModelFactory implements ModelFactory { } } this.configModelRegistry = new MapConfigModelRegistry(modelBuilders); - this.modelImporters = List.of( - new VespaImporter(), - new OnnxImporter(), - new TensorFlowImporter(), - new XGBoostImporter(), - new LightGBMImporter()); + this.modelImporters = modelImporters.allComponents(); this.zone = zone; this.additionalValidators = List.copyOf(additionalValidators.allComponents()); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java index 96a6b39dc1a..9ba87fd24bf 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java @@ -199,8 +199,8 @@ public class ConvertedModel { ModelStore store) { // Add constants Set<String> constantsReplacedByFunctions = new HashSet<>(); - model.smallConstantTensors().forEach((k, v) -> transformSmallConstant(store, profile, k, v)); - model.largeConstantTensors().forEach((k, v) -> transformLargeConstant(store, profile, queryProfiles, + model.smallConstants().forEach((k, v) -> transformSmallConstant(store, profile, k, v)); + model.largeConstants().forEach((k, v) -> transformLargeConstant(store, profile, queryProfiles, constantsReplacedByFunctions, k, v)); // Add functions @@ -294,7 +294,8 @@ public class ConvertedModel { } private static void transformSmallConstant(ModelStore store, RankProfile profile, String constantName, - Tensor constantValue) { + String constantValueString) { + Tensor constantValue = Tensor.from(constantValueString); store.writeSmallConstant(constantName, constantValue); Reference name = FeatureNames.asConstantFeature(constantName); profile.add(new RankProfile.Constant(name, constantValue)); @@ -305,7 +306,8 @@ public class ConvertedModel { QueryProfileRegistry queryProfiles, Set<String> constantsReplacedByFunctions, String constantName, - Tensor constantValue) { + String constantValueString) { + Tensor constantValue = Tensor.from(constantValueString); RankProfile.RankingExpressionFunction rankingExpressionFunctionOverridingConstant = profile.getFunctions().get(constantName); if (rankingExpressionFunctionOverridingConstant != null) { TensorType functionType = rankingExpressionFunctionOverridingConstant.function().getBody().type(profile.typeContext(queryProfiles)); |