Class PpModel

java.lang.Object
ai.djl.BaseModel
ai.djl.paddlepaddle.engine.PpModel
All Implemented Interfaces:
ai.djl.Model, AutoCloseable

public class PpModel extends ai.djl.BaseModel
PpModel is the PaddlePaddle implementation of Model.
  • Field Summary

    Fields inherited from class ai.djl.BaseModel

    artifacts, block, dataType, inputData, manager, modelDir, modelName, properties, wasLoaded
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    void
    load(Path modelPath, String prefix, Map<String,?> options)
    Loads the PaddlePaddle model from a specified location.
    <I, O> ai.djl.inference.Predictor<I,O>
    newPredictor(ai.djl.translate.Translator<I,O> translator, ai.djl.Device device)

    Methods inherited from class ai.djl.BaseModel

    describeInput, describeOutput, finalize, getArtifact, getArtifact, getArtifactAsStream, getArtifactNames, getBlock, getDataType, getModelPath, getName, getNDManager, getProperties, getProperty, load, newTrainer, paramPathResolver, readParameters, save, setBlock, setDataType, setModelDir, setProperty, toString

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface ai.djl.Model

    cast, getProperty, load, load, load, newPredictor, quantize
  • Method Details

    • load

      public void load(Path modelPath, String prefix, Map<String,?> options) throws IOException
      Loads the PaddlePaddle model from a specified location.
       Map<String, String> options = new HashMap<>()
       options.put("epoch", "3");
       model.load(modelPath, "squeezenet", options);
       
      Parameters:
      modelPath - the directory of the model
      prefix - the model file name or path prefix
      options - load model options, see documentation for the specific engine
      Throws:
      IOException - Exception for file loading
    • newPredictor

      public <I, O> ai.djl.inference.Predictor<I,O> newPredictor(ai.djl.translate.Translator<I,O> translator, ai.djl.Device device)
      Specified by:
      newPredictor in interface ai.djl.Model
      Overrides:
      newPredictor in class ai.djl.BaseModel
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ai.djl.Model
      Overrides:
      close in class ai.djl.BaseModel