jina.executors.encoders.frameworks

class jina.executors.encoders.frameworks.BaseOnnxEncoder(output_feature=None, model_path=None, *args, **kwargs)[source]

Bases: jina.executors.devices.OnnxDevice, jina.executors.encoders.BaseEncoder

Parameters
  • output_feature (Optional[str]) – the name of the layer for feature extraction.

  • model_path (Optional[str]) – the path of the model in the format of .onnx. Check a list of available pretrained models at https://github.com/onnx/models#image_classification and download the git LFS to your local path. The model_path is the local path of the .onnx file, e.g. /tmp/onnx/mobilenetv2-1.0.onnx.

post_init()[source]
Load the model from the .onnx file and add outputs for the selected layer, i.e. outputs_name. The modified

models is saved at tmp_model_path.

class jina.executors.encoders.frameworks.BaseTFEncoder(*args, **kwargs)[source]

Bases: jina.executors.devices.TFDevice, jina.executors.encoders.BaseEncoder

class jina.executors.encoders.frameworks.BaseTorchEncoder(*args, **kwargs)[source]

Bases: jina.executors.devices.TorchDevice, jina.executors.encoders.BaseEncoder

class jina.executors.encoders.frameworks.BasePaddleEncoder(*args, **kwargs)[source]

Bases: jina.executors.devices.PaddleDevice, jina.executors.encoders.BaseEncoder

class jina.executors.encoders.frameworks.BaseMindsporeEncoder(model_path=None, *args, **kwargs)[source]

Bases: jina.executors.devices.MindsporeDevice, jina.executors.encoders.BaseEncoder

BaseMindsporeEncoder is the base class for implementing Encoders with models from mindspore.

To implement your own executor with the mindspore lilbrary,

Parameters

model_path (Optional[str]) – the path of the model’s checkpoint.

post_init()[source]

Load the model from the .ckpt checkpoint.

model
get_cell()[source]

Return Mindspore Neural Networks Cells.

Pre-defined building blocks or computing units to construct Neural Networks. A Cell could be a single neural network cell, such as conv2d, relu, batch_norm, etc. or a composition of cells to constructing a network.

Returns

mindspore.nn.Cell