Class ModelsEvaluator

java.lang.Object
com.yahoo.component.AbstractComponent
ai.vespa.models.evaluation.ModelsEvaluator
All Implemented Interfaces:
com.yahoo.component.Component, com.yahoo.component.Deconstructable, Comparable<com.yahoo.component.Component>

public class ModelsEvaluator extends com.yahoo.component.AbstractComponent
Evaluates machine-learned models added to Vespa applications and available as config form. Usage: Tensor result = evaluator.bind("foo", value).bind("bar", value").evaluate()
Author:
bratseth
  • Field Summary

    Fields inherited from class com.yahoo.component.AbstractComponent

    isDeconstructable
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModelsEvaluator(RankProfilesConfigImporter importer, com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig)
     
    ModelsEvaluator(com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer)
     
    ModelsEvaluator(com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer, ai.vespa.modelintegration.evaluator.OnnxRuntime onnx)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    evaluatorOf(String modelName, String... names)
    Returns a function which can be used to evaluate the given function in the given model
    Returns the models of this as an immutable map
    Returns the given model, or throws a IllegalArgumentException if it does not exist

    Methods inherited from class com.yahoo.component.AbstractComponent

    clone, compareTo, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ModelsEvaluator

      @Inject public ModelsEvaluator(com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer, ai.vespa.modelintegration.evaluator.OnnxRuntime onnx)
    • ModelsEvaluator

      public ModelsEvaluator(com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig, com.yahoo.filedistribution.fileacquirer.FileAcquirer fileAcquirer)
    • ModelsEvaluator

      public ModelsEvaluator(RankProfilesConfigImporter importer, com.yahoo.vespa.config.search.RankProfilesConfig config, com.yahoo.vespa.config.search.core.RankingConstantsConfig constantsConfig, com.yahoo.vespa.config.search.core.RankingExpressionsConfig expressionsConfig, com.yahoo.vespa.config.search.core.OnnxModelsConfig onnxModelsConfig)
    • ModelsEvaluator

      public ModelsEvaluator(Map<String,Model> models)
  • Method Details

    • models

      public Map<String,Model> models()
      Returns the models of this as an immutable map
    • evaluatorOf

      public FunctionEvaluator evaluatorOf(String modelName, String... names)
      Returns a function which can be used to evaluate the given function in the given model
      Parameters:
      modelName - the name of the model
      names - the 0-2 name components identifying the output to compute
      Throws:
      IllegalArgumentException - if the function or model is not present
    • requireModel

      public Model requireModel(String name)
      Returns the given model, or throws a IllegalArgumentException if it does not exist
    • deconstruct

      public void deconstruct()
      Specified by:
      deconstruct in interface com.yahoo.component.Deconstructable
      Overrides:
      deconstruct in class com.yahoo.component.AbstractComponent