diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-08-30 22:48:17 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-08-30 22:48:17 +0200 |
commit | 8a1c7bb53923ba9fa01c3c6ceba2046be0530d11 (patch) | |
tree | 24830adc8d42e2d9735eefeffa23ae3eb113f62a /searchlib | |
parent | 6250e2b6c78e5ee27690b5071f68ae510e8c113f (diff) |
Revert "Merge pull request #6742 from vespa-engine/revert-6732-bratseth/generate-rank-profiles-for-all-models-part-10-2"
This reverts commit a294ef166c59c795f9e6fd31fbd6914c502d559a, reversing
changes made to cef4c0f9d7c084f320e77abb2a93522acd7f3f53.
Diffstat (limited to 'searchlib')
2 files changed, 25 insertions, 17 deletions
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java index 6716993e1dd..f7fe91cb56f 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java @@ -98,33 +98,33 @@ public class ImportedModel { void requiredMacro(String name, TensorType type) { requiredMacros.put(name, type); } /** - * Returns all the outputs of this by name. The names consist of one to three parts - * separated by dot, where the first part is the model name, the second is the signature name + * Returns all the output expressions of this indexed by name. The names consist of one or two parts + * separated by dot, where the first part is the signature name * if signatures are used, or the expression name if signatures are not used and there are multiple - * expressions, and the third is the output name if signature names are used. + * expressions, and the second is the output name if signature names are used. */ public List<Pair<String, RankingExpression>> outputExpressions() { - List<Pair<String, RankingExpression>> names = new ArrayList<>(); + List<Pair<String, RankingExpression>> expressions = new ArrayList<>(); for (Map.Entry<String, Signature> signatureEntry : signatures().entrySet()) { for (Map.Entry<String, String> outputEntry : signatureEntry.getValue().outputs().entrySet()) - names.add(new Pair<>(signatureEntry.getKey() + "." + outputEntry.getKey(), - expressions().get(outputEntry.getValue()))); + expressions.add(new Pair<>(signatureEntry.getKey() + "." + outputEntry.getKey(), + expressions().get(outputEntry.getValue()))); if (signatureEntry.getValue().outputs().isEmpty()) // fallback: Signature without outputs - names.add(new Pair<>(signatureEntry.getKey(), - expressions().get(signatureEntry.getKey()))); + expressions.add(new Pair<>(signatureEntry.getKey(), + expressions().get(signatureEntry.getKey()))); } if (signatures().isEmpty()) { // fallback for models without signatures if (expressions().size() == 1) { - Map.Entry<String, RankingExpression> singleEntry = expressions.entrySet().iterator().next(); - names.add(new Pair<>(singleEntry.getKey(), singleEntry.getValue())); + Map.Entry<String, RankingExpression> singleEntry = this.expressions.entrySet().iterator().next(); + expressions.add(new Pair<>(singleEntry.getKey(), singleEntry.getValue())); } else { for (Map.Entry<String, RankingExpression> expressionEntry : expressions().entrySet()) { - names.add(new Pair<>(expressionEntry.getKey(), expressionEntry.getValue())); + expressions.add(new Pair<>(expressionEntry.getKey(), expressionEntry.getValue())); } } } - return names; + return expressions; } /** diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModels.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModels.java index b1714b49256..32d33622a33 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModels.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModels.java @@ -10,7 +10,9 @@ import java.util.Collection; import java.util.Optional; /** - * All models imported from the models/ directory in the application package + * All models imported from the models/ directory in the application package. + * If this is empty it may be due to either not having any models in the application package, + * or this being created for a ZooKeeper application package, which does not have imported models. * * @author bratseth */ @@ -54,16 +56,22 @@ public class ImportedModels { } /** - * Returns the model at the given location in the application package (lazily loaded), + * Returns the model at the given location in the application package. * - * @param modelPath the full path to this model (file or directory, depending on model type) - * under the application package - * @throws IllegalArgumentException if the model cannot be loaded + * @param modelPath the path to this model (file or directory, depending on model type) + * under the application package, both from the root or relative to the + * models directory works + * @return the model at this path or null if none */ public ImportedModel get(File modelPath) { + System.out.println("Name from " + modelPath + ": " + toName(modelPath)); return importedModels.get(toName(modelPath)); } + public ImportedModel get(String modelName) { + return importedModels.get(modelName); + } + /** Returns an immutable collection of all the imported models */ public Collection<ImportedModel> all() { return importedModels.values(); |