Package com.yahoo.vespa.model.ml
Class OnnxModelInfo
- java.lang.Object
-
- com.yahoo.vespa.model.ml.OnnxModelInfo
-
public class OnnxModelInfo extends Object
Model information (input and output types) for an ONNX model. This encapsulates the difference between reading ONNX model information - from a file application package, where we can read the ONNX model directly - from a ZK application package, where the file is unavailable and models are read from generated files stored in file distribution or ZooKeeper.- Author:
- lesters
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
asValidIdentifier(String str)
String
getDefaultOutput()
Set<String>
getInputs()
String
getModelPath()
Set<String>
getOutputs()
com.yahoo.tensor.TensorType
getTensorType(String onnxName, Map<String,com.yahoo.tensor.TensorType> inputTypes)
Return the tensor type for an ONNX model for the given context.static OnnxModelInfo
jsonToModelInfo(String json)
static OnnxModelInfo
load(String path, com.yahoo.config.application.api.ApplicationPackage app)
static boolean
modelExists(String path, com.yahoo.config.application.api.ApplicationPackage app)
-
-
-
Method Detail
-
getModelPath
public String getModelPath()
-
getDefaultOutput
public String getDefaultOutput()
-
getTensorType
public com.yahoo.tensor.TensorType getTensorType(String onnxName, Map<String,com.yahoo.tensor.TensorType> inputTypes)
Return the tensor type for an ONNX model for the given context. An ONNX model can have dynamic/symbolic dimension sizes. If so, the output type depends on the input types for the given context (rank profile).
-
load
public static OnnxModelInfo load(String path, com.yahoo.config.application.api.ApplicationPackage app)
-
modelExists
public static boolean modelExists(String path, com.yahoo.config.application.api.ApplicationPackage app)
-
jsonToModelInfo
public static OnnxModelInfo jsonToModelInfo(String json) throws IOException
- Throws:
IOException
-
-