public class Model extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BLOB_CHUNK_SIZE_PROPERTY |
Constructor and Description |
---|
Model(Backend backend,
Device device,
byte[] blob) |
Model(Backend backend,
Device device,
String[] inputs,
String[] outputs,
byte[] blob) |
Model(Backend backend,
Device device,
String[] inputs,
String[] outputs,
byte[] blob,
long batchSize,
long minBatchSize) |
Model(Backend backend,
Device device,
URI modelUri) |
Modifier and Type | Method and Description |
---|---|
static Model |
createModelFromRespReply(List<?> reply) |
Backend |
getBackend() |
long |
getBatchSize() |
byte[] |
getBlob() |
Device |
getDevice() |
String[] |
getInputs() |
long |
getMinBatchSize() |
long |
getMinBatchTimeout() |
protected List<byte[]> |
getModelSetCommandBytes(String key)
Encodes the current model properties into an AI.MODELSET command to be store in RedisAI Server
|
protected List<byte[]> |
getModelStoreCommandArgs(String key)
Encodes the current model properties into an AI.MODELSTORE command to store in RedisAI Server.
|
String[] |
getOutputs() |
String |
getTag() |
protected static List<byte[]> |
modelExecuteCommandArgs(String key,
String[] inputs,
String[] outputs,
long timeout,
boolean includeCommandName) |
protected static List<byte[]> |
modelRunFlatArgs(String key,
String[] inputs,
String[] outputs,
boolean includeCommandName) |
void |
setBackend(Backend backend)
Deprecated.
This variable will be final. Use any constructor.
|
Model |
setBatchSize(long batchsize) |
void |
setBlob(byte[] blob)
Deprecated.
This variable will be final. Use any constructor.
|
void |
setDevice(Device device)
Deprecated.
This variable will be final. Use any constructor.
|
Model |
setInputs(String[] inputs) |
Model |
setMinBatchSize(long minbatchsize) |
Model |
setMinBatchTimeout(long minBatchTimeout) |
Model |
setOutputs(String[] outputs) |
Model |
setTag(String tag) |
public static final String BLOB_CHUNK_SIZE_PROPERTY
public Model(Backend backend, Device device, URI modelUri) throws IOException
backend
- - the backend for the model. can be one of TF, TFLITE, TORCH or ONNXdevice
- - the device that will execute the model. can be of CPU or GPUmodelUri
- - filepath of the Protobuf-serialized modelIOException
Model(com.redislabs.redisai.Backend, com.redislabs.redisai.Device, byte[])
,
Files.readAllBytes(java.nio.file.Path)
,
Paths.get(java.net.URI)
public Model(Backend backend, Device device, byte[] blob)
backend
- - the backend for the model. can be one of TF, TFLITE, TORCH or ONNXdevice
- - the device that will execute the model. can be of CPU or GPUblob
- - the Protobuf-serialized modelpublic Model(Backend backend, Device device, String[] inputs, String[] outputs, byte[] blob)
backend
- - the backend for the model. can be one of TF, TFLITE, TORCH or ONNXdevice
- - the device that will execute the model. can be of CPU or GPUinputs
- - one or more names of the model's input nodes (applicable only for TensorFlow
models)outputs
- - one or more names of the model's output nodes (applicable only for TensorFlow
models)blob
- - the Protobuf-serialized modelpublic Model(Backend backend, Device device, String[] inputs, String[] outputs, byte[] blob, long batchSize, long minBatchSize)
backend
- - the backend for the model. can be one of TF, TFLITE, TORCH or ONNXdevice
- - the device that will execute the model. can be of CPU or GPUinputs
- - one or more names of the model's input nodes (applicable only for TensorFlow
models)outputs
- - one or more names of the model's output nodes (applicable only for TensorFlow
models)blob
- - the Protobuf-serialized modelbatchSize
- - when provided with an batchsize that is greater than 0, the engine will
batch incoming requests from multiple clients that use the model with input tensors of the
same shape.minBatchSize
- - when provided with an minbatchsize that is greater than 0, the engine
will postpone calls to AI.MODELRUN until the batch's size had reached minbatchsizepublic String getTag()
public byte[] getBlob()
@Deprecated public void setBlob(byte[] blob)
blob
- public String[] getOutputs()
public String[] getInputs()
public Device getDevice()
@Deprecated public void setDevice(Device device)
device
- public Backend getBackend()
@Deprecated public void setBackend(Backend backend)
backend
- public long getBatchSize()
public Model setBatchSize(long batchsize)
public long getMinBatchSize()
public Model setMinBatchSize(long minbatchsize)
public long getMinBatchTimeout()
public Model setMinBatchTimeout(long minBatchTimeout)
protected List<byte[]> getModelSetCommandBytes(String key)
key
- name of key to store the Modelprotected List<byte[]> getModelStoreCommandArgs(String key)
key
- protected static List<byte[]> modelRunFlatArgs(String key, String[] inputs, String[] outputs, boolean includeCommandName)
Copyright © 2021. All rights reserved.