summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-29 19:39:56 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-29 19:39:56 +0200
commit50c92f5b6f3319b5f59dd5d30792e51f83de3d2b (patch)
tree3723386d7469dfc94f2a2dba6e121913b4134eb0 /searchlib
parentdbc86be22dad1d9fb279d978a45e621a5325ca7e (diff)
Revert "Merge pull request #6722 from vespa-engine/revert-6713-bratseth/generate-rank-profiles-for-all-models-part-10"
This reverts commit 6958f2a641eaad0c61249e7bca887a1405e17d02, reversing changes made to 06323aff51bf054d64ef2bea001917a22433717f.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModel.java24
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/integration/ml/ImportedModels.java18
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();