public class PtModel
extends ai.djl.BaseModel
PtModel is the PyTorch implementation of Model.
PtModel contains all the methods in Model to load and process a model. In addition, it provides PyTorch Specific functionality
| Modifier and Type | Method and Description |
|---|---|
java.lang.String[] |
getArtifactNames() |
void |
load(java.io.InputStream modelStream)
Load PyTorch model from
InputStream. |
void |
load(java.nio.file.Path modelPath,
java.lang.String prefix,
java.util.Map<java.lang.String,?> options) |
ai.djl.training.Trainer |
newTrainer(ai.djl.training.TrainingConfig trainingConfig) |
close, describeInput, describeOutput, finalize, getArtifact, getArtifact, getArtifactAsStream, getBlock, getDataType, getModelPath, getName, getNDManager, getProperty, loadFromBlockFactory, newPredictor, paramPathResolver, readParameters, save, setBlock, setDataType, setModelDir, setProperty, toStringpublic void load(java.nio.file.Path modelPath,
java.lang.String prefix,
java.util.Map<java.lang.String,?> options)
throws java.io.IOException,
ai.djl.MalformedModelException
java.io.IOExceptionai.djl.MalformedModelExceptionpublic void load(java.io.InputStream modelStream)
throws java.io.IOException
InputStream.
Currently, only TorchScript file are supported
modelStream - the stream of the model filejava.io.IOException - model loading errorpublic ai.djl.training.Trainer newTrainer(ai.djl.training.TrainingConfig trainingConfig)
newTrainer in interface ai.djl.ModelnewTrainer in class ai.djl.BaseModelpublic java.lang.String[] getArtifactNames()
getArtifactNames in interface ai.djl.ModelgetArtifactNames in class ai.djl.BaseModel